With the previous part, the output-param `aReflowStatus` is fresh, so we can
accumulate kid's reflow status to it directly. This matches the existing pattern
in `nsCanvasFrame::Reflow()`, `nsFlexContainerFrame::Reflow()`, etc.
Differential Revision: https://phabricator.services.mozilla.com/D302430
This patch enforces the invariant for `AbsoluteContainingBlock::Reflow()` that
most of the `Reflow()` functions already have.
Differential Revision: https://phabricator.services.mozilla.com/D302429
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
In order to compute the rect, we need to have all the inline continuations
reflowed and placed. Therefore, this patch introduces a new phase in
`nsBlockFrame::Reflow()` to reflow all the absolute descendants under inline
containing blocks, and adds the absolute descendants' overflow areas into inline
frames and lines' overflow areas.
Differential Revision: https://phabricator.services.mozilla.com/D301184
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
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
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
Both the main child list and the pushed child list may contain continuations
of an abspos element. Therefore, when moving abspos continuations from the main
child list to the pushed child list, we must preserve the order of the
continuation chain.
This patch adds debug-only logic to check the continuation order. The crashtest
in Part 1 would trigger the newly added assertion if the other fixes in this
patch were not applied.
Differential Revision: https://phabricator.services.mozilla.com/D291043
It is valid for multiple continuations of the same element to be in the pushed
child list, since they are not reflowed there and are intended to be pulled by
subsequent absCB continuations. This patch relaxes the check.
Differential Revision: https://phabricator.services.mozilla.com/D291042
Prior to Bug 1800907, abspos overflow contribution used `UnionWith`,
which ignored empty (i.e. width or height is zero) overflows. Post
Bug 1800907, the constraint was tightened so that both width and
height must be zero for any overflow to be ignored.
Differential Revision: https://phabricator.services.mozilla.com/D290147
When an absolutely positioned element in a grid uses anchor() in itsets
without position-anchor, the grid container rect is used instead of the
grid-area.
Differential Revision: https://phabricator.services.mozilla.com/D290840
This extends the measuring reflow mechanism from multicol (Bug 1994346) to
printing scenarios. When absolutely positioned elements exist, we now perform
an initial measuring reflow with an unconstrained page height to compute
unfragmented positions, sizes, etc.
Each frame type (nsPageSequenceFrame, nsPageFrame, PrintedSheetFrame,
nsPageContentFrame) has their own logic to calculate the available size for its
child, and they do not derive the size from their own reflow input's available
size. To avoid substantial refactoring, this patch checks
`mIsInFragmentainerMeasuringReflow` and overrides the available block-size to
unconstrained when running a measuring reflow.
Differential Revision: https://phabricator.services.mozilla.com/D284550
This renames the measuring reflow flag to use "fragmentainer" terminology,
making it applicable to both multicol and printing contexts. This doesn't change
behavior.
Differential Revision: https://phabricator.services.mozilla.com/D284549
This patch also prevents WPT `/css/css-page/page-margin-004-print.html` from
failing when adding a measuring reflow to printing context.
Differential Revision: https://phabricator.services.mozilla.com/D284548
In this patch, we allow a positioned element to reflow under zero available
block-size if its position is exactly at the block-end edge of the current
fragmentainer.
This prevents `block-end-aligned-abspos-nested.html` from failing by allowing
the outer zero-height `position:absolute` element to be placed at the block-end
edge of the first column.
Differential Revision: https://phabricator.services.mozilla.com/D283466
When the pref is off, this sanity check is not needed, because it is only
meaningful when the pref is enabled. Skipping it also prevents the testcase from
triggering assertions in this helper.
The next patch will address the issue when the pref is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D282941
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
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
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.
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
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
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
This patch implements the fragmentainer-aware positioning for abspos elements in
multicol. High-level changes include:
- Store abspos element's unfragmented position in
`nsIFrame::UnfragmentedPositionProperty`.
- Add a measuring reflow phase in `nsColumnSetFrame` to compute abspos element's
unfragmented position.
- Track cumulative containing block size across fragmentainer continuations.
- Adjust positioning logic with UnfragmentedPositionProperty().
A similar support for printing scenario is tracked in Bug 2009647.
Differential Revision: https://phabricator.services.mozilla.com/D276582
This reverts commit 2cead8c0d6.
Revert "Bug 1994346 - Adjust existing test expectations. r=layout-reviewers,dshin,dholbert"
This reverts commit 527178ed44.
Revert "Bug 1994346 - Push abspos first-in-flow to next absCB continuation if it doesn't fit. r=layout-reviewers,dholbert,dshin"
This reverts commit 8ccca3d28a.
This patch implements the fragmentainer-aware positioning for abspos elements in
multicol. High-level changes include:
- Store abspos element's unfragmented position in
`nsIFrame::UnfragmentedPositionProperty`.
- Add a measuring reflow phase in `nsColumnSetFrame` to compute abspos element's
unfragmented position.
- Track cumulative containing block size across fragmentainer continuations.
- Adjust positioning logic with UnfragmentedPositionProperty().
A similar support for printing scenario is tracked in Bug 2009647.
Differential Revision: https://phabricator.services.mozilla.com/D276582
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.
Previously contributed an additional overflow with normal position, which was
the positioned element's overflow when all scrollers are at their initial
positions.
Use `OverflowChangedTracker` to properly propagate overflow changes up the
ancestor chain.
Without anchor recalculation points, this change causes the scroller to
fluctuate as the positioned element moves around.
Adjust `position-visibility-no-overflow-scroll-002.html` - In this case,
due to the double rAF, positioned elements are evaluated with the scrollers
at its initial position. However, in this configuration, the computed position
area grid for `#target1` does not leave enough space to fit the element, so it
shifts up into fit within the containing block [1]. However, the test's
reference does not seem to expect this shifting behaviour. Prior to this patch,
Gecko would contribute the unscrolled overflow's space to expand the position
area grid, which made us pass this test (But this behaviour is not in spec).
So, change the test to force the computation of position-area grid to be after
scrolling, which still should preserve the purpose of the test. `anchor()`
functions could be used instead, but that's covered by
position-visibility-no-overflow-scroll.html.
[1]: https://drafts.csswg.org/css-anchor-position-1/#position-area-alignment
Co-authored-by: Emilio Cobos Álvarez <[email protected]>
Differential Revision: https://phabricator.services.mozilla.com/D278989