A percentage basis is needed to resolve percentage block size when computing
children's intrinsic inline size contributions. This is necessary for a child or
descendants with a preferred aspect-ratio so that the block size can transfer
through the aspect-ratio to become an intrinsic inline size.
The change in `nsFlexContainerFrame::ComputeIntrinsicISize()` is necessary to
keep us passing
`testing/web-platform/tests/css/css-flexbox/image-nested-within-definite-column-flexbox.html`.
The change in `nsPlaceholderFrame::AddFloatToIntrinsicISizeData()` is necessary
to keep us passing
`testing/web-platform/tests/css/css-sizing/intrinsic-percent-replaced-dynamic-010.html`.
`GetISizeInfo()` in BasicTableLayoutStrategy.cpp is modified to pass table cell
frame's bsize as percentage basis. Otherwise,
`layout/reftests/bugs/522632-1.html` fails. This is our current behavior, but it
is bug 1461852.
Differential Revision: https://phabricator.services.mozilla.com/D219523
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.
When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.
Differential Revision: https://phabricator.services.mozilla.com/D219521
A percentage basis is needed to resolve percentage block size when computing
children's intrinsic inline size contributions. This is necessary for a child or
descendants with a preferred aspect-ratio so that the block size can transfer
through the aspect-ratio to become an intrinsic inline size.
The change in `nsFlexContainerFrame::ComputeIntrinsicISize()` is necessary to
keep us passing
`testing/web-platform/tests/css/css-flexbox/image-nested-within-definite-column-flexbox.html`.
The change in `nsPlaceholderFrame::AddFloatToIntrinsicISizeData()` is necessary
to keep us passing
`testing/web-platform/tests/css/css-sizing/intrinsic-percent-replaced-dynamic-010.html`.
`GetISizeInfo()` in BasicTableLayoutStrategy.cpp is modified to pass table cell
frame's bsize as percentage basis. Otherwise,
`layout/reftests/bugs/522632-1.html` fails. This is our current behavior, but it
is bug 1461852.
Differential Revision: https://phabricator.services.mozilla.com/D219523
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.
When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.
Differential Revision: https://phabricator.services.mozilla.com/D219521
Most frame types have identical or very similar implementation for GetMinISize()
and GetPrefISize(), and many of them already have `IntrinsicISize()` to unify
the implementation. This patch introduces nsIFrame::IntrinsicISize() so that
derived classes only need to override one method.
`nsBlockFrame`, `ColumnSetWrapperFrame`, and `nsColumnSetFrame` are the only
three classes where their `GetMinISize()` and `GetPrefISize()` have significant
differences. Therefore, we rename `GetMinISize()` and `GetPrefISize()` to
`MinISize()` and `PrefISize`, respectively, and use them as helpers to implement
their `IntrinsicISize()`.
This patch doesn't change behavior.
Differential Revision: https://phabricator.services.mozilla.com/D217790
This patch move `WritingMode` to the second argument, for the consistency with
the design of its own APIs like `StyleRect::Start(LogicalAxis, WritingMode)`,
and logical classes such as `LogicalMargin::Side(LogicalSide, WritingMode)`.
Differential Revision: https://phabricator.services.mozilla.com/D212505
This patch stops the frame constructor from inserting nsPageBreakFrame as a flex
item, because flex container does not rely on it to do forced page break at all,
and nsPageBreakFrame can produce wrong layout result.
The majority of this patch is to honor forced break values on flex items in
nsFlexContainerFrame::ReflowChildren(). In this patch, we don't handle avoid
break values such as `break-before:avoid` and `break-after:avoid` since they are
not handled in other frame types yet.
WPTs are added in later parts.
Differential Revision: https://phabricator.services.mozilla.com/D207910
Flex container is the only frame type in layout using `childReflowStatus` when
naming the `nsReflowStatus` variable for child. Drop "Reflow" for brevity and
for the consistency with `childrenStatus` in `ReflowChildren()`.
Differential Revision: https://phabricator.services.mozilla.com/D207909
* Add `FLEX_ITEM_LOG` so that the log print starts from "Flex item". Visually,
this better groups the operations of the same flex item together than those
"for flex item" at the end of the sentence.
* Make `FLEX_LOGV` indent with two spaces, and change all the `FLEX_LOG` logs
with indentation to `FLEX_LOGV`.
Differential Revision: https://phabricator.services.mozilla.com/D206319
The two macros are used in `GetPrefISize()` and `GetMinISize()` implementations.
After removing them, we could further simplify some implementations because we
don't need a `result` variable in many cases.
This patch doesn't change behavior.
Differential Revision: https://phabricator.services.mozilla.com/D206316
LogicalAxis is one of the Logical* enums. Converting it from enum to
enum class increases type safety. To run with the pre-existing code,
type casting was added when needed. Comments have been edited where
needed.
Differential Revision: https://phabricator.services.mozilla.com/D206108
Values were static_casted where required. Some functions in WritingModes.h were
rewritten such that bitwise operations aren't being used. Added static_casts to
avoid (debug) build errors from debugging printfs in layout/tables/nsCellMap.cpp.
Differential Revision: https://phabricator.services.mozilla.com/D205510
We can pass `ComputeSizeFlag::ShrinkWrap` flag when creating the `ReflowInput`
for a flex item. It is maybe more verbose, but less of the magic flex logic
hidden in `ReflowInput`.
This patch doesn't change behavior.
Differential Revision: https://phabricator.services.mozilla.com/D196258
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
Rename itemBSize to borderBoxBSize to make it clearer because we are going to
add another variable in Part 4 capturing content block-size. Drop "item" for
brevity.
Differential Revision: https://phabricator.services.mozilla.com/D188531
This is a preparation for Part 4. We need to tell apart the children reflow
status between incomplete and overflow-incomplete.
Differential Revision: https://phabricator.services.mozilla.com/D188530
This is a preparation for Part 4 since a flex container frame needs to query a
flex item continuation's consumed block-size.
Differential Revision: https://phabricator.services.mozilla.com/D188529
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
After this patch, we'll fail four tests due to reference files written in grid
layout, and we've had bug 1609403 for grid baseline alignment.
Differential Revision: https://phabricator.services.mozilla.com/D185872
When iterating flex line and flex item in ReflowChildren(), start from the
startmost line and startmost item with respect to the flex container's
writing-mode. This is equivalent to iterate the items in visual order, which is
necessary to compute the item's position correctly, because any shift to the
startmost line or startmost item can affect later ones.
Also, change a condition in `Reflow()` to `aReflowInput.IsInFragmentedContext()`
so that the necessary data can be updated when the flex container fragment is
reflowed in the last column. Otherwise, there will be "unexpected max block
size" assertions [1] while running `layout/generic/crashtests/1666592.html`.
[1] https://searchfox.org/mozilla-central/rev/e9b8c73771d0038214c69f17c5934ba8ae049799/layout/generic/nsFloatManager.cpp#111
Differential Revision: https://phabricator.services.mozilla.com/D183193
Likewise, we should also consider first baseline in the endmost line when
computing flex container last baseline.
Fixed the XXX comment by using logical coordinates. This is necessary to pass
flex-align-baseline-flex-004.html because it tests a vertical-rl flex container.
Differential Revision: https://phabricator.services.mozilla.com/D182432
The idea behind this change is for flex items with swapped block-flow direction
to end up in swapped baseline-sharing groups on the flex container's FlexLine.
The outcome of this is that all of the baseline-aligned flex items that are
using a baseline on their left edge will be aligned together (e.g. in the
"first" group), and all of the flex items with a baseline on their right edge
will be aligned together (e.g. in the "last" group), even if they may have
varying block-flow directions (vertical-lr vs. rl) and varying `align-self`
values.
This is rooted in the idea of baseline alignment preferences being "compatible"
as defined here:
https://drafts.csswg.org/css-align-3/#compatible-baseline-alignment-preferences
This makes us start passing a bunch of WPT tests; this patch removes the
corresponding .ini files for those tests that are now passing.
Differential Revision: https://phabricator.services.mozilla.com/D181824
This patch doesn't affect behavior; it's just a refactoring to prepare for the
next patch in this series.
(As of this patch, the BaselineSharingGroup is always the same as the
'align-self' baseline selection, but the next patch will change that.)
Differential Revision: https://phabricator.services.mozilla.com/D181823
This is the spec describing flex container baselines.
https://drafts.csswg.org/css-flexbox-1/#flex-baselines
* Separate the cache for last baseline in FlexItem. This is needed beacuse we set
an item's first baseline via `SetAscent()` after reflowing it. Any query to last
baseline via `ResolvedAscent(false)` will wrongly return the first baseline.
* We used to compute flex container baseline from the first item in
ReflowChildren(). Now we consolidate all the logic computing flex container
baseline in PopulateReflowOutput().
Differential Revision: https://phabricator.services.mozilla.com/D181604
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line
Differential Revision: https://phabricator.services.mozilla.com/D173886