While nsInlineFrame and nsFirstLetterFrame are going to continue sharing the same code, nsRubyFrame will use the refactored version to compute its intrinsic sizes.
This way we can also eliminate the need for checking the intrinsic type inside the function.
This patch shouldn't change behavior. It's just a refactoring of existing code.
Differential Revision: https://phabricator.services.mozilla.com/D109227
This patch adds the struct as a parameter to various functions.
The struct is cached in ReflowInput so that we don't need to pass it
down to the internal method where nsIFrame::ComputeSize() is called.
In the subsequent patches, we'll use it to revise the implementation of
flex container's flex base size resolution, and size overrides.
Differential Revision: https://phabricator.services.mozilla.com/D101793
This patch adds the struct as a parameter to various functions.
The struct is cached in ReflowInput so that we don't need to pass it
down to the internal method where nsIFrame::ComputeSize() is called.
In the subsequent patches, we'll use it to revise the implementation of
flex container's flex base size resolution, and size overrides.
Differential Revision: https://phabricator.services.mozilla.com/D101793
This patch adds the struct as a parameter to various functions.
The struct is cached in ReflowInput so that we don't need to pass it
down to the internal method where nsIFrame::ComputeSize() is called.
In the subsequent patches, we'll use it to revise the implementation of
flex container's flex base size resolution, and size overrides.
Differential Revision: https://phabricator.services.mozilla.com/D101793
If aspect-ratio is '<ratio>', now the aspect-ratio works with box sizing
dimensions for replaced elements.
Also, ComputeRatioDependentSize() already considers writing-mode so we don't
need the conversion like logicalRatio in the old code.
For those calculations for intrinsic size contribution, we will fix them
in a separate patch.
Differential Revision: https://phabricator.services.mozilla.com/D100175
Making them non-overflow containers is valid but then we can't just
append them to mFrames since that'll put them on the last line which
may result in some lines in-between the pulled child and its
continuation. That violates the invariant that in-flow continuations
in the same parent must be on consecutive lines (unless they are
overflow containers in which case they need to be on the
[Excess]OverflowContainers lists).
(The crash happens because if we push the lines in-between the two
continuations to the OverflowLines, then we won't find the 2nd
continuation on the first line of OverflowLines.)
(Note also that this change triggers the assertion in
DrainExcessOverflowContainersList, and depends on bug 1680406
to fix that and merge the lists.)
Differential Revision: https://phabricator.services.mozilla.com/D99560
Making them non-overflow containers is valid but then we can't just
append them to mFrames since that'll put them on the last line which
may result in some lines in-between the pulled child and its
continuation. That violates the invariant that in-flow continuations
in the same parent must be on consecutive lines (unless they are
overflow containers in which case they need to be on the
[Excess]OverflowContainers lists).
(The crash happens because if we push the lines in-between the two
continuations to the OverflowLines, then we won't find the 2nd
continuation on the first line of OverflowLines.)
(Note also that this change triggers the assertion in
DrainExcessOverflowContainersList, and depends on bug 1680406
to fix that and merge the lists.)
Differential Revision: https://phabricator.services.mozilla.com/D99560
This patch is generated via the rename functionality in my editor; add
`mozilla::` prefix to `OverflowAreas` in headers; and remove the
`OverflowType` alias added in Part 1.
Differential Revision: https://phabricator.services.mozilla.com/D97235
Similar to the optional aContainingBlockSize parameter, both border and
padding should use logical coordinates in ReflowInput::mFrame's writing
mode.
Table frames that need to override border and padding can be simplified a bit.
However, DR_init_constraints_cookie and DR_init_offsets_cookie become more
complex, but they're only for debugging. I'm not planning to update their
internal APIs.
Differential Revision: https://phabricator.services.mozilla.com/D95369
`IS_TRUE_OVERFLOW_CONTAINER` is defined in nsContainerFrame.h, but is
already used in several places in nsIFrame. It really should be an
nsIFrame's method.
Differential Revision: https://phabricator.services.mozilla.com/D92007
The three implementations of StealFrame() -- nsContainerFrame,
nsBlockFrame, and nsInlineFrame -- all have assertions to guarantee
aChild can be found, so the operation shouldn't fail.
This change shouldn't change behavior at all.
Differential Revision: https://phabricator.services.mozilla.com/D91996
This patch moves the preferred aspect-ratio calculation from each
replaced elements' GetIntrinicRatio() into GetAspectRatio(), because
they share the same logic.
For nsImageFrame, the cached mIntrinsicRatio now stores only the image's
intrinsic ratio, not considering the aspect-ratio property.
This patch fixed "object-fit:contain" for canvas, image because
GetIntrinicRatio() no longer considers aspect-ratio. This also fixed
replaced elements' size when both "aspect-ratio:<ratio>" and
"contain:size" is specified.
This also makes us pass some of the aspect-ratio tests because we change
GetIntrinicRatio() into GetAspectRatio() in
nsLayoutUtils::IntrinsicForAxis() in Part5, which is used by nsBlockFrame
(via nsLayoutUtils::IntrinsicForContainer) to implement GetMinISize().
Differential Revision: https://phabricator.services.mozilla.com/D91229
nsContainerFrame.h was only using the enum nsLayoutUtils::IntrinsicISizeType,
which this patch moves to LayoutConstants.h instead.
Depends on D91505
Differential Revision: https://phabricator.services.mozilla.com/D91506
Also combine the border and padding arguments for
nsContainerFrame::ComputeSizeWithIntrinsicDimensions(), too. This method
is used as a helper to implement ComputeSize() for various replaced
elements. Its callers are all within nsIFrame's derived classes'
overridden methods, so I'm not bothering to convert them in a separate
patch.
This change shouldn't change behavior.
Differential Revision: https://phabricator.services.mozilla.com/D90064
In the next part, I'm going to use ComputeSizeFlags as the arguments in
some ReflowInput's methods. Because nsIFrame.h includes ReflowInput.h,
to solve the circular dependency, ComputeSizeFlags needs to be moved to
somewhere else.
Also, revise the document for ComputeSizeFlag. The rest of the patch is
just dropping `nsIFrame::` and adding `mozilla::` as needed.
This change shouldn't change behavior.
Differential Revision: https://phabricator.services.mozilla.com/D89542
We already use SetProperty() extensively for nsFrameList properties like
OutsideMarkerProperty(), BackdropProperty(), etc, so we can simplify the
interface by removing SetPropTableFrames().
Differential Revision: https://phabricator.services.mozilla.com/D88459
Because the frame property look-up is expensive, change the
SetOverflowFrames(), SetOverflowContainers(), and
SetExcessOverflowContainers() to return the frame list so that the
caller don't need to use Get methods to retrieve it again.
Differential Revision: https://phabricator.services.mozilla.com/D88458
Not all APIs added in this patch are used immediately, but for the sake of
completeness, they are all added.
Their document will be updated in Part 3 after adding the relevant APIs for
ExcessOverflowContainersProperty().
nsContainerFrame::DrainExcessOverflowContainersList() has several calls to set
OverflowContainersProperty() whose life cycle need special attention. We will
deal with them later in Part 4.
Differential Revision: https://phabricator.services.mozilla.com/D88456
It's useful to use `std::move()` to indicate the frames' ownership in one list
is transferred to the another list.
For a frame list managed by AutoFrameListPtr, after moving its frames to
another list, it can be automatically deleted when it is going out of
scope.
Differential Revision: https://phabricator.services.mozilla.com/D88455
`ListChildLists` lives in nsContainerFrame because I'm going to use it
to improve nsContainerFrame::List() in a later patch.
Differential Revision: https://phabricator.services.mozilla.com/D82602
Also, rename it to GetFirstNonAnonBoxInSubtree() to reflect its
functionality more precisely that it can return the argument aFrame
itself.
Differential Revision: https://phabricator.services.mozilla.com/D81000
The modifications are all straightforward conversion except the one in
nsMathMLContainerFrame, where it is simplified by calling the equivalent
BuildDisplayListForInline() helper.
Differential Revision: https://phabricator.services.mozilla.com/D78166
This is to prevent the assertion at the beginning of
DrainExcessOverflowContainersList().
The invariant is described in the comment revised in this patch. That
is, "only one overflow containers list exists for a given frame: either
its own OverflowContainersProperty or its prev-in-flow's
ExcessOverflowContainersProperty, not both."
Differential Revision: https://phabricator.services.mozilla.com/D77328
StealOverflowFrames() and RemovePropTableFrames() use TakeProperty() to
remove the property, and transfer the ownership to the caller. Since
TakeProperty() is already marked as [[nodiscard]], so should they.
Differential Revision: https://phabricator.services.mozilla.com/D77567
This is to prevent the assertion at the beginning of
DrainExcessOverflowContainersList().
The invariant is described in the comment revised in this patch. That
is, "only one overflow containers list exists for a given frame: either
its own OverflowContainersProperty or its prev-in-flow's
ExcessOverflowContainersProperty, not both."
Differential Revision: https://phabricator.services.mozilla.com/D77328
I left all the bits that related to grid container, such as setting
aStatus, NS_STATE_GRID_DID_PUSH_ITEMS, and aState.mIter in
nsGridContainerFrame::ReflowRowsInFragmentainer().
Differential Revision: https://phabricator.services.mozilla.com/D68492
--HG--
extra : moz-landing-system : lando