514 Commits
Author SHA1 Message Date
Ting-Yu Lin 418629d11a Bug 2019415 - Consider mTreatBSizeAsIndefinite when calculating CB height in quirks mode. r=layout-reviewers,emilio
`percentage-height-quirk-excludes-flex-grid-003.html` is adapted from
`percentage-height-quirk-excludes-flex-grid-001.html`. The first subtest (column
flex container) exercises this patch. Specifically, it ensures that the
percentage height of the `.pct` element does not resolve. The second (row flex
container) and third subtest (grid) do not change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D290007
2026-03-27 01:57:38 +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
David Shin 0da9dc6432 Bug 2013429: Avoid :-moz-column-span-wrapper as alignment containing block. r=layout-reviewers,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D281285
2026-02-02 00:55:26 +00:00
David Shin 1009ef83bd Bug 2012842: Store unfragmented rects of abspos containing block during measuring reflow. r=TYLin,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D280843
2026-01-30 22:27:16 +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
David Shin b1abbd349f Bug 2006402: Remove anchor-center flags in reflowinput. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Most of the deleted code was to handle the fact that `FromUnresolved`
returned `auto` which got mapped afterwards. Now we just return zero.

Differential Revision: https://phabricator.services.mozilla.com/D276906
2025-12-18 22:52:10 +00:00
David Shin c66676ce8f Bug 2006402: Ensure that we override auto insets/margins only when there's position-area/anchor-center + valid default anchor. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Reuse the `anchor-center` check code, that checks for the validity of default
anchor, and reuse the `position-area` resolution logic, where `auto` values get
mapped to 0 at resolution time.

Differential Revision: https://phabricator.services.mozilla.com/D276905
2025-12-18 22:52:07 +00:00
agoloman 9fc44ce3cd Revert "Bug 2006402: Properly resolve auto inset/margin in nsComputedDOMStyle with anchor positioning. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,emilio" for causing build bustages @nsStyleStruct.cpp.
This reverts commit 6e861d0db3.

Revert "Bug 2006402: Use physical axes for flagging anchor-center use. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,emilio"

This reverts commit 56907edbce.

Revert "Bug 2006402: Remove anchor-center flags in reflowinput. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio"

This reverts commit 3d67a1059f.

Revert "Bug 2006402: Ensure that we override auto insets/margins only when there's position-area/anchor-center + valid default anchor. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio"

This reverts commit 8e1950452f.
2025-12-18 17:06:35 +00:00
David Shin 3d67a1059f Bug 2006402: Remove anchor-center flags in reflowinput. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Most of the deleted code was to handle the fact that `FromUnresolved`
returned `auto` which got mapped afterwards. Now we just return zero.

Differential Revision: https://phabricator.services.mozilla.com/D276906
2025-12-18 15:16:31 +00:00
David Shin 8e1950452f Bug 2006402: Ensure that we override auto insets/margins only when there's position-area/anchor-center + valid default anchor. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Reuse the `anchor-center` check code, that checks for the validity of default
anchor, and reuse the `position-area` resolution logic, where `auto` values get
mapped to 0 at resolution time.

Differential Revision: https://phabricator.services.mozilla.com/D276905
2025-12-18 15:16:28 +00:00
David Shin 8f823be747 Bug 2006398: Remove check for at least one inset in axis being auto for anchor-center use. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Spec [1] doesn't make anchor-center depend on inset values; in fact, it forces
any `auto` inset to 0.

[1]: https://drafts.csswg.org/css-anchor-position-1/#anchor-center

Differential Revision: https://phabricator.services.mozilla.com/D276694
2025-12-16 20:59:47 +00:00
David Shin ff7d3e2bca Bug 2005756: Only clear computed margin on anchor-center of a side specifying auto. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D276265
2025-12-13 01:37: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
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 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
Ting-Yu Lin ab4222ad99 Bug 1985982 - Defer auto margin computation of an abspos frame until it is reflowed. r=layout-reviewers,emilio
Remove auto margin resolution in both axes for an abspos frame in
`ReflowInput::InitAbsoluteConstraints()`. Auto margins are now resolved in
`AbsoluteContainingBlock::ResolveAutoMarginsAfterLayout()` after the frame’s
size is known.

Note: the old code in `InitAbsoluteConstraints()` makes the `autoBSize`
non-negative. This patch ports that behavior to make the `stretchFitSize`
non-negative as well, which fixes additional wpts.

Differential Revision: https://phabricator.services.mozilla.com/D275371
2025-12-09 00:28:26 +00:00
Ting-Yu Lin 298bf96b40 Bug 1985982 - Update comments in ReflowInput::InitAbsoluteConstraints(). r=layout-reviewers,emilio
Delete legacy XXX comments. It is true that we always compute the inline-size in
`nsIFrame::ComputeSize()`. However, we compute the offsets in the containing
block's writing mode. In orthogonal flow, the inline-size in containing block's
writing mode is the block-size of `mFrame`, which might still be unconstrained.

Note: changing `iSizeIsAuto` to `computedSize.ISize(cbwm)` could introduce test
failures in
`testing/web-platform/tests/css/css-position/position-absolute-table-001.html`,
because the table wrapper always has `auto` width/height, but
`nsTableWrapperFrame::ComputeAutoSize()` can resolve a definite width/height,
which acts as min-width/min-height. So the offsets are only correct when we
resolve them after reflowing the table.

Differential Revision: https://phabricator.services.mozilla.com/D275369
2025-12-09 00:28:21 +00:00
David Shin 67791fd91e Bug 2004040: Improve handling of orthogonal anchor-center alignment r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D275135
2025-12-09 00:27:28 +00:00
Cristina Horotan 23038681a7 Revert "Bug 2004040: Properly nudge overflowing abspos elements into IMCB. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio" for causing wpt failures on align-self-default-overflow-htb-ltr-htb.html
This reverts commit e338585458.

Revert "Bug 2004040: Improve handling of orthogonal anchor-center alignment r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio"

This reverts commit 275da674fe.
2025-12-08 05:54:15 +00:00
David Shin 275da674fe Bug 2004040: Improve handling of orthogonal anchor-center alignment r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D275135
2025-12-07 19:07:59 +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
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
Cristina Horotan 8317428fcd Revert "Bug 1994083 - Add WPTs for abspos fragmentation in vertical-rl writing-mode. r=dholbert" for causing Wr failures nsFrameList::ContinueRemoveFrame related
This reverts commit 0bb89a9e15.

Revert "Bug 1994083 - Adjust existing WPT expectations. r=dholbert"

This reverts commit a716c30e8f.

Revert "Bug 1994083 - Generate display items for frames in absolute child list. r=dholbert,layout-reviewers"

This reverts commit 1da35cc35d.

Revert "Bug 1994083 - Allow AbsoluteContainingBlock to reflow all abspos continuations. r=dholbert,layout-reviewers"

This reverts commit 643eec9921.
2025-11-23 05:31:49 +00:00
Ting-Yu Lin 643eec9921 Bug 1994083 - Allow AbsoluteContainingBlock to reflow all abspos continuations. r=dholbert,layout-reviewers
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()`.

- The change in `nsPresContext` is to force reconstruct frame tree when flipping
  `layout.abspos.fragmentainer-aware-positioning.enabled` pref, to ensure frame
  tree structure hygiene.

Differential Revision: https://phabricator.services.mozilla.com/D272400
2025-11-22 23:34:15 +00:00
Daniel Holbert 139b833802 Bug 1989365: Treat 'height:stretch' (and aliases) as able to resolve against quirks-mode body height. r=TYLin,layout-reviewers
This patch lets 'stretch' block-sizes get opted in so they can resolve against
the result of `CalcQuirkContainingBlockHeight()`.  That's where we handle the
"html element fills the viewport" and "body element fills the html element"
quirks-mode behaviors explained here:
https://quirks.spec.whatwg.org/#the-html-element-fills-the-viewport-quirk
https://quirks.spec.whatwg.org/#the-body-element-fills-the-html-element-quirk

This makes us match the behavior that other browsers have been shipping (with
'stretch' in Chrome as well as its '-webkit-fill-available' alias in Chrome and
Safari), and we're aware of at least one site that depends on this behavior
(tracked in bug 1886566).

Differential Revision: https://phabricator.services.mozilla.com/D273323
2025-11-20 06:12:28 +00:00
Daniel Holbert fe94eb63d2 Bug 1989368: Handle 'stretch'-like sizes in ReflowInput::InitConstraints. r=layout-reviewers,emilio
This is needed for certain cases with table layout that happen to bypass our
codepaths that would otherwise resolve 'stretch' closer to the point-of-use.
So, this patch makes us resolve 'stretch' a bit more eagerly here.

I'm including a testcase (expanded from the testcase in the bug report)
that has 'stretch' applied to various table parts, to give us code-coverage
for these scenarioos.

The correctness checks in the testcase are kinda trivial (and would generally
pass whether or not the 'stertch' keyword is supported), since table layout
already forces table-parts to stretch, generally.  So, the point of the test is
mostly to give us some basic code coverage to ensure that we behave reasonably
when this keyword (and its aliases like -webkit-fill-available) are used in
this context.

Differential Revision: https://phabricator.services.mozilla.com/D272732
2025-11-19 18:00:58 +00:00
Ting-Yu Lin 310a282894 Bug 2000488 - Remove AxisPolarityFlipped() in ReflowInput.cpp. r=layout-reviewers,jfkthame
`AxisPolarityFlipped()` returns the negation of
`WritingMode::ParallelAxisStartsOnSameSide()`. It is sufficient to keep one
implementation in `WritingMode` and port the shortcut in
`ParallelAxisStartsOnSameSide()`.

Differential Revision: https://phabricator.services.mozilla.com/D272826
2025-11-19 05:23:17 +00:00
Daniel Holbert 41d71b9a98 Bug 1990034: Properly handle 'stretch'-like block-size values in nsIFrame::ComputeISizeValue and several functions that end up indirectly calling it. r=layout-reviewers,TYLin
We need to do this in order to avoid hitting nsIFrame::ComputeISizeValue's call
to 'AsLengthPercentage()' with 'stretch' (which is not a LengthPercentage);
that triggers an abort right now.

The new code in nsIFrame::ComputeISizeValue is the proximal band-aid here, but
that isn't sufficient for correctness, because it relies on knowing the
computed margin, border, and padding; and we might not yet have the correct
values stashed on the frame, as mentioned in a code-comment in this patch.  We
do have the resolved margin/border/padding available up the stack in the
callsite in ReflowInput.cpp, though (the callsite in this bug's backtrace) --
so this patch eagerly resolves 'stretch' at that point, so that
nsIFrame::ComputeISizeValue doesn't need to bother handling it.

This patch also updates nsContainerFrame::ComputeSize to match the
corresponding chunk of nsIFrame::ComputeSize (just adding some code to handle
'stretch' there).  This is needed to get the correct answer on a few of the
cases in the included WPT.  (We had a code-comment noting that we should do
this, but we didn't previously have any tests where it would make a
difference. Now we do - hooray!)

Differential Revision: https://phabricator.services.mozilla.com/D272730
2025-11-16 16:34:46 +00:00
Emilio Cobos Álvarez e787eae820 Bug 1958206 - Allow subgrids to be containing blocks again. r=TYLin,layout-reviewers
Instead, ensure we end up with a reasonable containing block reflow
input for subgrid to avoid regressing the parent.

Differential Revision: https://phabricator.services.mozilla.com/D272370
2025-11-14 02:58:43 +00:00
David Shin 8e44110418 Bug 1996832: Remove unused inset param for margin computation. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D271232
2025-11-07 17:59:25 +00:00
David Shin e09242cc50 Bug 1968745: Pass short-lived cache into anchor resolution. r=jwatt
... So that we can store default anchor related data for a reflow to use for
determining if we need to compensate for scroll.

Differential Revision: https://phabricator.services.mozilla.com/D266466
2025-10-31 02:21:19 +00:00
Serban Stanca b135da1f08 Revert "Bug 1987963, Bug 1968745, Bug 1987961: Adjust WPT expectations. r=layout-anchor-positioning-reviewers,emilio" for causing wpt failures in position-try-fallbacks-003.html.
This reverts commit 30b907bc20.

This reverts commit 6a497f0487.

This reverts commit 31be694c99.

This reverts commit f61b13a337.

This reverts commit 46693ba1b8.

This reverts commit 2ed02be9e7.

This reverts commit e6479485e3.

This reverts commit e7f0af00db.
2025-10-31 00:14:47 +00:00
David Shin e6479485e3 Bug 1968745: Pass short-lived cache into anchor resolution. r=jwatt
... So that we can store default anchor related data for a reflow to use for
determining if we need to compensate for scroll.

Differential Revision: https://phabricator.services.mozilla.com/D266466
2025-10-30 23:10:09 +00:00
agoloman ed458be3ba Revert (Bug 1987963 Bug 1968745, Bug 1987961) : for causing wr failures @position-visibility-no-overflow-scroll.html.
This reverts commit 63d8614128.

Revert "Bug 1987963: Ensure that we can roll back to previous normal position when we give up on finding fallbacks. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio"

This reverts commit 0685b925e3.

Revert "Bug 1987963: Find and reflow affected positioned frames when a frame becomes/stops being a scroll container. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio"

This reverts commit 9b3130e442.

Revert "Bug 1987963: Apply default scroll offset on scroll. r=layout-reviewers,tnikkel,jwatt"

This reverts commit 878edfaa95.

Revert "Bug 1987963: Compute and cache compensating for scroll state of anchor positioned elements. r=jwatt"

This reverts commit e83f5939e3.

Revert "Bug 1968745: Keep track of default anchor and its nearest scrollers. r=layout-anchor-positioning-reviewers,layout-reviewers,jwatt,emilio"

This reverts commit f47abb0c30.

Revert "Bug 1968745: Pass short-lived cache into anchor resolution. r=jwatt"

This reverts commit 045b5b1cb3.

Revert "Bug 1987961: Stop taking scroll offset into account during anchor positioning offset resolution. r=jwatt"

This reverts commit 11ea3d17d5.
2025-10-30 17:49:12 +00:00
David Shin 045b5b1cb3 Bug 1968745: Pass short-lived cache into anchor resolution. r=jwatt
... So that we can store default anchor related data for a reflow to use for
determining if we need to compensate for scroll.

Differential Revision: https://phabricator.services.mozilla.com/D266466
2025-10-30 16:35:53 +00:00
Ting-Yu Lin a90f35c48d Bug 1996677 Part 1 - Simplify computed size calculation in ReflowInput::InitAbsoluteConstraints(). r=layout-reviewers,emilio
This patch does not change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D270248
2025-10-28 20:19:25 +00:00
Ting-Yu Lin f36ac04143 Bug 1983345 Part 9 - Remove ViewportFrame::AdjustReflowInputAsContainingBlock(). r=firefox-style-system-reviewers,layout-reviewers,emilio
`AdjustReflowInputAsContainingBlock` and
`GetContainingBlockAdjustedForScrollbars()` does the same thing, except the
former adjusts the `ReflowInput` parameter.

I assume the adjustment of `ReflowInput` is not really needed if we pass the
testcase `layout/reftests/bugs/844178.html` added in bug 844178.

Differential Revision: https://phabricator.services.mozilla.com/D268305
2025-10-13 22:04:11 +00:00
Ting-Yu Lin 1c62271c70 Bug 1983345 Part 8 - Remove viewport ReflowInput adjustment in ReflowAbsoluteFrame(). r=layout-reviewers,emilio
When calculating hypothetical position with the viewport as absolute containing
block, we can use the containing block size passing into ReflowInput instead of
getting the computed size from viewport's ReflowInput. This makes the viewport
ReflowInput adjustment unnecessary (the code just before creating the abspos
child's Reflowinput), so we can remove it.

Differential Revision: https://phabricator.services.mozilla.com/D268304
2025-10-13 22:04:08 +00:00
Ting-Yu Lin 95039bc0c5 Bug 1983345 Part 7 - Remove the redundant zero-initialization for nsHypotheticalPos. r=layout-reviewers,emilio
They are zero-initialized by default.
https://searchfox.org/firefox-main/rev/dc1c78e9c37aba6ed05a4ec47c4bfcb16f57b51d/layout/generic/ReflowInput.cpp#1235-1238

Differential Revision: https://phabricator.services.mozilla.com/D268303
2025-10-13 22:04:05 +00:00
Ting-Yu Lin d77d42c8de Bug 1983345 Part 6 - Revise the computation of containing block border-box size. r=layout-reviewers,emilio
Previously, when the block container was in reflow, we get the size from
absolute containing block's reflow input. That works in most cases (because the
two often coincide) but is conceptually wrong when they differ.

This patch computes the border-box size from the information returned from
`GetHypotheticalBoxContainer()` instead.

Differential Revision: https://phabricator.services.mozilla.com/D268302
2025-10-13 22:04:03 +00:00