Closed Bug 1804362 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 37366 - [anchor-position] Allow top-layer elements to anchor to abspos elements

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox110 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 37366 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/37366
Details from upstream follow.

Xiaocheng Hu <xiaochengh@chromium.org> wrote:

[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/4083692
WPT-Export-Revision: 8984ab89a4879fb0df00110ab747dd302b820c64

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 7 tests

Status Summary

Firefox

FAIL: 7

Chrome

PASS: 2
FAIL: 5

Safari

FAIL: 7

Links

GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/19c6f3f32913 [wpt PR 37366] - [anchor-position] Allow top-layer elements to anchor to abspos elements, a=testonly https://hg.mozilla.org/integration/autoland/rev/47e852b9824a [wpt PR 37366] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
You need to log in before you can comment on or make changes to this bug.