Fix line breaking with `break-spaces` in the presence of close tags

With the `white-space: break-spaces` CSS property, white spaces are
always preserved, and they always take space. Combined with the fact
that white space characters have a break opportunity after them, but
not before (as required by UAX#14), this means that a word which
exactly fits the remaining inline size of the line, could not fit in
that line without overflow if it was followed by a space.

Chromium's implementation of `break-spaces`, however, did allow
breaking between a word and a space if there was a closing element
boundary in the way, even if both sides of the boundary had
`white-space: break-spaces`. This is because
`NGLineBreaker::HandleCloseTag` did not seem to be considering the
`break-spaces` class. This CL fixes this.

Bug: 1261435
Change-Id: I010cf99ffb0c2cf03b4ff2547a412cc44c7e1bab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4150327
Reviewed-by: Koji Ishii <kojii@chromium.org>
Commit-Queue: Andreu Botella <abotella@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1096617}
1 file changed
tree: 3a97e0aab8934fbce34bf6a2ac1a461e022d4c42
  1. .github/
  2. .well-known/
  3. accelerometer/
  4. accessibility/
  5. accname/
  6. acid/
  7. ambient-light/
  8. animation-worklet/
  9. annotation-model/
  10. annotation-protocol/
  11. annotation-vocab/
  12. apng/
  13. appmanifest/
  14. attribution-reporting/
  15. audio-output/
  16. autoplay-policy-detection/
  17. avif/
  18. background-fetch/
  19. background-sync/
  20. badging/
  21. battery-status/
  22. beacon/
  23. bluetooth/
  24. clear-site-data/
  25. client-hints/
  26. clipboard-apis/
  27. close-watcher/
  28. common/
  29. compat/
  30. compression/
  31. compute-pressure/
  32. conformance-checkers/
  33. console/
  34. contacts/
  35. content-dpr/
  36. content-index/
  37. content-security-policy/
  38. contenteditable/
  39. cookie-store/
  40. cookies/
  41. core-aam/
  42. cors/
  43. credential-management/
  44. css/
  45. custom-elements/
  46. custom-state-pseudo-class/
  47. delegated-ink/
  48. density-size-correction/
  49. deprecation-reporting/
  50. device-memory/
  51. direct-sockets/
  52. docs/
  53. document-picture-in-picture/
  54. document-policy/
  55. dom/
  56. domparsing/
  57. domxpath/
  58. dpub-aam/
  59. dpub-aria/
  60. ecmascript/
  61. editing/
  62. element-timing/
  63. encoding/
  64. encoding-detection/
  65. encrypted-media/
  66. entries-api/
  67. event-timing/
  68. eventsource/
  69. eyedropper/
  70. feature-policy/
  71. fetch/
  72. file-system-access/
  73. FileAPI/
  74. focus/
  75. font-access/
  76. fonts/
  77. forced-colors-mode/
  78. fs/
  79. fullscreen/
  80. gamepad/
  81. generic-sensor/
  82. geolocation-API/
  83. geolocation-sensor/
  84. graphics-aam/
  85. gyroscope/
  86. hr-time/
  87. html/
  88. html-longdesc/
  89. html-media-capture/
  90. idle-detection/
  91. imagebitmap-renderingcontext/
  92. images/
  93. import-maps/
  94. IndexedDB/
  95. inert/
  96. infrastructure/
  97. input-device-capabilities/
  98. input-events/
  99. installedapp/
  100. interfaces/
  101. intersection-observer/
  102. intervention-reporting/
  103. is-input-pending/
  104. js/
  105. js-self-profiling/
  106. keyboard-lock/
  107. keyboard-map/
  108. largest-contentful-paint/
  109. layout-instability/
  110. lifecycle/
  111. loading/
  112. longtask-timing/
  113. magnetometer/
  114. managed/
  115. mathml/
  116. measure-memory/
  117. media/
  118. media-capabilities/
  119. media-playback-quality/
  120. media-source/
  121. mediacapture-extensions/
  122. mediacapture-fromelement/
  123. mediacapture-handle/
  124. mediacapture-image/
  125. mediacapture-insertable-streams/
  126. mediacapture-record/
  127. mediacapture-region/
  128. mediacapture-streams/
  129. mediasession/
  130. merchant-validation/
  131. mimesniff/
  132. mixed-content/
  133. mst-content-hint/
  134. navigation-api/
  135. navigation-timing/
  136. netinfo/
  137. network-error-logging/
  138. notifications/
  139. old-tests/
  140. orientation-event/
  141. orientation-sensor/
  142. page-lifecycle/
  143. page-visibility/
  144. paint-timing/
  145. parakeet/
  146. payment-handler/
  147. payment-method-basic-card/
  148. payment-method-id/
  149. payment-request/
  150. pending-beacon/
  151. performance-timeline/
  152. periodic-background-sync/
  153. permissions/
  154. permissions-policy/
  155. permissions-request/
  156. permissions-revoke/
  157. picture-in-picture/
  158. pointerevents/
  159. pointerlock/
  160. portals/
  161. preload/
  162. presentation-api/
  163. priority-hints/
  164. private-click-measurement/
  165. proximity/
  166. push-api/
  167. quirks/
  168. referrer-policy/
  169. remote-playback/
  170. reporting/
  171. requestidlecallback/
  172. resize-observer/
  173. resource-timing/
  174. resources/
  175. sanitizer-api/
  176. savedata/
  177. scheduler/
  178. screen-capture/
  179. screen-details/
  180. screen-orientation/
  181. screen-wake-lock/
  182. scroll-animations/
  183. scroll-to-text-fragment/
  184. secure-contexts/
  185. secure-payment-confirmation/
  186. selection/
  187. serial/
  188. server-timing/
  189. service-workers/
  190. shadow-dom/
  191. shape-detection/
  192. shared-storage/
  193. signed-exchange/
  194. soft-navigation-heuristics/
  195. speculation-rules/
  196. speech-api/
  197. storage/
  198. storage-access-api/
  199. streams/
  200. subapps/
  201. subresource-integrity/
  202. svg/
  203. svg-aam/
  204. timing-entrytypes-registry/
  205. tools/
  206. touch-events/
  207. trust-tokens/
  208. trusted-types/
  209. ua-client-hints/
  210. uievents/
  211. upgrade-insecure-requests/
  212. url/
  213. urlpattern/
  214. user-timing/
  215. vibration/
  216. video-rvfc/
  217. virtual-keyboard/
  218. visual-viewport/
  219. wai-aria/
  220. wasm/
  221. web-animations/
  222. web-bundle/
  223. web-locks/
  224. web-nfc/
  225. web-otp/
  226. web-share/
  227. webaudio/
  228. webauthn/
  229. webcodecs/
  230. WebCryptoAPI/
  231. webdriver/
  232. webgl/
  233. webgpu/
  234. webhid/
  235. webidl/
  236. webmessaging/
  237. webmidi/
  238. webnn/
  239. webrtc/
  240. webrtc-encoded-transform/
  241. webrtc-extensions/
  242. webrtc-ice/
  243. webrtc-identity/
  244. webrtc-priority/
  245. webrtc-stats/
  246. webrtc-svc/
  247. websockets/
  248. webstorage/
  249. webtransport/
  250. webusb/
  251. webvr/
  252. webvtt/
  253. webxr/
  254. window-placement/
  255. workers/
  256. worklets/
  257. x-frame-options/
  258. xhr/
  259. .azure-pipelines.yml
  260. .gitattributes
  261. .gitignore
  262. .mailmap
  263. .taskcluster.yml
  264. CODE_OF_CONDUCT.md
  265. CODEOWNERS
  266. CONTRIBUTING.md
  267. LICENSE.md
  268. lint.ignore
  269. README.md
  270. wpt
  271. wpt.py
