Automatic update from web-platform-tests
[anchor-position] Allow top-layer elements to anchor to abspos elements
Per discussion [1], we should allow a top-layer element to anchor to:
- Non-top-layer absolutely positioned elements
- Elements preceding the current element in the document top-layer
This patch implements it and adds a comprehensive test suite.
The implementation:
- Adds a flag to NGLogicalAnchorQuery::AnchorReference() to allow
returning invalid (i.e., abspos) anchors, and sets the flag when
positioning top-layer elements. This is fine because valid anchors
for a top-layer element are always inserted into the AnchorQuery
before we layout the top-layer element (ensured by layout tree order)
- Adds a flag to NGPhysicalAnchorQuery::Fragment() to allow returning
invalid (i.e., abspos) anchors, which is for `anchor-scroll`. The
result is further validated with layout tree order, so that we don't
anchor a top-layer element to another element after it in the top
layer.
- Introduces `ContainingScrollContainerForAnchor()` to correctly get
the scroll container (nullptr) of a fixed positioned anchor, as this
case is not possible before this patch
[1] https://github.com/w3c/csswg-drafts/issues/8165
Fixed: 1396436
Fixed: 1385882
Change-Id: I4436f35885e6fede6d780aae633c6525b4100510
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4083692
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1080999}
--
wpt-commits: 85ef51bdd55cea3fe87648edcedf1501ae6834dd
wpt-pr: 37366
An explanation of the Firefox Source Code Directory Structure and links to
project pages with documentation can be found at:
https://firefox-source-docs.mozilla.org/contributing/directory_structure.html
For information on how to build Firefox from the source code and create the patch see:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
If you have a question about developing Firefox, and can't find the solution
on https://firefox-source-docs.mozilla.org/, you can try asking your question on Matrix at chat.mozilla.org in `Introduction` (https://chat.mozilla.org/#/room/#introduction:mozilla.org) channel.
Nightly development builds can be downloaded from:
https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
- or -
https://www.mozilla.org/firefox/channel/desktop/#nightly
Keep in mind that nightly builds, which are used by Firefox developers for
testing, may be buggy.