Title: [272054] trunk
- Revision
- 272054
- Author
- [email protected]
- Date
- 2021-01-29 02:01:27 -0800 (Fri, 29 Jan 2021)
Log Message
[css-flexbox] REGRESSION(r266695): content inside a `<button>` inside a flex container has a height of `0` without a declared `min-height`
https://bugs.webkit.org/show_bug.cgi?id=220946
Reviewed by Zalan Bujtas.
Source/WebCore:
Test: css3/flexbox/percentage-descendants-of-skipped-flex-item.html
r252620 added an optimization which saves layouts for flexbox containers' descendants with percentage heights.
That optimization relies on a hash map of percentage height descendants that is filled in with calls to
addPercentHeightDescendant().
FlexibleBoxImpl's like RenderButton might wrap their children in anonymous blocks. Those anonymous blocks are
skipped for percentage height calculations in RenderBox::computePercentageLogicalHeight() and thus
addPercentHeightDescendant() is never called for them. This means that hasPercentageHeightDescendants() would
always wrongly return false for a child of a <button> with a percentage height.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::childHasPercentHeightDescendants const): Renamed from hasPercentHeightDescendants in
order not to clash with RenderBlock method. It now also checks whether flex items skipped from percentage
height calculations are the containing blocks of any percentage height descendant of the flex container
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
(WebCore::RenderFlexibleBox::hasPercentHeightDescendants const): Deleted.
* rendering/RenderFlexibleBox.h:
LayoutTests:
* css3/flexbox/percentage-descendants-of-skipped-flex-item-expected.html: Added.
* css3/flexbox/percentage-descendants-of-skipped-flex-item.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (272053 => 272054)
--- trunk/LayoutTests/ChangeLog 2021-01-29 09:01:22 UTC (rev 272053)
+++ trunk/LayoutTests/ChangeLog 2021-01-29 10:01:27 UTC (rev 272054)
@@ -1,3 +1,13 @@
+2021-01-28 Sergio Villar Senin <[email protected]>
+
+ [css-flexbox] REGRESSION(r266695): content inside a `<button>` inside a flex container has a height of `0` without a declared `min-height`
+ https://bugs.webkit.org/show_bug.cgi?id=220946
+
+ Reviewed by Zalan Bujtas.
+
+ * css3/flexbox/percentage-descendants-of-skipped-flex-item-expected.html: Added.
+ * css3/flexbox/percentage-descendants-of-skipped-flex-item.html: Added.
+
2021-01-29 Youenn Fablet <[email protected]>
[MacOS] Enable WebKitTestRunner audio and video capture in GPUProcess
Added: trunk/LayoutTests/css3/flexbox/percentage-descendants-of-skipped-flex-item-expected.html (0 => 272054)
--- trunk/LayoutTests/css3/flexbox/percentage-descendants-of-skipped-flex-item-expected.html (rev 0)
+++ trunk/LayoutTests/css3/flexbox/percentage-descendants-of-skipped-flex-item-expected.html 2021-01-29 10:01:27 UTC (rev 272054)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<button style="width: 200px; height: 100px;">
+ <div style="width: 200px; height: 100%; background-color: green;"></div>
+</button>
Property changes on: trunk/LayoutTests/css3/flexbox/percentage-descendants-of-skipped-flex-item-expected.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/css3/flexbox/percentage-descendants-of-skipped-flex-item.html (0 => 272054)
--- trunk/LayoutTests/css3/flexbox/percentage-descendants-of-skipped-flex-item.html (rev 0)
+++ trunk/LayoutTests/css3/flexbox/percentage-descendants-of-skipped-flex-item.html 2021-01-29 10:01:27 UTC (rev 272054)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<link href="" rel="stylesheet">
+<style>
+.flexbox {
+ width: 200px;
+ height: 200px;
+}
+</style>
+<div class="flexbox column">
+ <div style="height: 50%;">
+ <button style="width: 200px; height: 100%;">
+ <div style="width: 200px; height: 100%; background-color: green;"></div>
+ </button>
+ </div>
+</div>
Property changes on: trunk/LayoutTests/css3/flexbox/percentage-descendants-of-skipped-flex-item.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/Source/WebCore/ChangeLog (272053 => 272054)
--- trunk/Source/WebCore/ChangeLog 2021-01-29 09:01:22 UTC (rev 272053)
+++ trunk/Source/WebCore/ChangeLog 2021-01-29 10:01:27 UTC (rev 272054)
@@ -1,3 +1,29 @@
+2021-01-28 Sergio Villar Senin <[email protected]>
+
+ [css-flexbox] REGRESSION(r266695): content inside a `<button>` inside a flex container has a height of `0` without a declared `min-height`
+ https://bugs.webkit.org/show_bug.cgi?id=220946
+
+ Reviewed by Zalan Bujtas.
+
+ Test: css3/flexbox/percentage-descendants-of-skipped-flex-item.html
+
+ r252620 added an optimization which saves layouts for flexbox containers' descendants with percentage heights.
+ That optimization relies on a hash map of percentage height descendants that is filled in with calls to
+ addPercentHeightDescendant().
+
+ FlexibleBoxImpl's like RenderButton might wrap their children in anonymous blocks. Those anonymous blocks are
+ skipped for percentage height calculations in RenderBox::computePercentageLogicalHeight() and thus
+ addPercentHeightDescendant() is never called for them. This means that hasPercentageHeightDescendants() would
+ always wrongly return false for a child of a <button> with a percentage height.
+
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::childHasPercentHeightDescendants const): Renamed from hasPercentHeightDescendants in
+ order not to clash with RenderBlock method. It now also checks whether flex items skipped from percentage
+ height calculations are the containing blocks of any percentage height descendant of the flex container
+ (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
+ (WebCore::RenderFlexibleBox::hasPercentHeightDescendants const): Deleted.
+ * rendering/RenderFlexibleBox.h:
+
2021-01-29 Youenn Fablet <[email protected]>
Use WebRTC GPU process flag for MediaRecorder
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (272053 => 272054)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2021-01-29 09:01:22 UTC (rev 272053)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2021-01-29 10:01:27 UTC (rev 272054)
@@ -1623,12 +1623,26 @@
return child.style().overflowX();
}
-bool RenderFlexibleBox::hasPercentHeightDescendants(const RenderBox& renderer) const
+bool RenderFlexibleBox::childHasPercentHeightDescendants(const RenderBox& renderer) const
{
- // FIXME: This function can be removed soon after webkit.org/b/204318 is fixed.
+ // FIXME: This function can be removed soon after webkit.org/b/204318 is fixed. Evaluate whether the
+ // skipContainingBlockForPercentHeightCalculation() check below should be moved to the caller in that case.
if (!is<RenderBlock>(renderer))
return false;
auto& renderBlock = downcast<RenderBlock>(renderer);
+
+ // FlexibleBoxImpl's like RenderButton might wrap their children in anonymous blocks. Those anonymous blocks are
+ // skipped for percentage height calculations in RenderBox::computePercentageLogicalHeight() and thus
+ // addPercentHeightDescendant() is never called for them. This means that this method would always wrongly
+ // return false for a child of a <button> with a percentage height.
+ if (hasPercentHeightDescendants() && skipContainingBlockForPercentHeightCalculation(renderer, isHorizontalWritingMode() != renderer.isHorizontalWritingMode())) {
+ auto& descendants = *percentHeightDescendants();
+ for (auto* descendant : descendants) {
+ if (renderBlock.isContainingBlockAncestorFor(*descendant))
+ return true;
+ }
+ }
+
if (!renderBlock.hasPercentHeightDescendants())
return false;
@@ -1686,7 +1700,7 @@
// We may have already forced relayout for orthogonal flowing children in
// computeInnerFlexBaseSizeForChild.
bool forceChildRelayout = relayoutChildren && !m_relaidOutChildren.contains(&child);
- if (!forceChildRelayout && hasPercentHeightDescendants(child)) {
+ if (!forceChildRelayout && childHasPercentHeightDescendants(child)) {
// Have to force another relayout even though the child is sized
// correctly, because its descendants are not sized correctly yet. Our
// previous layout of the child was done without an override height set.
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (272053 => 272054)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2021-01-29 09:01:22 UTC (rev 272053)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2021-01-29 10:01:27 UTC (rev 272054)
@@ -191,7 +191,7 @@
void appendChildFrameRects(ChildFrameRects&);
void repaintChildrenDuringLayoutIfMoved(const ChildFrameRects&);
- bool hasPercentHeightDescendants(const RenderBox&) const;
+ bool childHasPercentHeightDescendants(const RenderBox&) const;
enum class GapType { BetweenLines, BetweenItems };
LayoutUnit computeGap(GapType) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes