Commit Graph
1008 Commits
Author SHA1 Message Date
Ting-Yu Lin 1b99f231da Bug 2041516 Part 1 - Assert fresh reflow status at the beginning of AbsoluteContainingBlock::Reflow(). r=layout-reviewers,emilio
This patch enforces the invariant for `AbsoluteContainingBlock::Reflow()` that
most of the `Reflow()` functions already have.

Differential Revision: https://phabricator.services.mozilla.com/D302429
2026-05-26 19:07:08 +00:00
Hiroyuki Ikezoe 8851ed32ff Bug 1950303 - Apply contain:layout overflow handling to absolutely positioned children in AbsoluteContainingBlock::ReflowAbsoluteFrame. r=layout-reviewers,emilio
When a containing block has `contain: layout`, scrollable overflow from its
children should not propagate to the parent. nsContainerFrame::ConsiderChildOverflow
already implements this by only unioning the child's ink overflow, but
AbsoluteContainingBlock::ReflowAbsoluteFrame took a separate code path that
unconditionally unioned the child's full overflow areas. As a result, a wide
absolutely positioned descendant of a `contain: layout` element could still
inflate the page's scrollable area (and the mobile viewport).

Extend OverflowAreaUnionFlags with ChildIsAbsPos so that ConsiderChildOverflow
performs OverflowAreas::UnionWithAbsoluteOverflowAreas (matching the prior
abspos behavior), and route ReflowAbsoluteFrame through ConsiderChildOverflow.
The contain:layout handling is then shared between in-flow and absolutely
positioned children.

Differential Revision: https://phabricator.services.mozilla.com/D299911
2026-05-12 04:18:08 +00:00
Hiroyuki Ikezoe b42414c3c0 Bug 1950303 - Convert nsContainerFrame::ConsiderChildOverflow's bool parameter to OverflowAreaUnionFlags enum. r=layout-reviewers,emilio
This is a preparatory refactor for a follow-up commit that introduces a new
flag (for absolutely positioned children). Using a bit-flag enum makes call
sites self-documenting and lets us add more orthogonal options without
expanding the parameter list.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D299915
2026-05-12 04:18:04 +00:00
Eugeniusz Lewandowski fc8097fcc3 Bug 1650944 - Remove ReflowInput.h include from nsIFrame.h r=firefox-style-system-reviewers,layout-reviewers,emilio
Removed the Reflow Input in nsIFrame. Added includes for ReflowInput as
necessary in cpp files. Also Forward Declared nsLineLayout in 3 header
files.

Differential Revision: https://phabricator.services.mozilla.com/D298203
2026-05-04 12:06:23 +00:00
Josh Aas 41a61b7db8 Bug 1701109 - Store SizeConstraints in desktop pixels instead of device pixels. r=spohl,win-reviewers,layout-reviewers,emilio,mac-reviewers,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D295736
2026-05-03 05:22:35 +00:00
Eugeniusz Lewandowski 6a11c5d881 Bug 2036580 - Move BreakType definition out of ReflowInput class r=dholbert,layout-reviewers
Moved ReflowInput::BreakType enumuration outside ReflowInput class to mozilla::BreakType, and refactored the functions using it to reflect the change.

Differential Revision: https://phabricator.services.mozilla.com/D298034
2026-05-03 02:16:53 +00:00
Cristian Tuns 053f4fb7a1 Revert "Bug 1701109 - Store SizeConstraints in desktop pixels instead of device pixels. r=spohl,win-reviewers,layout-reviewers,emilio,mac-reviewers,gstoll" for causing build bustages in nsWindow.cpp
This reverts commit 77b2bbe0d9.
2026-05-02 20:53:48 +00:00
Josh Aas 77b2bbe0d9 Bug 1701109 - Store SizeConstraints in desktop pixels instead of device pixels. r=spohl,win-reviewers,layout-reviewers,emilio,mac-reviewers,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D295736
2026-05-02 19:56:09 +00:00
Emilio Cobos Álvarez fb61e154ec Bug 2034897 - Fix aspect-ratio handling in ComputeSizeWithIntrinsicDimensions. r=boris,firefox-style-system-reviewers,layout-reviewers,firefox-svg-reviewers,longsonr
Prefer aspect-ratio to the tentative BSize if we have both tentative
ISize and BSize.

Also make auto aspect-ratio handling a bit more explicit.

To prevent some regressions, we need to:

 * Fix size-containment aspect ratio for <embed> (nsSubDocumentFrame).
 * Fix RasterImage::GetIntrinsicRatio with uneven ratios.
 * Avoid SVG root from using the aspect ratio from the viewbox, see
   bug 2035918.

Differential Revision: https://phabricator.services.mozilla.com/D296982
2026-04-29 22:03:12 +00:00
Ting-Yu Lin 2f6171db5c Bug 2030432 - Fix abspos painting in wrong column when its containing block has transform. r=layout-reviewers,dshin
When a transformed absolute containing block fragments across multi-column,
abspos children could paint in the wrong column. This happened because the
abspos display item was built when its placeholder was encountered during
display list traversal, and the placeholder could end up in a different column
than where the abspos should paint.

Extend `DisplayPushedAbsoluteFrames` (now renamed to
`DisplayAbsoluteFramesNotBuiltByPlaceholder`) to also directly build abspos
frames whose placeholder lived in a different continuation subtree. Skip
building those abspos frames when they are later traversed via their
placeholders.

Differential Revision: https://phabricator.services.mozilla.com/D294312
2026-04-15 23:27:08 +00:00
agoloman 83610050c8 Revert "Bug 2030432 - Fix abspos painting in wrong column when its containing block has transform. r=layout-reviewers,dshin" for causing failures @anchor-position-multicol-fixed-001.html.
This reverts commit d7c27ff2a1.
2026-04-15 21:00:00 +00:00
Ting-Yu Lin d7c27ff2a1 Bug 2030432 - Fix abspos painting in wrong column when its containing block has transform. r=layout-reviewers,dshin
When a transformed absolute containing block fragments across multi-column,
abspos children could paint in the wrong column. This happened because the
abspos display item was built when its placeholder was encountered during
display list traversal, and the placeholder could end up in a different column
than where the abspos should paint.

Extend `DisplayPushedAbsoluteFrames` (now renamed to
`DisplayAbsoluteFramesNotBuiltByPlaceholder`) to also directly build abspos
frames whose placeholder lived in a different continuation subtree. Skip
building those abspos frames when they are later traversed via their
placeholders.

Differential Revision: https://phabricator.services.mozilla.com/D294312
2026-04-15 20:04:19 +00:00
serge-sans-paille d58c18b09a Bug 2030235 - Decouple ServoStyleConsts from nsGkAtoms.h r=emilio,necko-reviewers,geckoview-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,kershaw,m_kato
And remove unused includes of nsGkAtoms.h in the process. The few
dependencies have been moved to ServoStyleConstsInlines.h

The used command to remove the now unused dependency was:

git grep -l nsGkAtoms.h | while read line; do grep -v nsGkAtoms.h $line | grep -q -E '\<nsGkAtoms\>' || sed -i -e '/nsGkAtoms.h/d' $line  ; done

Differential Revision: https://phabricator.services.mozilla.com/D292697
2026-04-09 10:05:25 +00:00
Silaghi 81930b22ee Revert "Bug 2030235 - Decouple ServoStyleConsts from nsGkAtoms.h r=emilio,necko-reviewers,geckoview-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,kershaw,m_kato" for causing build bustages at style/nsStyleUtil
This reverts commit b97e69b590.
2026-04-09 08:09:15 +00:00
serge-sans-paille b97e69b590 Bug 2030235 - Decouple ServoStyleConsts from nsGkAtoms.h r=emilio,necko-reviewers,geckoview-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,kershaw,m_kato
And remove unused includes of nsGkAtoms.h in the process. The few
dependencies have been moved to ServoStyleConstsInlines.h

The used command to remove the now unused dependency was:

git grep -l nsGkAtoms.h | while read line; do grep -v nsGkAtoms.h $line | grep -q -E '\<nsGkAtoms\>' || sed -i -e '/nsGkAtoms.h/d' $line  ; done

