[LayoutNG] Relative offset for fragmented OOF elements

There were a couple of issues with how relative positioning was being
applied for OOF elements during fragmentation:

1. The relative inline inset was not being applied to the OOF
descendants.
2. The relative block inset was being applied, but it was being applied
before fragmentation, which is not correct.

The reason that the relative inline inset was not being applied was
that we were only ever propagating the block offset of the containing
block as OOF fragmentainer descendants were being propagated up the
tree inside NGContainerFragmentBuilder::PropagateOOFPositionedInfo().
This was incorrect - both the inline and block offset of the containing
block should be accumulated as the OOFs propagate up the tree.

Because ancestor inline offsets are now applied as the OOF makes its way
up the tree, a new issue was identified regarding CL:2836226. In
CL:2836226, the fragmentainer offset was applied to the OOF offset
in NGOutOfFlowLayoutPart before PropagateOOFPositionedInfo() was called.
However, we only want to apply the fragmentainer offset for descendants
whose containing block is outside the fragmentation context of the
ancestor OOF element. To fix this, the fragmentainer offset is
passed into PropagateOOFPositionedInfo() as a separate variable
(offset_adjustment) to ensure that this offset is only applied in
the correct scenarios.

The relative block inset was being applied before fragmentation because
the relative ancestor's offset included its insets by the time the OOF
element was laid out. To fix this, pass the relative ancestor's
un-adjusted offset and relative offset into NGContainerFragmentBuilder::
PropagateChildData()/PropagateOOFPositionedInfo() to ensure that we
don't apply the relative offset too early in this case.

To ensure the relative offset is applied after fragmentation of an
OOF descendant, an additional variable was added to the
NGContainingBlock struct stored in NGOutOfFlowPositionedNode for the
accumulated relative_offset of the containing block. This is then
applied after the OOF descendant is laid out and fragmented.

Note: This CL does not handle the case of an inline containing block
with relative insets. This will be investigated as a follow-up
given that inline CBs have not been addressed in general for fragmented
OOF elements.

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