PrePaint: LayoutObject traversal with LayoutNG fragment lookups.

Almost completely move away from fragment traversal in pre-paint.
Instead do LayoutObject traversal accompanied by a corresponding
NGPhysicalBoxFragment when possible. This means that we'll keep track of
the fragment of the parent LayoutObject at any given time, and, when
entering a child LayoutObject, we'll search that fragment for a child
fragment (or child fragment item) representing a child LayoutObject.
If we don't find the child, it means that it doesn't exist in the
current fragmentainer.

One piece of complexity here is out-of-flow positioned elements. Since
we're traversing the LayoutObject tree, and keep track of the fragment
of the parent LayoutObject, for OOFs, we also need to keep track of the
ancestor fragments that may contain absolutely or fixed positioned
descendants, and search them, rather than the parent fragment, when
looking for OOFs. We also need to make paint offset adjustments when
entering OOFs, since OOFs are direct children of a fragmentainer, rather
than a child of their actual containing block.

There are still a few cases where it's just too hard to avoid fragment
traversal, though:

1. OOF fragments with missing containing block fragments. This happens
when an OOF inside block fragmentation overflows its actual containing
block, and occurs in fragmentainers where the containing block doesn't
occur.

2. Fragmented floats inside inline formatting contexts, when the float
occurs in fragmentainers where some of its ancestors don't.

3. Column spanners are always entered directly from the ancestor
multicol container.

When we fall back to fragment traversal like this, we'll also miss any
paint effects that should be caused by the missing ancestors. The new
test external/wpt/css/css-break/transform-009.html is failing because of
this. See crbug.com/1224888 . We might want to revisit this later if
important enough, but it will require large changes to how we lay out
OOFs in block fragmentation.

This CL fixes as many as *one* existing test. Added a few new ones that
previously didn't pass (except for the one mentioned above). This CL
fixes a few things:

1. Apply paint effects caused by parents not in the containing block
chain (e.g. on an abspos inside opacity inside relpos).

2. Handle transforms correctly for OOFs inside multicol.

3. Clear paint invalidation flags for text and non-atomic inlines, so
that if someone dirties them, we'll actually mark the tree properly, and
recalculate paint properties and invalidate for paint as necessary.

virtual/layout_ng_fragment_traversal/external/wpt/css/CSS2/positioning/
toogle-abspos-on-relpos-inline-child.html is now failing. See
crbug.com/1225304

Updated css/css-break/out-of-flow-in-multicolumn-035.html to add some
transform translation, to test fixedpos inside abspos in multicol. This
test now fails with legacy block fragmentation.

Remove NGFragmentChildIterator, since this was only used as a helper for
fragment traversal in pre-paint. It helped us access incoming break
tokens very easily. We cannot use it for LayoutObject traversal. We
still need the incoming break token in a couple of relatively rare
cases, and we'll just find it manually there. This isn't exactly cheap,
but I believe that, at some point in the future, we won't need incoming
break tokens at all during painting (only during layout).

As part of reducing the need for incoming break tokens, we'll no longer
use the "flow thread offset" as an ID in FragmentData in NG (in fact, we
were abusing this field by storing consumed block-size instead of flow
thread offset). Instead we'll use the fragmentainer index, which is
easier and cheaper to obtain. PaintInfo will now map from
NGPhysicalBoxFragment to FragmentData in more cases than before, rather
than comparing fragment IDs. The only case in NG where we need to map
using the fragment ID is for self-painting non-atomic inlines (which
don't store a vector of physical fragments in the layout object).

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

Pull requests are automatically mirrored except those that modify sensitive resources (such as .py). The latter require someone with merge access to comment with “LGTM” or “w3c-test:mirror” to indicate the pull request has been checked.

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!