Differential Revision: https://phabricator.services.mozilla.com/D292697
2026-04-09 06:41:33 +00:00
Jan-Niklas Jaeschke f3aad557f7 Bug 2028359 - CSS Highlight API: Paint highlights in image frames. r=layout-reviewers,dshin,emilio
This patch also fixes the broken WPT (the static range points to children
of an element that doesn't have child nodes and therefore is invalid).

Differential Revision: https://phabricator.services.mozilla.com/D291404
2026-04-02 12:47:33 +00:00
Emilio Cobos Álvarez eb87d1158b Bug 2011820 - appearance: {base,base-select} support via an @appearance-base rule. r=tlouw
Differential Revision: https://phabricator.services.mozilla.com/D287818
2026-03-17 17:44:30 +00:00
Serban Stanca e5d7b9992f Revert "Bug 2011820 - appearance: {base,base-select} support via an @appearance-base rule. r=tlouw" for causing wpt failures in closed-listbox-rendering.html.
This reverts commit 2b592196ab.
2026-03-17 15:26:31 +00:00
Emilio Cobos Álvarez 2b592196ab Bug 2011820 - appearance: {base,base-select} support via an @appearance-base rule. r=tlouw
Differential Revision: https://phabricator.services.mozilla.com/D287818
2026-03-17 12:11:53 +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
Serban Stanca 756241a7ce Revert "Bug 2011820 - appearance: {base,base-select} support via an @appearance-base rule. r=tlouw" for causing wpt failures in select-appearance-sizing-in-flex.html.
This reverts commit 7669d5a11e.
2026-03-17 11:49:24 +00:00
Emilio Cobos Álvarez 7669d5a11e Bug 2011820 - appearance: {base,base-select} support via an @appearance-base rule. r=tlouw
Differential Revision: https://phabricator.services.mozilla.com/D287818
2026-03-17 10:14:28 +00:00
rperta 2362c10a63 Revert "Bug 2011820 - appearance: {base,base-select} support via an @appearance-base rule. r=tlouw" for causing wr failures at closed-listbox-rendering.html
This reverts commit b957d18e90.
2026-03-17 01:32:58 +00:00
Emilio Cobos Álvarez b957d18e90 Bug 2011820 - appearance: {base,base-select} support via an @appearance-base rule. r=tlouw
Differential Revision: https://phabricator.services.mozilla.com/D287818
2026-03-16 22:41:27 +00:00
Emilio Cobos Álvarez 1e7c1504ae Bug 343048 - Get rid of ColGroup list. r=layout-reviewers,dshin
Having two lists that the frame constructor is not aware is a quirk that
causes correctness issues like bug 2021043.

Instead, sort rowgroups and colgroups once in the common case during
table layout. This also fixed some visibility collapse things because
now we compute overflow just once after collapsing. It also caused some
unexpected passes in some editing tests.

Add a test for bug 2021043, which is fixed by this.

Differential Revision: https://phabricator.services.mozilla.com/D286457
2026-03-12 09:37:21 +00:00
Emilio Cobos Álvarez 6f65f203f8 Bug 2015898 - Remove ChildListID::Fixed. r=dshin,TYLin,layout-reviewers
We already rely on one frame having at most one
absolute list, so there's no point in this distinction.

In the future, with position-visibility, we might want
to make fixed and abspos containing block effectively the same.

But one step at a time.

Differential Revision: https://phabricator.services.mozilla.com/D282681
2026-02-11 01:08:27 +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
Ting-Yu Lin 18520f8286 Bug 2014221 - Use StyleSize::FromAppUnits() to simplify code in layout/. r=layout-reviewers,firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D281640
2026-02-04 19:36:36 +00:00
Emilio Cobos Álvarez f1dea2d65d Bug 2013141 - Remove custom_consts specialness from CSS keywords. r=firefox-style-system-reviewers,layout-reviewers,dshin
Just name the things like in CSS.

Differential Revision: https://phabricator.services.mozilla.com/D281001
2026-01-30 21:12:51 +00:00
Ting-Yu Lin 9aa23feec4 Bug 2007058 Part 2 - Paint pushed abspos frames with NS_FRAME_IS_PUSHED_OUT_OF_FLOW bit in DisplayPushedAbsoluteFrames(). r=layout-reviewers,dholbert
Mark abspos next-in-flows with the `NS_FRAME_IS_PUSHED_OUT_OF_FLOW` bit, and
adjust the display item generation code accordingly.

In Bug 1994346, pushed abspos first-in-flow will get the bit as well.

Differential Revision: https://phabricator.services.mozilla.com/D277138
2025-12-19 21:05:37 +00:00
Emilio Cobos Álvarez 45879990e9 Bug 1725177 - Make ::backdrop a real generated content pseudo-element. r=layout-reviewers,firefox-style-system-reviewers,dshin
This allows animating ::backdrop and addresses long-standing animation
issues.

Differential Revision: https://phabricator.services.mozilla.com/D276755
2025-12-17 22:11:20 +00:00
Jonathan Watt 785566d985 Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275465
2025-12-11 08:10:21 +00:00
Sandor Molnar 1d99722539 Revert "Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers" for causing wpt failures
This reverts commit c8558d0a6d.
2025-12-10 21:33:17 +00:00
Jonathan Watt c8558d0a6d Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275465
2025-12-10 17:59:00 +00:00
Alexandru Marc 29419ad5e3 Revert "Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers" for causing wr failures @ position-absolute-semi-replaced-stretch-button.html
This reverts commit 437984364b.
2025-12-10 13:57:39 +00:00
Jonathan Watt 437984364b Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275465
2025-12-10 11:30:29 +00:00
Jonathan Watt a781248c8d Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275082
2025-12-10 08:24:44 +00:00
Serban Stanca b20d226403 Revert "Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers" for causing linux non-unified build bustages in nsIFrame.h.
This reverts commit 54d25f5169.
2025-12-10 01:27:42 +00:00
Jonathan Watt 54d25f5169 Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275082
2025-12-09 22:23:03 +00:00
Jonathan Watt ed620cdee7 Bug 2004161. Fix position-area default self-alignment. r=dshin,firefox-style-system-reviewers,layout-reviewers,emilio
https://drafts.csswg.org/css-anchor-position-1/#position-area-alignment

Differential Revision: https://phabricator.services.mozilla.com/D275625
2025-12-09 19:44:22 +00:00
agoloman ea8094db9f Revert "Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers" for causing wr failures @popover-alignment-002.html.
This reverts commit 70c1ed629c.

Revert "Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers"

This reverts commit ac0aa650de.
2025-12-09 09:23:53 +00:00
Jonathan Watt 70c1ed629c Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275465
2025-12-09 08:10:13 +00:00
Jonathan Watt ac0aa650de Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275082
2025-12-09 08:10:11 +00:00
Jonathan Watt 23ba459f0e Bug 2004072. Pass a SizeComputationInput to nsIFrame::ComputeSize etc instead of a gfxContext. r=dshin,layout-reviewers,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D275519
2025-12-09 06:59:12 +00:00
Masayuki Nakano 6ef3d44ec6 Bug 2003127 - Make the layout module paint normal selection when selection is styled as "attention" r=emilio,layout-reviewers
The "Find in Page" result appears as a normal selection range and the
selection's display is "attention".  And that may select characters in
unselectable elements including `::before`/`::after` pseudo elements.

At least while the selection's display is "attention", we should paint
the normal selection in any nodes.

Note that once the selection's display is set to "on", the selection
becomes invisible since the user not selectable and won't appear as
visible text when you copy the selection to the clipboard. If this is
a bad UI, we should change the behavior in a follow up bug.

Differential Revision: https://phabricator.services.mozilla.com/D274550
2025-12-03 05:00:56 +00:00
Ting-Yu Lin b5aa6faa00 Bug 2001781 - Return nullptr from GetAbsoluteContainingBlock() when a frame is not an absolute container. r=dholbert,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D273941
2025-11-25 13:02:21 +00:00
Ting-Yu Lin 80e7aa39a2 Bug 1994083 - Generate display items for frames in absolute child list. r=dholbert,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D272401
2025-11-24 20:48:15 +00:00
Ting-Yu Lin 1b8e2204f5 Bug 1994083 - Allow AbsoluteContainingBlock to reflow all abspos continuations. r=dholbert
This patch consists of several parts:

- Introduce `PushedAbsolute` frame list (i.e. `mPushedAbsoluteFrames`) in
  AbsoluteContainingBlock. This list is a temporary list used during reflow,
  to store abspos frames that need to be reflowed by the delegating frame's
  next-in-flow.

- For an absolute containing block frame, ensure its continuations also have
  absolute containing block.

- Ensure that the position of abspos continuation is correct by adjusting
  border, available block-size, etc. in
  `AbsoluteContainingBlock::ReflowAbsoluteFrame()`.

- Cache `layout.abspos.fragmentainer-aware-positioning.enabled` pref at the time
  when `nsPresContext` is initialized such that the pref value is stable across
  the lifetime of `nsPresContext`. This is to ensure the frame tree structure
  hygiene.

Differential Revision: https://phabricator.services.mozilla.com/D272400
2025-11-24 20:48:12 +00:00