[FlexNG] Expand row cross size for fragmentation

Previously, for flex rows, when items expanded as a result of
fragmentation, we would only adjust the subsequent rows' offsets based
on the expansion amount. However, we also want to expand the row
block-size to allow items in that row to stretch to the newly expanded
size.

Because flex items in a row can break before, we couldn't implement
this in the same way as grid (i.e. by storing the results and
offsets and then adding them to the builder once all expansion is
handled). Otherwise, we could end up with a child break before added
to the builder before the previous items in the row had been added.

Instead, we need to abort layout and re-run with the updated row
block-sizes (using the newly added layout result status of
kNeedsRelayoutWithRowCrossSizeChanges and the newly added
RelayoutWithNewRowSizes() method).

Since we will re-layout as we go, we can no longer wait to detect
the row expansion until items have completed layout, but we need to
find the max row expansion in each fragmentainer as we go (and as
items cross the current row block-size). As such, we now calculate
row expansion without making use of NGFlexItem's
total_remaining_block_size (as we do for columns).

Because more than one row can expand per fragmentainer, we can avoid
aborting layout more than once by adjusting subsequent row offsets
as expansion is discovered and by keeping track of the expansion
of all rows in a given fragmentainer (there should only be at most two
row expansions at a time, though).

While testing, I ran into a few additional issues:

1. I had noticed a bug with how row expansion was handled for items
that broke before. We would previously adjust the offset of all items
in the row rather than just the offset of the item itself. This is now
fixed by not updating |line_output.item_offset_adjustment| in this
case.

2. When checking if the |broke_before_row| is associated with the
current row, we can't just check if we are at an item at index 0
since a previous item may have broken as a result of overflow.
Check instead if the current item is at index 0 and that it broke
before.

3. When adding |item_offset_adjustment| of one row to the next,
check if the last item has a break token or if the line has seen
all children so that we do so even if the last item overflows. (But
if the last item overflowed, we only want to adjust
|item_offset_adjustment| if there aren't any additional break tokens
to process, in which case the next row would have already started
making progress).

Note: We will stop row expansion if the container's consumed block-size
hits the max to avoid infinite expansion. This keeps the following test
from timing out:
external/wpt/css/css-break/flexbox/flexbox-fragmentation-layout-001-crash.html

multi-line-row-flex-fragmentation-016.html was previously incorrect
since item stretching as a result of row expansion was not yet
implemented. The test is now updated to account for the new
behavior.

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