Commit Graph
138 Commits
Author SHA1 Message Date
Ting-Yu Lin fdcc397a55 Bug 1886762 Part 3 - Translate anchor rect to original inline containing block's coordinate space. r=layout-reviewers,dshin
`GetMatchingContainingBlock()` may return a continuation of `aContainingBlock`.
Since we do not yet support splitting inline containing blocks across multicol,
it is sufficient to translate the rect from the matching containing block to the
original containing block. This fixes `anchor-getComputedStyle-002.html`.

Differential Revision: https://phabricator.services.mozilla.com/D303081
2026-05-29 00:55:55 +00:00
Ting-Yu Lin 1d86c70a43 Bug 1886762 Part 2 - Make GetAnchorPosRect() and helper aware of inline containing block and IB-split. r=layout-reviewers,dshin
`IsProperAncestorFrameConsideringContinuations()` gets the ability to traverse
IB-split. This doesn't change behavior for existing callers because they are all
within `MOZ_ASSERT`.

Delete `TraverseUpToContainerChild()` since it is not aware of continuations nor
IB-split, and we don't need a returned child frame pointer. Fixing it properly
makes its functionally equivalent to
`IsProperAncestorFrameConsideringContinuations()`.

Differential Revision: https://phabricator.services.mozilla.com/D303080
2026-05-29 00:55:52 +00:00
Ting-Yu Lin 478f76f4e1 Bug 1886762 Part 1 - Capitalize 'V' in aCBRectIsValid. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D303079
2026-05-29 00:55:49 +00:00
Ting-Yu Lin 34834f4591 Bug 2033342 - Remove layout.abspos.fragmentainer-aware-positioning.enabled preference. r=layout-reviewers,dshin
The pref was enabled by default in bug 2002115 and shipped in Firefox 151. Since
it has been two releases, we can remove it to simplify the code path.

Differential Revision: https://phabricator.services.mozilla.com/D302349
2026-05-25 18:30:20 +00:00
David Shin 897d8b18f0 Bug 1878994: Use the new Rust implementation instead of GetTreeForCascadeLevel. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
... This passes `Element` instead of `nsIContent`, but all view-transition
and anchor-positioning properties should apply only to (pseudo-)elements.

Differential Revision: https://phabricator.services.mozilla.com/D299487
2026-05-12 14:05:44 +00:00
Emilio Cobos Álvarez 7f29b8ded8 Bug 1878994 - Use TreeScoped for PositionTryFallbacks. r=dshin,firefox-style-system-reviewers,layout-reviewers
This will allow to implement tree-scoped lookups.

Differential Revision: https://phabricator.services.mozilla.com/D299382
2026-05-12 14:05:36 +00:00
Emilio Cobos Álvarez c549b667cd Bug 1897279 - Record last successful fallback at ResizeObserver time. r=dshin,layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D297685
2026-04-30 21:33:41 +00:00
Ting-Yu Lin ea0827122e Bug 2032635 - Use ReassembleAnchorRect() in GetAnchorPosRect() to account for fragmented absolute containing blocks. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D295435
2026-04-21 15:53:06 +00:00
David Shin ad9f711c8f Bug 2030351: Implement position-anchor: normal. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,devtools-reviewers,nchevobbe
As per the CSSWG resolution [1], this is now the default value.

Differential Revision: https://phabricator.services.mozilla.com/D292959
2026-04-16 20:15:48 +00:00
agoloman df0061cbd3 Revert "Bug 2030351: Implement position-anchor: normal. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio" for causing dt failures @browser_rules_anchor-names-autocomplete.js.
This reverts commit 2a373806b6.
2026-04-15 23:01:45 +00:00
David Shin 2a373806b6 Bug 2030351: Implement position-anchor: normal. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
As per the CSSWG resolution [1], this is now the default value.

Differential Revision: https://phabricator.services.mozilla.com/D292959
2026-04-15 21:30:16 +00:00
Emilio Cobos Álvarez cbd055339f Bug 2031110 - Remove -moz-scrolled-canvas and make viewport styles non-inheriting. r=jwatt
They never inherit anything (except background, but that is a no-op
because viewport inherits from nullptr, which is the initial style).

It seems in the past we relied on recomputing some of this for direction
propagation or so, according to the comments, but that's definitely no
longer true.

Also the comment about needing overflow: auto is wrong, because we've
since always created scrollbars for the root (and avoided reframes).

Similarly, the assertion about viewport is kinda unnecessary. It was
introduced in:

  https://hg.mozilla.org/mozilla-central/rev/8fd06045940a05d56d833a0488262fe2279d3702

But since then we always skip fixup for all anon boxes anyways, and
specify display: block explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D293710
2026-04-13 20:27:47 +00:00
agoloman ea033e9232 Revert "Bug 2031110 - Remove -moz-scrolled-canvas and make viewport styles non-inheriting. r=jwatt" for causing multiple failures.
This reverts commit e3869b3af5.
2026-04-13 16:47:39 +00:00
Emilio Cobos Álvarez e3869b3af5 Bug 2031110 - Remove -moz-scrolled-canvas and make viewport styles non-inheriting. r=jwatt
They never inherit anything (except background, but that is a no-op
because viewport inherits from nullptr, which is the initial style).

It seems in the past we relied on recomputing some of this for direction
propagation or so, according to the comments, but that's definitely no
longer true.

Also the comment about needing overflow: auto is wrong, because we've
since always created scrollbars for the root (and avoided reframes).

Differential Revision: https://phabricator.services.mozilla.com/D293710
2026-04-13 15:44:33 +00:00
Leo Tenenbaum b36d739898 Bug 2025899 - Bring popover toggle events closer in line with spec. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D290500
2026-03-31 16:54:04 +00:00
rperta e21625adee Revert "Bug 2025899 - Bring popover toggle events closer in line with spec. r=layout-reviewers,emilio" for causing wc failures at popover-focus-blur-crash.html
This reverts commit 43d3d0b572.
2026-03-31 02:36:13 +00:00
Leo Tenenbaum 43d3d0b572 Bug 2025899 - Bring popover toggle events closer in line with spec. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D290500
2026-03-30 22:59:33 +00:00
Emilio Cobos Álvarez 26bc57e700 Bug 2026592 - Optimize storage of scoped names and view-transition-name. r=firefox-style-system-reviewers,layout-reviewers,janv,dshin
With the TreeScopedTag + the extra tag, these end up being massive.

Compact their representation by reusing the array. Since they're dashed idents
we can just store the regular values however we want.

Differential Revision: https://phabricator.services.mozilla.com/D290101
2026-03-27 06:53:34 +00:00
Jari Jalkanen 44d457f44f Bug 2022861 - Resolve tree-scoped ViewTransitionNames. r=layout-reviewers,dshin
We also expose the GetShadowRootForTreeScope helper of AnchorPositioningUtils.

Differential Revision: https://phabricator.services.mozilla.com/D287436
2026-03-17 21:51:02 +00:00
Sylvestre Ledru 55481ac4b5 Bug 2023419 - Remove Emacs/Vim modelines from layout/ r=emilio,firefox-style-system-reviewers,layout-reviewers
replaced by .editorconfig

Differential Revision: https://phabricator.services.mozilla.com/D287852
2026-03-17 12:05:43 +00:00
Emilio Cobos Álvarez c7eaf6401b Bug 2023214 - Pack CascadeLevel in one byte. r=firefox-style-system-reviewers,layout-reviewers,dshin
This patch tweaks the internal representation of CascadeLevel to use a
set of bitflags for the origin and importance rather than making it part
of the discriminant.

This will allow to encode more information on CascadePriority without
growing it, like for example whether we're in an @starting-style block,
or a potentially new @appearance-base block for customizable select.

Differential Revision: https://phabricator.services.mozilla.com/D287610
2026-03-13 21:35:56 +00:00
Norisz Fay a86d829321 Revert "Bug 2012637 - part 9: Add a Firefox Source Docs documentation page for TreeKind and notable issues r=smaug,dom-core" as requested by dev
This reverts commit 88008cd8ca.

Revert "Bug 2012637 - part 8: Make `nsContentUtils::ComparePoints` handle `TreeKind::Flat` and `TreeKind::FlatForSelection` correctly r=smaug,dom-core"

This reverts commit 73e6f6587b.

Revert "Bug 2012637 - part 7: Make `RangeUtils::CompareNodeToRangeBoundaries()` use `nsContentUtils::ComparePoints` with valid point in the tree r=smaug"

This reverts commit 6985d5e80f.

Revert "Bug 2012637 - part 6: Make `nsRange::CutContents()` convert the range boundaries to the ones in the DOM before comparing r=smaug"

This reverts commit 73b585af3d.

Revert "Bug 2012637 - part 5: Delete the default template parameter of `nsContentUtils::ComparePoints` and relatives r=smaug,dom-core"

This reverts commit 1a7f24e5b5.

Revert "Bug 2012637 - part 4: Make `nsContentUtils` use `nsIContent` for taking a child node as a parameter r=smaug"

This reverts commit a6ea8d6824.

Revert "Bug 2012637 - part 3: Add template `nsINode` API which can switch to call API from `TreeKind` r=smaug,dom-core,webidl"

This reverts commit a4211e9df0.

Revert "Bug 2012637 - part 2: Add `TreeKind::FlatForSelection` and change the template parameter of `ChildIteratorBase` to `TreeKind` r=smaug,dom-core"

This reverts commit 0241749ee7.

Revert "Bug 2012637 - part 1: Make `ChildIterBase` template class to re-implement `FlattenedChildIterator` for DOM, Flat and FlatForSelection TreeKind r=smaug,dom-core,layout-reviewers,emilio"

This reverts commit 9e71cb77fb.
2026-03-13 02:52:45 +00:00
Masayuki Nakano a4211e9df0 Bug 2012637 - part 3: Add template nsINode API which can switch to call API from TreeKind r=smaug,dom-core,webidl
This will make the main patch simpler. However, some of them do not
support `TreeKind::ShadowIncludingDOM` because it's unclear what
should return as a parent node of a child of `ShadowRoot`, what should
return as a child node of a shadow host. To avoid the developers to use
them on wrong assumptions, this patch makes the users use `DOM`, `Flat`
or `FlatForSelection` explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D281305
2026-03-12 03:01:50 +00:00
David Shin e6b5166b7a Bug 2016245: Rename anchor-scope's backing type for general use. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D284560
2026-02-25 14:28:00 +00:00
iulian moraru 25fc25a6f9 Revert "Bug 2016245: Parse tree-scoped names in scroll-timeline, view-timeline, animation-timeline. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,boris" for causing multiple mochitest failures.
This reverts commit 103fd273bc.

Revert "Bug 2016245: Add parsing for timeline-scope. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,boris"

This reverts commit 8e5fa13d51.

Revert "Bug 2016245: Rename anchor-scope's backing type for general use. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,boris"

This reverts commit 7b7e701073.
2026-02-24 21:11:26 +00:00
David Shin 7b7e701073 Bug 2016245: Rename anchor-scope's backing type for general use. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D284560
2026-02-24 19:56:46 +00:00
Cosmin Sabou 61f86e6d73 Revert "Bug 2016245: Parse tree-scoped names in scroll-timeline, view-timeline, animation-timeline. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,boris" for causing mochitest plain failures on test_computed_style_difference.
This reverts commit 4caefb9c09.

Revert "Bug 2016245: Add parsing for timeline-scope. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,boris"

This reverts commit c6f5455dd1.

Revert "Bug 2016245: Rename anchor-scope's backing type for general use. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,boris"

This reverts commit 007f70e272.
2026-02-24 05:18:37 +00:00
David Shin 007f70e272 Bug 2016245: Rename anchor-scope's backing type for general use. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D284560
2026-02-24 03:50:25 +00:00
Sandor Molnar ae02646542 Revert "Bug 2016245: Parse tree-scoped names in scroll-timeline, view-timeline, animation-timeline. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,boris" for causing mochitest failures @ test_property_database DONTBUILD
This reverts commit bcf761a291.

Revert "Bug 2016245: Add parsing for timeline-scope. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,boris"

This reverts commit d42607ba35.

Revert "Bug 2016245: Rename anchor-scope's backing type for general use. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,boris"

This reverts commit 228f755dd6.
2026-02-24 01:26:49 +00:00
David Shin 228f755dd6 Bug 2016245: Rename anchor-scope's backing type for general use. r=layout-scroll-driven-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D284560
2026-02-24 00:25:09 +00:00
David Shin d60d5352e2 Bug 1991489: Ensure that when checking for anchor visibility, the intersection root rect takes union of all of its in-flow rects. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D281720
2026-02-09 22:46:40 +00:00
David Shin ff03a04698 Bug 1991489: Ensure that fragmented anchors are combined when checking for overflow. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D281719
2026-02-09 22:46:37 +00:00
David Shin 90d949ce75 Bug 1991489: During fragmentation of abspos frames, reuse anchor pos references populated during unfragmented reflow. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio,TYLin
This will cause an issue for evaluating fallbacks changing default anchors, but
that is something we can easily detect and handle down the line.

Differential Revision: https://phabricator.services.mozilla.com/D281718
2026-02-09 22:46:34 +00:00
agoloman 42a2833d9a Revert "Bug 1991489: Flip fragmentainer-aware positioning on for anchor-positioning WPTs that pass. r=layout-anchor-positioning-reviewers,emilio,TYLin" for causing ba failures @browser_anchor_positioning.js.
This reverts commit 962e149e3e.

Revert "Bug 1991489: Ensure that when checking for anchor visibility, the intersection root rect takes union of all of its in-flow rects. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio"

This reverts commit 481e451d10.

Revert "Bug 1991489: Ensure that fragmented anchors are combined when checking for overflow. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio,TYLin"

This reverts commit d0f5ec1114.

Revert "Bug 1991489: During fragmentation of abspos frames, reuse anchor pos references populated during unfragmented reflow. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio,TYLin"

This reverts commit 4e522e9695.

Revert "Bug 1991489: nsIFrame::ComputeSize uses anchor resolution cache. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio"

This reverts commit 4ec2727999.
2026-02-09 19:20:27 +00:00
David Shin 481e451d10 Bug 1991489: Ensure that when checking for anchor visibility, the intersection root rect takes union of all of its in-flow rects. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D281720
2026-02-09 18:15:46 +00:00
David Shin d0f5ec1114 Bug 1991489: Ensure that fragmented anchors are combined when checking for overflow. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D281719
2026-02-09 18:15:43 +00:00
David Shin 4e522e9695 Bug 1991489: During fragmentation of abspos frames, reuse anchor pos references populated during unfragmented reflow. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio,TYLin
This will cause an issue for evaluating fallbacks changing default anchors, but
that is something we can easily detect and handle down the line.

Differential Revision: https://phabricator.services.mozilla.com/D281718
2026-02-09 18:15:40 +00:00
Emilio Cobos Álvarez 93dfeeec2f Bug 2013011 - Check implicit anchor validity. r=layout-anchor-positioning-reviewers,layout-reviewers,dshin
The invoker can be anywhere in the dom, have to confirm that it's an
acceptable anchor. I _think_ pseudo elements should always pass this
check but worth doing regardless.

This also fixes bug 2013896, while at it, gotta add a test for that, if
this doesn't cause any progression.

Differential Revision: https://phabricator.services.mozilla.com/D282173
2026-02-06 17:12:50 +00:00
Emilio Cobos Álvarez 30b7a3d89a Bug 2014922 - Untangle pseudo-element and anon box definitions. r=firefox-style-system-reviewers,xpcom-reviewers,layout-reviewers,dshin,nika
I looked at this because in bug 2014331 I need to mark more pseudos as
element-backed, and it's kinda silly the state our setup is in right
now.

This is all a somewhat historical mess, because in the old style system
pseudo-elements were just atoms, and we had that different types of atom
setup. The source of truth for these right now lives in a header macro
file, which isn't very flexible.

But now we have PseudoStyleType which represents both pseudos and anon
boxes, and is similar to the rust side PseudoElement enum.

Plus, the ::-moz-tree pseudo-elements are defined as anon boxes which
doesn't make any sense, so move them to pseudo-elements while at it.

Unify this in a similar way we treat CSS properties: Source of truth is
in pseudo_elements.toml / anon_boxes.toml, and we generate Rust and C++
as needed. This allows removing the nsStaticAtom subclass thing from
XPCOM, too.

This avoids some nasty duplication around which pseudos are pref-gated
and what not as well.

Differential Revision: https://phabricator.services.mozilla.com/D282076
2026-02-06 07:39:54 +00:00
Norisz Fay 27f4694604 Revert "Bug 2014922 - Untangle pseudo-element and anon box definitions. r=firefox-style-system-reviewers,xpcom-reviewers,layout-reviewers,dshin,nika" for causing bustage @ ElementAnimationData.h
This reverts commit c70290c619.
2026-02-06 05:34:42 +00:00
Emilio Cobos Álvarez c70290c619 Bug 2014922 - Untangle pseudo-element and anon box definitions. r=firefox-style-system-reviewers,xpcom-reviewers,layout-reviewers,dshin,nika
I looked at this because in bug 2014331 I need to mark more pseudos as
element-backed, and it's kinda silly the state our setup is in right
now.

This is all a somewhat historical mess, because in the old style system
pseudo-elements were just atoms, and we had that different types of atom
setup. The source of truth for these right now lives in a header macro
file, which isn't very flexible.

But now we have PseudoStyleType which represents both pseudos and anon
boxes, and is similar to the rust side PseudoElement enum.

Plus, the ::-moz-tree pseudo-elements are defined as anon boxes which
doesn't make any sense, so move them to pseudo-elements while at it.

Unify this in a similar way we treat CSS properties: Source of truth is
in pseudo_elements.toml / anon_boxes.toml, and we generate Rust and C++
as needed. This allows removing the nsStaticAtom subclass thing from
XPCOM, too.

This avoids some nasty duplication around which pseudos are pref-gated
and what not as well.

Differential Revision: https://phabricator.services.mozilla.com/D282076
2026-02-06 03:42:45 +00:00
Emilio Cobos Álvarez d8d99ed7ae Bug 2003232 - Expose anchor lookup to DevTools. r=nchevobbe,layout-anchor-positioning-reviewers,devtools-reviewers,layout-reviewers,dshin
To be confirmed by DevTools that these are the semantics they want.

Differential Revision: https://phabricator.services.mozilla.com/D281416
2026-02-04 11:59:30 +00:00
Jari Jalkanen 0cdf86cf18 Bug 2006964: Fix test for :host pseudo elements. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,dshin
Differential Revision: https://phabricator.services.mozilla.com/D278931
2026-01-22 11:47:19 +00:00
Jari Jalkanen 8dc3f61029 Bug 2006964: Fix test for :host anchor scopes. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D278930
2026-01-22 11:47:16 +00:00
Jari Jalkanen 0cdedf0905 Bug 2006964: Augment AnchorScopes with tree scopes. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,dshin
Differential Revision: https://phabricator.services.mozilla.com/D278928
2026-01-22 11:47:14 +00:00
Jari Jalkanen c9ad32c9ac Bug 2006964: Introduce logic to match tree-scoped references and names of anchors. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D278927
2026-01-22 11:47:11 +00:00
Jari Jalkanen 600874b03d Bug 2006964: Switch ResolutionMap to use scoped atom as hash key. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D278926
2026-01-22 11:47:08 +00:00
Jari Jalkanen 2136bb1d67 Bug 2006964: Use tree-scoped anchor names in Gecko code. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,dshin
Differential Revision: https://phabricator.services.mozilla.com/D278925
2026-01-22 11:47:05 +00:00
Jari Jalkanen c7fc0f51be Bug 2006964: Augment AnchorFunctions with tree scope. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D278924
2026-01-22 11:47:02 +00:00
Jari Jalkanen 4a8c40d1d0 Bug 2006964: Augment PositionAnchors with tree scope. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D278923
2026-01-22 11:47:00 +00:00