This patch enforces the invariant for `AbsoluteContainingBlock::Reflow()` that
most of the `Reflow()` functions already have.
Differential Revision: https://phabricator.services.mozilla.com/D302429
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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