Title: [286421] trunk/Source/WebCore
- Revision
- 286421
- Author
- [email protected]
- Date
- 2021-12-02 04:51:10 -0800 (Thu, 02 Dec 2021)
Log Message
Reset height definiteness when constructing flex items
https://bugs.webkit.org/show_bug.cgi?id=233458
Reviewed by Alan Bujtas.
Flexbox renderer uses an attribute called m_hasDefiniteHeight in order to properly
consider as definite some sizes that are normally considered as indefinite. For example,
a percentage of an intrinsic size is normally indefinite unless the containing block has
an overriding size in which case can be considered as definite.
The value of m_hasDefiniteHeight is properly reset every time we construct a flex item or
just after finishing the layout. However we should do it as well just before computing
the flex basis if the flex item is also a flex container. In that case it might happen that
we try to compute the flex basis value with a value for m_hasDefiniteHeight which can
be potentially outdated.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock): Use resetHasDefiniteHeight().
(WebCore::RenderFlexibleBox::layoutFlexItems): Ditto.
(WebCore::RenderFlexibleBox::constructFlexItem): Call resetHasDefiniteHeight() if the
flex item is also a flex container.
* rendering/RenderFlexibleBox.h:
(WebCore::RenderFlexibleBox::resetHasDefiniteHeight): Added.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (286420 => 286421)
--- trunk/Source/WebCore/ChangeLog 2021-12-02 09:02:26 UTC (rev 286420)
+++ trunk/Source/WebCore/ChangeLog 2021-12-02 12:51:10 UTC (rev 286421)
@@ -1,3 +1,29 @@
+2021-11-25 Sergio Villar Senin <[email protected]>
+
+ Reset height definiteness when constructing flex items
+ https://bugs.webkit.org/show_bug.cgi?id=233458
+
+ Reviewed by Alan Bujtas.
+
+ Flexbox renderer uses an attribute called m_hasDefiniteHeight in order to properly
+ consider as definite some sizes that are normally considered as indefinite. For example,
+ a percentage of an intrinsic size is normally indefinite unless the containing block has
+ an overriding size in which case can be considered as definite.
+
+ The value of m_hasDefiniteHeight is properly reset every time we construct a flex item or
+ just after finishing the layout. However we should do it as well just before computing
+ the flex basis if the flex item is also a flex container. In that case it might happen that
+ we try to compute the flex basis value with a value for m_hasDefiniteHeight which can
+ be potentially outdated.
+
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::layoutBlock): Use resetHasDefiniteHeight().
+ (WebCore::RenderFlexibleBox::layoutFlexItems): Ditto.
+ (WebCore::RenderFlexibleBox::constructFlexItem): Call resetHasDefiniteHeight() if the
+ flex item is also a flex container.
+ * rendering/RenderFlexibleBox.h:
+ (WebCore::RenderFlexibleBox::resetHasDefiniteHeight): Added.
+
2021-12-02 Youenn Fablet <[email protected]>
Add support for NavigationPreloadManager
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (286420 => 286421)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2021-12-02 09:02:26 UTC (rev 286420)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2021-12-02 12:51:10 UTC (rev 286421)
@@ -399,7 +399,7 @@
// We have to reset this, because changes to our ancestors' style can affect
// this value. Also, this needs to be before we call updateAfterLayout, as
// that function may re-enter this one.
- m_hasDefiniteHeight = SizeDefiniteness::Unknown;
+ resetHasDefiniteHeight();
// Update our scroll information if we're overflow:auto/scroll/hidden now that we know if we overflow or not.
updateScrollInfoAfterLayout();
@@ -1101,7 +1101,7 @@
}
allItems.append(constructFlexItem(*child, relayoutChildren));
// constructFlexItem() might set the override containing block height so any value cached for definiteness might be incorrect.
- m_hasDefiniteHeight = SizeDefiniteness::Unknown;
+ resetHasDefiniteHeight();
}
const LayoutUnit lineBreakLength = mainAxisContentExtent(LayoutUnit::max());
@@ -1450,6 +1450,8 @@
{
auto childHadLayout = child.everHadLayout();
child.clearOverridingContentSize();
+ if (is<RenderFlexibleBox>(child))
+ downcast<RenderFlexibleBox>(child).resetHasDefiniteHeight();
LayoutUnit borderAndPadding = isHorizontalFlow() ? child.horizontalBorderAndPaddingExtent() : child.verticalBorderAndPaddingExtent();
LayoutUnit childInnerFlexBaseSize = computeFlexBaseSizeForChild(child, borderAndPadding, relayoutChildren);
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (286420 => 286421)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2021-12-02 09:02:26 UTC (rev 286420)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2021-12-02 12:51:10 UTC (rev 286421)
@@ -201,6 +201,8 @@
bool childHasPercentHeightDescendants(const RenderBox&) const;
+ void resetHasDefiniteHeight() { m_hasDefiniteHeight = SizeDefiniteness::Unknown; }
+
enum class GapType { BetweenLines, BetweenItems };
LayoutUnit computeGap(GapType) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes