Commit Graph
121 Commits
Author SHA1 Message Date
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 5a54da0bd9 Bug 2029322 - Move PseudoStyleType to ComputedValuesInner. r=jwatt
As an incremental step towards removing the inner / outer distinction.

Now that we have it available in rust, this is trivial, and also shrinks
ComputedStyle objects, so win-win.

Differential Revision: https://phabricator.services.mozilla.com/D292061
2026-04-06 13:26:46 +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 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
Jan-Niklas Jaeschke db71b4860a Bug 2011818 - CSS Highlight API: Cache computedStyle of functional pseudo elements. r=emilio,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D280081
2026-01-29 10:35:35 +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
agoloman f194e440fb Revert "Bug 2006964: Fix test for :host pseudo elements. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,dshin" for causing wpt failures @anchor-scope.html.
This reverts commit 03c0249d4e.

Revert "Bug 2006964: Fix test for :host anchor scopes. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio"

This reverts commit 8f2b951776.

Revert "Bug 2006964: Augment AnchorScopes with tree scopes. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,dshin"

This reverts commit 001b1a4c23.

Revert "Bug 2006964: Introduce logic to match tree-scoped references and names of anchors. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio"

This reverts commit 40d8475186.

Revert "Bug 2006964: Switch ResolutionMap to use scoped atom as hash key. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio"

This reverts commit 8ccd0275d0.

Revert "Bug 2006964: Use tree-scoped anchor names in Gecko code. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,dshin"

This reverts commit 6c2e9d558b.

Revert "Bug 2006964: Augment AnchorFunctions with tree scope. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio"

This reverts commit db32e12aa8.

Revert "Bug 2006964: Augment PositionAnchors with tree scope. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio"

This reverts commit b57c7e63b2.

Revert "Bug 2006964: Augment AnchorNames with tree scope. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,emilio,dshin"

This reverts commit 13144de3e9.

Revert "Bug 2006964: Add default factory method to generated StyleCascadeLevel. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,emilio"

This reverts commit e5d2a17140.

Revert "Bug 2006964: Add TreeScoped type to attach CascadeLevel to AnchorNames. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,emilio"

This reverts commit 71138d7866.
2026-01-21 18:51:25 +00:00
Jari Jalkanen b57c7e63b2 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-21 15:41:41 +00:00
David Shin 88a366abf7 Bug 2006002: Ensure that positioned elements with implicit anchors get scroll compensated. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D276884
2025-12-18 04:31:24 +00:00
Cristina Horotan 330ab66d10 Revert "Bug 2006002: Ensure that positioned elements with implicit anchors get scroll compensated. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio" for causing bc failures on browser_retainedResultsOnFocus.js
This reverts commit 7b0c7c8034.
2025-12-17 23:50:55 +00:00
David Shin 7b0c7c8034 Bug 2006002: Ensure that positioned elements with implicit anchors get scroll compensated. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D276884
2025-12-17 21:05:44 +00:00
Keith Cirkel 1c5f80bd63 Bug 1909339 - Implement anchor-center for alignment properties when anchored r=layout-reviewers,emilio,firefox-style-system-reviewers,dshin
This implements `anchor-center` alignment for abpos elements when they
have an Anchor.

Differential Revision: https://phabricator.services.mozilla.com/D273655
2025-12-04 01:26:11 +00:00
Atila Butkovits c139426e28 Revert "Bug 1909339 - Implement anchor-center for alignment properties when anchored r=layout-reviewers,emilio,firefox-style-system-reviewers,dshin" for causing bustages at ReflowInput.cpp
This reverts commit 461b86ef9b.
2025-12-03 20:43:51 +00:00
Keith Cirkel 461b86ef9b Bug 1909339 - Implement anchor-center for alignment properties when anchored r=layout-reviewers,emilio,firefox-style-system-reviewers,dshin
This implements `anchor-center` alignment for abpos elements when they
have an Anchor.

Differential Revision: https://phabricator.services.mozilla.com/D273655
2025-12-03 19:09:27 +00:00
Jari Jalkanen 66835a87f5 Bug 1924210 - Implement basic support for implicit anchors. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,dshin
This patch deals with anchor function and basic fully styleable pseudo element support.
Popovers, position-areas and place-selfs are not yet handled.

Differential Revision: https://phabricator.services.mozilla.com/D266360
2025-10-13 12:35:08 +00:00
Eitan Isaacson e31a35d4ea Bug 1987945 - P3: Support details relation in anchored targets in remote accessibles. r=Jamie,layout-anchor-positioning-reviewers,layout-reviewers,emilio,firefox-style-system-reviewers
The change notification here is a bit stilted.. we need an explicit
notification when removing targets or anchors immediately before reflow
so we can collect associated frames and update the relations on their
associated accessibles.

When anchors/targets are added, we need to wait till after reflow in
order to get the frames that are resolved.

Differential Revision: https://phabricator.services.mozilla.com/D264637
2025-09-30 18:39:22 +00:00
Atila Butkovits f3296f6e3d Revert "Bug 1987945: apply code formatting via Lando" for causing bustages at DocAccessible.cpp.
This reverts commit 0a7b2d917f.

Revert "Bug 1987945 - P3: Support details relation in anchored targets in remote accessibles. r=Jamie,layout-anchor-positioning-reviewers,layout-reviewers,emilio,firefox-style-system-reviewers"

This reverts commit e6ae7218f8.

Revert "Bug 1987945 - P2: Cache relations using multiple attributes for same relation type. r=Jamie"

This reverts commit 77defe6ce4.

Revert "Bug 1987945 - P1: Implement details relationship for CSS anchored local accessibles. r=Jamie,emilio"

This reverts commit cd9f4b716c.
2025-09-29 23:50:24 +00:00
Eitan Isaacson e6ae7218f8 Bug 1987945 - P3: Support details relation in anchored targets in remote accessibles. r=Jamie,layout-anchor-positioning-reviewers,layout-reviewers,emilio,firefox-style-system-reviewers
The change notification here is a bit stilted.. we need an explicit
notification when removing targets or anchors immediately before reflow
so we can collect associated frames and update the relations on their
associated accessibles.

When anchors/targets are added, we need to wait till after reflow in
order to get the frames that are resolved.

Differential Revision: https://phabricator.services.mozilla.com/D264637
2025-09-29 22:42:23 +00:00
Jonathan Watt 701a0c571a Bug 1924086. Implement position-area property. r=dshin,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D259995
2025-09-26 11:08:00 +00:00
Cristina Horotan 97cd4f204b Revert "Bug 1924086. Adjust WPT expectations for position-area support. r=dshin,layout-reviewers" for causing Wr failures on position-visibility-anchors-visible-non-intervening-container.html
This reverts commit 0100e484f4.

Revert "Bug 1924086. Implement position-area property. r=dshin,firefox-style-system-reviewers"

This reverts commit 9df5d80809.
2025-09-26 06:41:44 +00:00
Jonathan Watt 9df5d80809 Bug 1924086. Implement position-area property. r=dshin,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D259995
2025-09-26 03:09:22 +00:00
Timothy Nikkel 1db2d60df2 Bug 1983382. Fix ComputedStyle::HasAnchorPosReference. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D261324
2025-08-20 10:39:43 +00:00
Markus Stange 558c11e1b0 Bug 1982380 - Change nsStyleStructList.h and nsCSSVisitedDependentPropList.h to use higher-order macros. r=emilio,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D260695
2025-08-11 22:12:07 +00:00
David Shin e184d349a4 Bug 1976571: Add a function to check if the computed style refers to any anchor. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256714
2025-07-14 16:50:14 +00:00
Emilio Cobos Álvarez a8a2311474 Bug 1976457 - Sort includes in layout/. r=janv,dshin
Interesting bit is layout/.clang-format, the rest is all automated.

Differential Revision: https://phabricator.services.mozilla.com/D256616
2025-07-09 13:24:00 +00:00
Sylvestre Ledru 8ae54ea4f9 Bug 1519636 - Reformat recent changes to the Google coding style r=geckoview-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,nalexander,gstoll,tcampbell,janv,julienw
Updated with clang-format version 19.1.7 (taskcluster-DYvBxDZJRVqTi8E7pTSJAQ)

Differential Revision: https://phabricator.services.mozilla.com/D249880
2025-05-17 19:11:13 +00:00
Emilio Cobos Álvarez 62051db67e Bug 1874093 - Pass old style rather than specific structs to CalcDifference. r=TYLin
No behavior change (maybe a bit cheaper in the "no style changed" case).

Differential Revision: https://phabricator.services.mozilla.com/D198605
2024-01-16 09:27:26 +00:00
Markus Stange 48895feea5 Bug 1853720 - Add a "hot" variant of AUTO_PROFILER_LABEL, for lower overhead when the profiler is disabled. r=aabh,profiler-reviewers
The overhead is showing up in Speedometer 3, especially in the innerHTML setter
when it calls into the frame constructor.

Full breakdown of callers across sp3 is here: https://share.firefox.dev/3rfckTG

Time spent in AutoProfilerLabel during TodoMVC-jQuery innerHTML:
Before: https://share.firefox.dev/3Znlydp 378 sampes
After: https://share.firefox.dev/45VdVgr 71 samples

Differential Revision: https://phabricator.services.mozilla.com/D188487
2023-09-25 19:36:41 +00:00
Tiaan Louw aff0f1c4d5 Bug 1817641 - Convert RGBA to AbsoluteColor for computed/animated/resolved CSS colors r=emilio
Computed color values will not be in the correct format, closer to the
one specified by the author.  This also means that colors accross the
code are stored now as AbsoluteColor or StyleAbsoluteColor.  This allows
color space/gamut information to be available for use.

Some animation related test failures had to be changed, because colors
now has greater precision.  Animated a color now causes a lot more
animation updates, which was not initially expected.  See the bug for
discussion.

Differential Revision: https://phabricator.services.mozilla.com/D171021
2023-03-07 11:28:15 +00:00
Emilio Cobos Álvarez 8f36a9e74c Bug 1815552 - Make positioned table parts deal correctly with switching position without being reframed. r=TYLin,layout-reviewers
While looking at the backout, I noticed table parts relied on reframing
on abspos-container-ness changes in a subtle way, see the test, which
fails with the first patch of this bug applied without these changes.

Make the NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN mean the same for table parts
as for everything else. Instead, keep the registration status on each
relevant frame class individually.

Depends on D169127

Differential Revision: https://phabricator.services.mozilla.com/D170969
2023-03-01 19:04:17 +00:00
Cristina Horotan 76f1a8332c Backed out 2 changesets (bug 1815552) for causing Bp-hybrid bustages at ComputedStyle.h on a CLOSED TREE
Backed out changeset da0f9295df91 (bug 1815552)
Backed out changeset cda1ee891058 (bug 1815552)
2023-03-01 16:05:19 +02:00
Emilio Cobos Álvarez 1190d4ca51 Bug 1815552 - Make positioned table parts deal correctly with switching position without being reframed. r=TYLin,layout-reviewers
While looking at the backout, I noticed table parts relied on reframing
on abspos-container-ness changes in a subtle way, see the test, which
fails with the first patch of this bug applied without these changes.

Make the NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN mean the same for table parts
as for everything else. Instead, keep the registration status on each
relevant frame class individually.

Depends on D169127

Differential Revision: https://phabricator.services.mozilla.com/D170969
2023-03-01 10:36:54 +00:00
Emilio Cobos Álvarez 1c58e2a928 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Emilio Cobos Álvarez 490d760c61 Bug 1772690 - Add a debug-only ComputedStyle::DumpMatchedRules(). r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D148336
2022-06-05 21:21:10 +00:00
Andi-Bogdan Postelnicu f4dd222589 Bug 1519636 - Initial reformat of C/C++ code with clang-format version 12.0.0. r=sylvestre
clang-format version 12.0.0 (taskcluster-KEgO7qdgQ8uaewA6NkRnRA)

Differential Revision: https://phabricator.services.mozilla.com/D114211
2021-05-10 07:15:07 +00:00
Emily McDonough 7fd4922e74 Bug 1647845 Part 2 - Add page-size attribute to nsStyleStruct and property parsing r=emilio
This parsing is hidden behind the pref layout.css.page-size.enabled.

It isn't ideal that we parse this as a property, but we can't treat it as a
descriptor because of compatibility issues with other browsers. There are also
outstanding spec issues related to how descriptors like page-size are cascaded,
and whether the !important specifier is valid or not.

Differential Revision: https://phabricator.services.mozilla.com/D103958
2021-03-22 19:08:59 +00:00
Butkovits Atila ba6527aabd Backed out 2 changesets (bug 1647845) for causing build bustages. CLOSED TREE
Backed out changeset 8822a2e578f2 (bug 1647845)
Backed out changeset 5a44095128e0 (bug 1647845)
2021-03-19 01:07:18 +02:00
Emily McDonough 5bc962d9c9 Bug 1647845 Part 2 - Add page-size attribute to nsStyleStruct and property parsing r=emilio
This parsing is hidden behind the pref layout.css.page-size.enabled.

It isn't ideal that we parse this as a property, but we can't treat it as a
descriptor because of compatibility issues with other browsers. There are also
outstanding spec issues related to how descriptors like page-size are cascaded,
and whether the !important specifier is valid or not.

Differential Revision: https://phabricator.services.mozilla.com/D103958
2021-03-18 22:26:24 +00:00
Noemi Erli ea28e04d31 Backed out 2 changesets (bug 1647845) for causing assertions in nsStyleStruct.cpp CLOSED TREE
Backed out changeset 1564d93002de (bug 1647845)
Backed out changeset bc1815fb4405 (bug 1647845)
2021-03-16 23:01:50 +02:00
Emily McDonough 57a5367422 Bug 1647845 Part 2 - Add page-size attribute to nsStyleStruct and property parsing r=emilio
This parsing is hidden behind the pref layout.css.page-size.enabled.

It isn't ideal that we parse this as a property, but we can't treat it as a
descriptor because of compatibility issues with other browsers. There are also
outstanding spec issues related to how descriptors like page-size are cascaded,
and whether the !important specifier is valid or not.

Differential Revision: https://phabricator.services.mozilla.com/D103958
2021-03-16 19:54:27 +00:00
Gerald Squelart f25e1c0093 Bug 1691589 - Reduce reliance on GeckoProfiler.h when only labels (and maybe markers) are needed - r=necko-reviewers,geckoview-reviewers,sg,agi,florian
There are no code changes, only #include changes.
It was a fairly mechanical process: Search for all "AUTO_PROFILER_LABEL", and in each file, if only labels are used, convert "GeckoProfiler.h" into "ProfilerLabels.h" (or just add that last one where needed).
In some files, there were also some marker calls but no other profiler-related calls, in these cases "GeckoProfiler.h" was replaced with both "ProfilerLabels.h" and "ProfilerMarkers.h", which still helps in reducing the use of the all-encompassing "GeckoProfiler.h".

Differential Revision: https://phabricator.services.mozilla.com/D104588
2021-02-16 04:44:19 +00:00
Emilio Cobos Álvarez 244c6053a9 Bug 1691256 - Don't reflow for background/border changes on xul appearance values. r=jfkthame
This is an optimization, but also papers about XUL widgets not dealing
particularly well with it.

Differential Revision: https://phabricator.services.mozilla.com/D105169
2021-02-15 13:19:32 +00:00
Cameron McCormack 191a43d3fb Bug 1620467 - Part 1: Remove appearance use counters. r=emilio
They have served their purpose.

Differential Revision: https://phabricator.services.mozilla.com/D83427
2020-07-16 22:03:54 +00:00
Emilio Cobos Álvarez f3abda396c Bug 1645773 - Make sure to reflow when author specified borders / backgrounds are changed if we're themed. r=jfkthame
As author-specified-background/border changes can change the effective
border and padding of form controls.

Differential Revision: https://phabricator.services.mozilla.com/D82689
2020-07-08 15:13:27 +00:00
Emilio Cobos Álvarez 184c3f80fc Bug 1256980 - Make z-index only apply to positioned and grid / flex item frames. r=miko,hiro
Differential Revision: https://phabricator.services.mozilla.com/D81557
2020-06-30 22:51:12 +00:00
Cameron McCormack 0a60c9e375 Bug 1642261 - Part 2: Add telemetry for -moz-appearance usage. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D77637
2020-06-05 00:39:50 +00:00