We can't get text-align right during the initial table reflow because the
inline-size within which the cell content is to be aligned is not yet known
(it'll come from the block-size we compute for the parent row).
So to deal with this, we record during tableRowFrame reflow whether any
cells with orthogonal writing mode were present; and if so, at the end of
the row reflow, we make another pass over the orthogonal cells and reflow
them to properly align their content within the computed cell size.
Differential Revision: https://phabricator.services.mozilla.com/D245615
The old "orthogonal limit" in ReflowInput was a rather ad hoc mechanism created
during the early implementation of writing modes, to avoid reflowing orthogonal
flows with unconstrained inline size. The spec has since been clarified to describe
the expected behavior in more detail, and we can dispense with the orthogonal-limit
concept and instead implement the constraints called for in the spec.
With this, we pass all the css-writing-modes/available-size-* tests (as well as
fixing a couple of other testcases that are dependent on this behavior).
Differential Revision: https://phabricator.services.mozilla.com/D241117
Note that both keywords are disabled in the CSS parser for now, behind
these about:config prefs:
layout.css.stretch-size-keyword.enabled
layout.css.webkit-fill-available.enabled
Prior to this patch, we handled both keywords as pure aliases for
'-moz-available' (which has the correct 'stretch' behavior in the inline axis
but which just behaves like the initial value in the block axis).
This patch changes that so that 'stretch' and '-webkit-fill-available' will now
actually do the right thing in the block axis (if they're enabled at all, via
their aforementioned about:config prefs).
The relevant spec text here is:
https://drafts.csswg.org/css-sizing-4/#valdef-width-stretchhttps://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing
Differential Revision: https://phabricator.services.mozilla.com/D217688
And don't resolve them prematurely; the computed value should remain
logical, and only be mapped to physical sides at use time.
Differential Revision: https://phabricator.services.mozilla.com/D229998
And don't resolve them prematurely; the computed value should remain
logical, and only be mapped to physical sides at use time.
Differential Revision: https://phabricator.services.mozilla.com/D229998
We are going to use `StyleSizeOverrides` in nsLayoutUtils.h in Part 4 that
requires a full definition of `StyleSizeOverrides`. but we don't want to include
the entire ReflowInput.h in nsLayoutUtils.h that can add unnecessary header
dependency.
We could also move it into LayoutConstants.h that has been included by
nsLayoutUtils.h, but the header is a home for layout constants. Therefore, I
create a new header for layout helper classes and structs.
Differential Revision: https://phabricator.services.mozilla.com/D222049
Remove unused `nsPresContext` and `LayoutFrameType` parameters in
`InitAbsoluteConstraints()` and `CalculateHypotheticalPosition()` (except for
one usage in `NS_ASSERTION`).
Improve the documentation for `CalculateHypotheticalPosition()` and delete the
nearly the same documentation before its definition in ReflowInput.cpp.
In `InitAbsoluteConstraints()`, we don't need to initialize the `offsets` local
variable via `ComputedLogicalOffsets()` since this is the function computing the
offset, and we'll set the four sides of `offsets` later in the function.
Differential Revision: https://phabricator.services.mozilla.com/D213313
Remove unused `nsPresContext` and `LayoutFrameType` parameters in
`InitAbsoluteConstraints()` and `CalculateHypotheticalPosition()` (except for
one usage in `NS_ASSERTION`).
Improve the documentation for `CalculateHypotheticalPosition()` and delete the
nearly the same documentation before its definition in ReflowInput.cpp.
In `InitAbsoluteConstraints()`, we don't need to initialize the `offsets` local
variable via `ComputedLogicalOffsets()` since this is the function computing the
offset, and we'll set the four sides of `offsets` later in the function.
Differential Revision: https://phabricator.services.mozilla.com/D213313
This removed one is just forwarding the call to nsIFrame, and used internally
within ReflowInput.
While I'm here, rename local variables `inside*` and `outside*` to make them
clearer.
Differential Revision: https://phabricator.services.mozilla.com/D212509
The `IsReplacedWithBlock()` method is used only in
`ShouldApplyOverflowClipping()`, which determines the overflow clip axes. Since
we've already enumerated the frame types that need overflow clipping, we can
just add more types that had `ReplacedContainsBlock` flag to the switch-cases
and remove the flag.
Differential Revision: https://phabricator.services.mozilla.com/D212199
The two macros are only used in ReflowInput.cpp, which are to print margin,
border, padding, available sizes, and other computed sizes in ReflowInput. The
information can be replaced by adding local printf or via `rr` if there are
debug needs.
Note: `ReflowInput::DisplayInitFrameTypeEnter` and
`ReflowInput::DisplayInitFrameTypeExit` have been removed in
https://hg.mozilla.org/mozilla-central/rev/429a4d022ade
Differential Revision: https://phabricator.services.mozilla.com/D206314
The removed reftsts test basically the opposite, and are sufficiently
covered by the WPTs that we start passing, so just remove them.
Differential Revision: https://phabricator.services.mozilla.com/D204797
ReflowInput's computed sizes and border&padding are stored in logical
coordinates, so accessing the physical version is slower [1]. This patch
converts as many callers as possible to use logical coordinates.
This patch doesn't change behavior.
[1] For example, accessing `ComputedWidth()` and `ComputedHeight()` needs two
`IsVertical()` check, but `GetPhysicalSize()` only needs one.
Differential Revision: https://phabricator.services.mozilla.com/D200237
The bug occurs because some abspos children are split, but not being reflowed
again in the last column balancing reflow where the available block-size of the
last column might be unconstrained.
This patch makes the callers utilizing `ReflowInput::ShouldReflowAllKids()`
always reflow in the last column balancing reflow to ensure the correctness of
the layout.
Note: the `mIsInLastColumnBalancingReflow` flag is inheriting from parent to
child reflow input, but it will stop at the nested `nsColumnSetFrame` because
the nested one will create its own `ReflowConfig::mIsLastBalancingReflow` and
assign that flag when creating the reflow input for the children.
Differential Revision: https://phabricator.services.mozilla.com/D195945
A flex item's block-size may grow as a result of fragmentation. If we detect its
block-size is allowed to grow, then we use 'auto' block-size in the
`StyleSizeOverrides` when creating a ReflowInput, and treat its original
block-size as the min-size (as a lower bound).
Differential Revision: https://phabricator.services.mozilla.com/D188532
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.
This was done by going through all the frame classes, trying to preserve
behavior.
The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).
Differential Revision: https://phabricator.services.mozilla.com/D194703
This currently only includes block frames, grid containers, and flex
containers, and the document and pagination frames. It is possible more frames
will need to be added or more advanced checks in the future.
This adds some related tests to ignoring some subtrees, but are expected fails
until bug 1816570 is fixed.
Differential Revision: https://phabricator.services.mozilla.com/D169018
This currently only includes block frames, grid containers, and flex
containers, and the document and pagination frames. It is possible more frames
will need to be added or more advanced checks in the future.
This adds some related tests to ignoring some subtrees, but are expected fails
until bug 1816570 is fixed.
Differential Revision: https://phabricator.services.mozilla.com/D169018
For ToResolvedValue implementation purposes we wouldn't need to split
out the vertical / font / line-height arguments and we could just pass
around the ComputedStyle, but the lh unit would need that distinction,
(because computing lh on font properties should use the parent style).
Differential Revision: https://phabricator.services.mozilla.com/D168705
nsColumnSetFrame can reflow its last column in an unconstrained available
block-size to measure the total block-size of the content [1]. This patch adds a
helper method in ReflowInput for that.
For flex items in a fragmented context, we *cannot* skip its final reflow
because fragmentation might grow its block-size if there's any force break in
it (bug 1663079), or if it has repeated table header/footer (bug 1744363).
This patch doesn't change observable behavior for now. Before this patch, we may
skip an item's final reflow if it is in a flex container's continuation that is
in the last column with an unconstrained available block-size. As of this patch,
the item will be reflowed. This is a partial step towards fixing the above bugs
where the item's block-size may grow.
[1] https://searchfox.org/mozilla-central/rev/daf613efc5c358f3a94961d73b90472c00703838/layout/generic/nsColumnSetFrame.cpp#614-621
Differential Revision: https://phabricator.services.mozilla.com/D167207
Make it work as a min-size everywhere rather than only handling it in
nsIFrame::ComputeSize.
This is more similar to what XUL code does. In particular, it makes
makes it work for elements that don't have a definite size in
ComputeSize (like flex containers).
For web-exposed widgets this only matters for <input type=color> and
<input type=range>, which are the only exposed widgets that return a
minimum size that return a minimum size. This patch makes the minimum
size honored for `<input type="color" style="height: auto">`. Add a test
for that (though we might want to change it to match other browsers).
Without this fix, min/max/close buttons on Linux are zero-height with
flex emulation, because we fail to account for their minimum
widget-imposed size.
This allows us to remove the special case in nsFlexContainerFrame too,
since that should be handled by ReflowInput correctly now.
Differential Revision: https://phabricator.services.mozilla.com/D158612
This is a hack, sorta, similar to Chromium's:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/layout/layout_object.cc;l=356;drc=312b74e385e6aba98ab31fd911238c0dc16b396c
except at computed-value rather than used-value time, because it's both
simpler to reason about and prevents lying in the computed style.
This fixes the relevant test-case, and matches closer what Chromium does,
by not creating anonymous flex items for all elements inside the
line-clamp context.
The behavior change is covered by the test changes. I had to also fix a
couple pre-existing bugs that were caught by tests, now that the
line-clamped block is the -webkit-box-styled element rather than an anonymous
flex item (and thus now had padding).
Depends on D155180
Differential Revision: https://phabricator.services.mozilla.com/D155181