Commit graph

747 commits

Author SHA1 Message Date
Ting-Yu Lin
e8ac85f840 Bug 1712875 - Inflate flex container's padding by using the union of flex items' normal position margin boxes. r=dholbert
Also, revise the comment based on what we are currently doing.

Differential Revision: https://phabricator.services.mozilla.com/D116025
2021-05-27 05:52:15 +00:00
Ting-Yu Lin
94aa79421f Bug 1712496 - Adjust flex container's overflow area only if there are flex items. r=dholbert
The rect `flexItemMarginBoxBounds` is initialized at position (0, 0),
not the flex container's content-box origin. Inflating its initial value
with flex container's padding is just wrong.

Differential Revision: https://phabricator.services.mozilla.com/D115854
2021-05-26 02:59:16 +00:00
Ting-Yu Lin
1f9c1bdc99 Bug 1703304 - Compute transferred size suggestion only if a flex item is a replaced element. r=dholbert
If the flex item is a non-replaced element and its min-width/min-height
is 'auto', the spec has changed so that it has no transferred size
suggestion now. https://drafts.csswg.org/css-flexbox-1/#min-size-auto

This patch also updates WPT tests to fix
https://github.com/web-platform-tests/wpt/issues/27878

Differential Revision: https://phabricator.services.mozilla.com/D112830
2021-04-30 20:49:19 +00:00
Ting-Yu Lin
6b293350a8 Bug 1706200 - Rename childrenInflowBounds to flexItemMarginBoxBounds in nsFlexContainerFrame::Reflow(). r=dholbert
Also, change the loop so that it iterates over flex items because
mFrames can contain out-of-flow placeholders which are not flex items.
This doesn't change the behavior because the out-of-flow placeholders
doesn't have any overflow areas (unless we fixed bug 1460484).

Differential Revision: https://phabricator.services.mozilla.com/D112672
2021-04-20 21:40:07 +00:00
Simon Giesecke
628cc55f22 Bug 708901 - Migrate to nsTHashSet in layout. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108597
2021-03-24 17:56:46 +00:00
Csoregi Natalia
f54ee076ae Backed out 13 changesets (bug 708901, bug 1184468) for causing build bustage on GeckoViewHistory.cpp. CLOSED TREE
Backed out changeset b1e4c01e63b8 (bug 708901)
Backed out changeset 37b52cce83c0 (bug 708901)
Backed out changeset eee75f33f060 (bug 708901)
Backed out changeset 479bf64c7986 (bug 708901)
Backed out changeset 15a8fb94d15d (bug 708901)
Backed out changeset be31ccd9a61d (bug 708901)
Backed out changeset fc54f4eaedd5 (bug 708901)
Backed out changeset 03c3a56c3d13 (bug 708901)
Backed out changeset 73f11d3c1298 (bug 708901)
Backed out changeset aed22fd80893 (bug 708901)
Backed out changeset 74d8249fbe7e (bug 708901)
Backed out changeset acb725eb3c1d (bug 1184468)
Backed out changeset 70f3ea6efec4 (bug 1184468)
2021-03-24 19:26:20 +02:00
Simon Giesecke
c73f87b72b Bug 708901 - Migrate to nsTHashSet in layout. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108597
2021-03-24 16:58:58 +00:00
Ting-Yu Lin
3699230bff Bug 1697349 - Incorporate flex item's margin and flex container's padding when computing flex container's overflow area. r=dholbert
This patch incorporates flex item's margin and flex container's padding
when computing flex container's overflow area in both the inline axis
and block axis.

overflow-top-left.html starts to fail because the test has flex items
with margin contributing to the overflow area now. We leave the test
unchanged for now until the webcompat situation is clear (Bug1698428).

flexbox-overflow-padding-002.html is based on
flexbox-overflow-padding-001.html with `writing-mode: vertical-rl` and
`direction: rtl` added to `.flexContainer`.

Differential Revision: https://phabricator.services.mozilla.com/D107936
2021-03-22 18:24:46 +00:00
Emilio Cobos Álvarez
c17b1c2e53 Bug 1695390 - Move extremum lengths to the individual Size / MaxSize types. r=boris
This will prevent growing them when introducing fit-content(<length>).

This can _almost_ be derived, if it wasn't because of the quirky stuff.
I think the macro is probably good enough for now but let me know if you
disagree.

Differential Revision: https://phabricator.services.mozilla.com/D106713
2021-03-02 12:11:35 +00:00
Brindusan Cristian
82efbb80e1 Backed out changeset be6d9849825d (bug 1695390) for wr failures in col-definite-max-size-001.html. CLOSED TREE 2021-03-02 13:41:40 +02:00
Emilio Cobos Álvarez
b5686164be Bug 1695390 - Move extremum lengths to the individual Size / MaxSize types. r=boris
This will prevent growing them when introducing fit-content(<length>).

This can _almost_ be derived, if it wasn't because of the quirky stuff.
I think the macro is probably good enough for now but let me know if you
disagree.

Differential Revision: https://phabricator.services.mozilla.com/D106713
2021-03-02 10:34:39 +00:00
Ting-Yu Lin
50cd58e505 Bug 799725 Part 2 - Use StyleSizeOverrides to stretch flex item's inline-size. r=dholbert
Also, suppress a flex item's aspect-ratio by using
StyleSizeOverrides::mAspectRatio added in Part 1. Otherwise,
testing/web-platform/tests/css/css-flexbox/flex-minimum-height-flex-items-023.html
is going to break.

table-as-item-stretch-cross-size-3 is adapted from the testcase in bug
799725 comment 1. Note: stretching in the cross axis that is a block
axis has been fixed by bug 1674302.

Differential Revision: https://phabricator.services.mozilla.com/D106195
2021-02-25 20:06:12 +00:00
Ting-Yu Lin
ed3ef63263 Bug 1692116 Part 3 - Fix table flex item's content block-size measurement by removing mIsFlexContainerMeasuringBSize flag. r=dholbert
The mIsFlexContainerMeasuringBSize flag serves two purposes:

(1) Tell ReflowInput::ComputeMinMaxValues() to treat min-block-size and
max-block-size like the initial value.

We can just set both sizes after creating the ReflowInput, like this
patch does.

(2) Add `ComputeSizeFlag::UseAutoBSize` to mComputeSizeFlags.

Similar to the reasoning in Bug 1674302 Part 2
https://hg.mozilla.org/mozilla-central/rev/23aff0f21a1d, the
UseAutoBSize flag is buggy when used on table flex items because it
never propagates to inner table frame. We can fix it by providing an
'auto' mStyleBSize in StyleSizeOverrides.

This fixed table flex item's content block-size measurement. As
described in table-as-item-specified-height.html, the specified height
on <table> now won't count as another min-height anymore.

Differential Revision: https://phabricator.services.mozilla.com/D106157
2021-02-25 20:06:11 +00:00
Ting-Yu Lin
60b5c8e185 Bug 1693409 Part 2 - Don't enforce table's min-content inline-size when resolving flex base size. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D105685
2021-02-19 22:12:19 +00:00
Ting-Yu Lin
1e1db8c9d9 Bug 1674302 Part 3 - Fix flex base size resolution and main/cross size override for table flex items. r=dholbert
This is the main patch of this bug.

When a flex container provides size overrides for a table flex item,
there are two use cases.

(1) When resolving flex base size, we want to use `flex-basis` to
replace the preferred main size on the *inner table frame* directly.
This is how `height` works on a table element. That is, it sets the
height of the inner table frame, not the table wrapper. This patch
invents `mApplyOverridesVerbatim` flag to tell table wrapper frame don't
do any modification.

(2) When overriding main-size/cross-size for a table flex item, the size
is for *table wrapper frame*. To apply the size to inner table frame,
the table wrapper frame needs adjust the size by subtracting the area
occupied by caption, border, and padding (depending on the box-sizing).

This patch fixes the flex base resolution, and implements the logic for
(2).

We use nsLayoutUtils::GetStyleFrame() to dig into inner table's sizing
properties when resolving flex base size, so we can stop inheriting flex
properties to table wrapper frame in ua.css.

We also need to check style frame's StylePosition() in IsCrossSizeAuto()
so that non-'auto' sizes can prevent tables from being stretched in the
cross axis, just as happens with other flex items. Otherwise with this
patch, the table flex item with fixed height in
dom/flex/test/chrome/test_flex_item_rect.html will be wrongly stretched.

Differential Revision: https://phabricator.services.mozilla.com/D103437
2021-02-18 05:45:25 +00:00
Ting-Yu Lin
cf926779e7 Bug 1674302 Part 2 - Use StyleSizeOverrides to replace ComputeSizeFlag::UseAutoISize. r=dholbert
`UseAutoISize` flag is buggy when used on table flex items because it
never propagates to inner table frame.

Luckily, we can fix it by replacing the flag with StyleSizeOverrides
emplacing an 'auto' mStyleISize, because when computing the size, the
size overrides already propagates from table wrapper to inner table via
the following path:

  `nsTableWrapperFrame::ComputeSize()` [1] ->
  `nsTableWrapperFrame::ComputeAutoSize()` ->
  `nsTableWrapperFrame::InnerTableShrinkWrapISize()` ->
  `nsTableFrame::ComputeSize()`.