README.md

The web-platform-tests Project

Taskcluster CI Status documentation manifest Python 3

The web-platform-tests Project is a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.

The most important sources of information and activity are:

  • github.com/web-platform-tests/wpt: the canonical location of the project's source code revision history and the discussion forum for changes to the code
  • web-platform-tests.org: the documentation website; details how to set up the project, how to write tests, how to give and receive peer review, how to serve as an administrator, and more
  • wpt.live: a public deployment of the test suite, allowing anyone to run the tests by visiting from an Internet-enabled browser of their choice
  • wpt.fyi: an archive of test results collected from an array of web browsers on a regular basis
  • Real-time chat room: the wpt:matrix.org matrix channel; includes participants located around the world, but busiest during the European working day.
  • Mailing list: a public and low-traffic discussion list
  • RFCs: a repo for requesting comments on substantial changes that would impact other stakeholders or users; people who work on WPT infra are encouraged to watch the repo.

If you'd like clarification about anything, don't hesitate to ask in the chat room or on the mailing list.

Setting Up the Repo

Clone or otherwise get https://github.com/web-platform-tests/wpt.

Note: because of the frequent creation and deletion of branches in this repo, it is recommended to “prune” stale branches when fetching updates, i.e. use git pull --prune (or git fetch -p && git merge).

Running the Tests

See the documentation website and in particular the system setup for running tests locally.

Command Line Tools

The wpt command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are:

  • wpt serve - For starting the wpt http server
  • wpt run - For running tests in a browser
  • wpt lint - For running the lint against all tests
  • wpt manifest - For updating or generating a MANIFEST.json test manifest
  • wpt install - For installing the latest release of a browser or webdriver server on the local machine.
  • wpt serve-wave - For starting the wpt http server and the WAVE test runner. For more details on how to use the WAVE test runner see the documentation.

Windows Notes

On Windows wpt commands must be prefixed with python or the path to the python binary (if python is not in your %PATH%).

python wpt [command]

Alternatively, you may also use Bash on Ubuntu on Windows in the Windows 10 Anniversary Update build, then access your windows partition from there to launch wpt commands.

Please make sure git and your text editor do not automatically convert line endings, as it will cause lint errors. For git, please set git config core.autocrlf false in your working tree.

Publication

The master branch is automatically synced to wpt.live and w3c-test.org.

Contributing

Save the Web, Write Some Tests!

Absolutely everyone is welcome to contribute to test development. No test is too small or too simple, especially if it corresponds to something for which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

  • Fork this repository (and make sure you're still relatively in sync with it if you forked a while ago).
  • Create a branch for your changes: git checkout -b topic.
  • Make your changes.
  • Run ./wpt lint as described above.
  • Commit locally and push that to your repo.
  • Create a pull request based on the above.

Issues with web-platform-tests

If you spot an issue with a test and are not comfortable providing a pull request per above to fix it, please file a new issue. Thank you!