Part 3 is going to propagate the size overrides to inner table in
`nsTableWrapperFrame::CreateReflowInputForInnerTable()` during reflow.

This patch fixes the content size suggestion for table flex items.
Combining this patch with Part 3, we can fix those reftests in Part 4.

[1] In this patch, the table wrapper is still using nsContainerFrame's
ComputeSize(), but Part 3 is going to override it.

Differential Revision: https://phabricator.services.mozilla.com/D103438
2021-02-18 05:45:24 +00:00
Ting-Yu Lin
5c0047ddf2 Bug 1674302 Part 1 - Change a FLEX_LOG to dump address of flex item's frame rather than flex item itself. r=emilio
All the other FLEX_LOGs dump the address of flex item's frame.

Differential Revision: https://phabricator.services.mozilla.com/D104644
2021-02-18 05:45:24 +00:00
Ting-Yu Lin
c5ed906bc5 Bug 1690713 - Add FLEX_LOG to print main/cross size overrides. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D103434
2021-02-04 05:07:36 +00:00
Ting-Yu Lin
70ed01b43c Bug 1686603 Part 6 - Use StyleSizeOverrides to override flex item's sizes in its final reflow. r=dholbert
We don't need to tweak as many ReflowInput flags as we did because
ReflowInput::InitResizeFlags() should've set them accordingly, except
when the item has TreatBSizeAsIndefinite() that ReflowInput isn't aware
of.

Differential Revision: https://phabricator.services.mozilla.com/D101797
2021-01-26 02:47:31 +00:00
Ting-Yu Lin
312f1e800f Bug 1686603 Part 5 - Use StyleSizeOverrides to override flex main size when main size can influence cross size. r=dholbert
FlexItem::StyleCrossSize() hasn't been used in this patch, but it will
be used in a later patch that revises size overrides in flex item's
final reflow.

Differential Revision: https://phabricator.services.mozilla.com/D101796
2021-01-26 02:47:33 +00:00
Ting-Yu Lin
4a76528949 Bug 1686603 Part 4 - Use StyleSizeOverrides to revise flex base size resolution. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D101795
2021-01-26 02:47:36 +00:00
Ting-Yu Lin
5071638b26 Bug 1686603 Part 3 - Extract a helper method AxisTracker::IsInlineAxisMainAxis. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D101794
2021-01-26 02:47:38 +00:00
Ting-Yu Lin
a43cae175a Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert
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
2021-01-26 02:47:40 +00:00
Csoregi Natalia
0492d8333a Backed out 8 changesets (bug 1686603) for causing crashtest failures. CLOSED TREE
Backed out changeset 94b5d0986d27 (bug 1686603)
Backed out changeset e7edf6fcc41d (bug 1686603)
Backed out changeset 4c9271f07178 (bug 1686603)
Backed out changeset 7013b95266ae (bug 1686603)
Backed out changeset cf7a55638aef (bug 1686603)
Backed out changeset 7717a0f2a37b (bug 1686603)
Backed out changeset c82593b13a61 (bug 1686603)
Backed out changeset fd1d95a1e706 (bug 1686603)
2021-01-26 04:32:13 +02:00
Ting-Yu Lin
36bf84a643 Bug 1686603 Part 6 - Use StyleSizeOverrides to override flex item's sizes in its final reflow. r=dholbert
We don't need to tweak as many ReflowInput flags as we did because
ReflowInput::InitResizeFlags() should've set them accordingly, except
when the item has TreatBSizeAsIndefinite() that ReflowInput isn't aware
of.

Differential Revision: https://phabricator.services.mozilla.com/D101797
2021-01-25 22:31:34 +00:00
Ting-Yu Lin
56af7d6040 Bug 1686603 Part 5 - Use StyleSizeOverrides to override flex main size when main size can influence cross size. r=dholbert
FlexItem::StyleCrossSize() hasn't been used in this patch, but it will
be used in a later patch that revises size overrides in flex item's
final reflow.

Differential Revision: https://phabricator.services.mozilla.com/D101796
2021-01-25 22:27:46 +00:00
Ting-Yu Lin
902b99ce81 Bug 1686603 Part 4 - Use StyleSizeOverrides to revise flex base size resolution. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D101795
2021-01-25 22:25:57 +00:00
Ting-Yu Lin
6d16aa20ce Bug 1686603 Part 3 - Extract a helper method AxisTracker::IsInlineAxisMainAxis. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D101794
2021-01-25 22:23:28 +00:00
Ting-Yu Lin
ffce5ed7d6 Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert
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
2021-01-25 22:29:31 +00:00
Ting-Yu Lin
e64aef319f Bug 1687795 - Rename the flag tracking whether block-size is set by aspect-ratio and inline-size, and improve comments. r=boris
* Follow other flags' naming by putting "Is" at the beginning.
* Delete the accessor because we just access other flags directly.

Differential Revision: https://phabricator.services.mozilla.com/D102480
2021-01-22 04:41:37 +00:00
Mihai Alexandru Michis
b6b2f1e5f4 Backed out 7 changesets (bug 1686603) for causing crashtest assertion failures.
CLOSED TREE

Backed out changeset 19cba7d34a7f (bug 1686603)
Backed out changeset 3a0d0155ea5e (bug 1686603)
Backed out changeset f1f672cdd0c6 (bug 1686603)
Backed out changeset 63020922e2fd (bug 1686603)
Backed out changeset 8766ce79ba5e (bug 1686603)
Backed out changeset 965dbe8de1e1 (bug 1686603)
Backed out changeset b1328ee45f43 (bug 1686603)
2021-01-21 09:21:12 +02:00
Ting-Yu Lin
5111dbf40b Bug 1686603 Part 6 - Use StyleSizeOverrides to override flex item's sizes in its final reflow. r=dholbert
We don't need to tweak as many ReflowInput flags as we did because
ReflowInput::InitResizeFlags() should've set them accordingly, except
when the item has TreatBSizeAsIndefinite() that ReflowInput isn't aware
of.

Differential Revision: https://phabricator.services.mozilla.com/D101797
2021-01-21 04:34:07 +00:00
Ting-Yu Lin
02e1874759 Bug 1686603 Part 5 - Use StyleSizeOverrides to override flex main size when main size can influence cross size. r=dholbert
FlexItem::StyleCrossSize() hasn't been used in this patch, but it will
be used in a later patch that revises size overrides in flex item's
final reflow.

Differential Revision: https://phabricator.services.mozilla.com/D101796
2021-01-21 04:35:54 +00:00
Ting-Yu Lin
d1b6d1f716 Bug 1686603 Part 4 - Use StyleSizeOverrides to revise flex base size resolution. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D101795
2021-01-21 04:22:08 +00:00
Ting-Yu Lin
c3264bddf5 Bug 1686603 Part 3 - Extract a helper method AxisTracker::IsInlineAxisMainAxis. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D101794
2021-01-21 04:25:07 +00:00
Ting-Yu Lin
d0c462cb81 Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert
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
2021-01-21 04:17:59 +00:00
Boris Chiou
8d1403f488 Bug 1646100 - Take LogicalSize type for containing block and boxing size adjustment for ComputeISizeValue. r=TYLin
We may use the block size to compute the inline size if there is a
non-auto finite aspect-ratio and definite block size, so we need more
information on the block axis. Therefore, we have to pass LogicalSize
for containing block and boxing size adjustment.

Differential Revision: https://phabricator.services.mozilla.com/D99289
2021-01-19 21:51:04 +00:00
Sylvestre Ledru
912aeb9ab5 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
Updated with clang-format version 11.0.1 (taskcluster-B6bdwSKDRF-luRQWXBuzpA)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D102084
2021-01-18 16:50:16 +00:00
Mats Palmgren
9f86a56cd1 Bug 1681788 - Don't do fragmentation stuff when AvailableBSize() is NS_UNCONSTRAINEDSIZE. r=TYLin
The existing code set mayNeedNextInFlow to true because
the effectiveContentBSize was so large it was greater
than NS_UNCONSTRAINEDSIZE.  We shouldn't even do this
comparison at all if the reflow is unconstrained.

Differential Revision: https://phabricator.services.mozilla.com/D99735
2021-01-15 23:42:26 +00:00
Ting-Yu Lin
d8e2ab4e7b Bug 1683976 Part 4 - Reset ReflowInput's mBSizeIsSetByAspectRatio flag if we override flex item's block-size. r=dholbert
If the flex container overrides a flex item's block-size, we don't want
to apply aspect-ratio's automatic content-based minimum sizes [1] in
that axis.

[1] https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum

Differential Revision: https://phabricator.services.mozilla.com/D100809
2021-01-06 04:42:59 +00:00
Ting-Yu Lin
d3311cec5d Bug 1683976 Part 3 - Make flex item work with box-sizing when its aspect-ratio is set from <ratio>. r=dholbert
When specifying aspect-ratio: '<ratio>' [1], the size calculations
involving the aspect ratio work with the dimensions of the box specified
by box-sizing. However, when specifying aspect-ratio: 'auto && <ratio>'
[2] the size calculations involving the aspect ratio work with the
content box dimensions always.

MainSizeFromAspectRatio() doesn't consider box-sizing, so we replace it
with AspectRatio::ComputeRatioDependentSize() which considers
box-sizing.

[1] https://drafts.csswg.org/css-sizing-4/#valdef-aspect-ratio-ratio
[2] https://drafts.csswg.org/css-sizing-4/#valdef-aspect-ratio-auto--ratio

Differential Revision: https://phabricator.services.mozilla.com/D100371
2021-01-06 04:42:57 +00:00
Ting-Yu Lin
4b334ebdb8 Bug 1683976 Part 2 - Move ClampMainSizeViaCrossAxisConstraints() into FlexItem. r=dholbert
We are going to revise this method in the next part, so this patch
simply moves this method into FlexItem without doing any improvement.

Differential Revision: https://phabricator.services.mozilla.com/D100370
2021-01-05 19:14:08 +00:00
Ting-Yu Lin
63d6943077 Bug 1683976 Part 1 - Rename intrinsic ratio to aspect ratio in nsFlexContainerFrame. r=dholbert,boris
FlexItem::mIntrinsicRatio caches the AspectRatio from
nsIFrame::GetAspectRatio(), which can either be the natural aspect-ratio
of the element or the aspect-ratio set from style system. Rename it and
its accessors for accuracy.

The comments are revised to match the term "preferred aspect ratio" used
throughout the flexbox spec.

Differential Revision: https://phabricator.services.mozilla.com/D100369
2021-01-05 19:14:01 +00:00
Ting-Yu Lin
23425662c0 Bug 1585485 Part 3 - Use zero percentage basis to compute specified size suggestion for compressible flex items. r=dholbert
Also, add test for various types of <input> in row flex
containers (flex-item-compressible-001.html) and in column flex
containers (flex-item-compressible-002.html).

Note: Google Chrome 89 and Safari 14 fail the subtests that have a
definite value inside a calc expression in
flex-item-compressible-001.html. They also fail the entire
flex-item-compressible-002.html because they don't support <input> in
vertical writing-mode (i.e. <input> is still horizontal in vertical
writing mode).

Differential Revision: https://phabricator.services.mozilla.com/D99952
2020-12-18 18:59:47 +00:00
Ting-Yu Lin
ab3ba8fcb5 Bug 1680417 - Clamp resolved auto min main size by the definite max main size as the last step. r=dholbert
This patch doesn't change behavior -- we were already indirectly doing this
clamping, due to the fact that the content size suggestion was always computed &
was clamped, and then this clamped content size suggestion was itself serving as
an upper-bound for the resolved value.

Differential Revision: https://phabricator.services.mozilla.com/D98554
2020-12-07 05:09:09 +00:00
Bogdan Tara
4a649093b9 Backed out changeset 3e90a3759639 (bug 1679208) for scrollbars-no-margin.html failures CLOSED TREE 2020-12-03 01:11:32 +02:00
Emilio Cobos Álvarez
aa15236426 Bug 1679208 - Don't assume int return values in nsITheme. r=mstange
This doesn't hold with fractional scale values. Right now GTK truncates
the scale factor, Windows rounds, and non-native theme rounds as well.

With this native theme will propagate correctly the floating point
values.

I tried to not change behavior meaningfully in any of the other themes,
mostly to avoid risk. GTK and Windows can be trivially tweaked to
support fractional scale factors properly if we wanted to, but seems
better to not do that as part of this patch.

Depends on D98099

Differential Revision: https://phabricator.services.mozilla.com/D98100
2020-12-02 21:40:05 +00:00
Ting-Yu Lin
ca8fd6da81 Bug 1674774 Part 3 - Move flex item's position when flex container has a vertical-rl writing-mode. r=mats
The flex container fragment's tentative block-size can be different from
its final size if there is any unbreakable child that has a block-size
larger than the available block-size. The two passed reftests are such
examples.

Differential Revision: https://phabricator.services.mozilla.com/D97522
2020-12-01 05:45:59 +00:00
Ting-Yu Lin
859e445d03 Bug 1674774 Part 2 - Fix the border-box size which is used to position flex container's children. r=mats
If the flex container frame's tentative border-box size is different
from its final size, and it's in vertical-rl writing mode, we need to
adjust children's position. This is implemented in Part 3.

Differential Revision: https://phabricator.services.mozilla.com/D97521
2020-12-01 05:45:56 +00:00
Ting-Yu Lin
ed394cfbbc Bug 1674774 Part 1 - Move two variables' definition closer to their usage. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D97519
2020-12-01 05:45:49 +00:00