Title: [209068] trunk
- Revision
- 209068
- Author
- [email protected]
- Date
- 2016-11-29 08:04:41 -0800 (Tue, 29 Nov 2016)
Log Message
Safari (WebKit) doesn't wrap element within flex when width comes below min-width
https://bugs.webkit.org/show_bug.cgi?id=136041
<rdar://problem/25569370>
Reviewed by Darin Adler.
Source/WebCore:
While figuring out whether a particular flex item fits the current line, we need to take
the min-width into account too. This matches both FF and Chrome behaviour.
Tests: fast/flexbox/flex-wrap-when-min-widht-is-set-1.html
fast/flexbox/flex-wrap-when-min-widht-is-set-2.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeNextFlexLine):
LayoutTests:
* fast/flexbox/flex-wrap-when-min-widht-is-set-1-expected.html: Added.
* fast/flexbox/flex-wrap-when-min-widht-is-set-1.html: Added.
* fast/flexbox/flex-wrap-when-min-widht-is-set-2-expected.html: Added.
* fast/flexbox/flex-wrap-when-min-widht-is-set-2.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (209067 => 209068)
--- trunk/LayoutTests/ChangeLog 2016-11-29 14:02:42 UTC (rev 209067)
+++ trunk/LayoutTests/ChangeLog 2016-11-29 16:04:41 UTC (rev 209068)
@@ -1,3 +1,16 @@
+2016-11-29 Zalan Bujtas <[email protected]>
+
+ Safari (WebKit) doesn't wrap element within flex when width comes below min-width
+ https://bugs.webkit.org/show_bug.cgi?id=136041
+ <rdar://problem/25569370>
+
+ Reviewed by Darin Adler.
+
+ * fast/flexbox/flex-wrap-when-min-widht-is-set-1-expected.html: Added.
+ * fast/flexbox/flex-wrap-when-min-widht-is-set-1.html: Added.
+ * fast/flexbox/flex-wrap-when-min-widht-is-set-2-expected.html: Added.
+ * fast/flexbox/flex-wrap-when-min-widht-is-set-2.html: Added.
+
2016-11-28 Antti Koivisto <[email protected]>
Slotted nodes ignore transition
Added: trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-1-expected.html (0 => 209068)
--- trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-1-expected.html (rev 0)
+++ trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-1-expected.html 2016-11-29 16:04:41 UTC (rev 209068)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This test that we wrap flex content properly with min-width is set.</title>
+<style>
+div {
+ width: 500px;
+ height: 200px;
+ background: green;
+}
+</style>
+</head>
+<body>
+<div></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-1.html (0 => 209068)
--- trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-1.html (rev 0)
+++ trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-1.html 2016-11-29 16:04:41 UTC (rev 209068)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This test that we wrap flex content properly with min-width is set.</title>
+<style>
+.flex {
+ display: flex;
+ flex-wrap: wrap;
+}
+
+.item {
+ box-sizing: border-box;
+ min-width: 500px;
+ flex-basis: 200px;
+ height: 100px;
+ background: green;
+}
+</style>
+</head>
+<body>
+<div class="flex"><div class="item"></div><div class="item"></div></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-2-expected.html (0 => 209068)
--- trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-2-expected.html (rev 0)
+++ trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-2-expected.html 2016-11-29 16:04:41 UTC (rev 209068)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This test that we wrap flex content properly with min-width is set.</title>
+<style>
+div {
+ height: 200px;
+ background: green;
+}
+</style>
+</head>
+<body>
+<div></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-2.html (0 => 209068)
--- trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-2.html (rev 0)
+++ trunk/LayoutTests/fast/flexbox/flex-wrap-when-min-widht-is-set-2.html 2016-11-29 16:04:41 UTC (rev 209068)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This test that we wrap flex content properly with min-width is set.</title>
+<style>
+<style>
+.flex {
+ display: flex;
+ flex-wrap: wrap;
+}
+
+.item {
+ flex-grow: 1;
+ flex-basis: 35%;
+ min-width: 600px;
+ height: 100px;
+ background: green;
+}
+</style>
+</head>
+</body>
+<div class="flex"><div class="item"></div><div class="item"></div></div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (209067 => 209068)
--- trunk/Source/WebCore/ChangeLog 2016-11-29 14:02:42 UTC (rev 209067)
+++ trunk/Source/WebCore/ChangeLog 2016-11-29 16:04:41 UTC (rev 209068)
@@ -1,3 +1,20 @@
+2016-11-29 Zalan Bujtas <[email protected]>
+
+ Safari (WebKit) doesn't wrap element within flex when width comes below min-width
+ https://bugs.webkit.org/show_bug.cgi?id=136041
+ <rdar://problem/25569370>
+
+ Reviewed by Darin Adler.
+
+ While figuring out whether a particular flex item fits the current line, we need to take
+ the min-width into account too. This matches both FF and Chrome behaviour.
+
+ Tests: fast/flexbox/flex-wrap-when-min-widht-is-set-1.html
+ fast/flexbox/flex-wrap-when-min-widht-is-set-2.html
+
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::computeNextFlexLine):
+
2016-11-29 Antti Koivisto <[email protected]>
Try to fix win/gtk build.
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (209067 => 209068)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2016-11-29 14:02:42 UTC (rev 209067)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2016-11-29 16:04:41 UTC (rev 209068)
@@ -983,6 +983,7 @@
bool lineHasInFlowItem = false;
+ LayoutUnit preferredMainAxisExtentWithMinWidthConstraint;
for (RenderBox* child = m_orderIterator.currentChild(); child; child = m_orderIterator.next()) {
if (child->isOutOfFlowPositioned()) {
orderedChildren.append(child);
@@ -990,19 +991,26 @@
}
LayoutUnit childMainAxisExtent = preferredMainAxisContentExtentForChild(*child, hasInfiniteLineLength);
- LayoutUnit childMainAxisMarginBoxExtent = mainAxisBorderAndPaddingExtentForChild(*child) + childMainAxisExtent;
- childMainAxisMarginBoxExtent += isHorizontalFlow() ? child->horizontalMarginExtent() : child->verticalMarginExtent();
+ LayoutUnit borderMarginAndPaddingSpace = mainAxisBorderAndPaddingExtentForChild(*child) + (isHorizontalFlow() ? child->horizontalMarginExtent() : child->verticalMarginExtent());
- if (isMultiline() && preferredMainAxisExtent + childMainAxisMarginBoxExtent > lineBreakLength && lineHasInFlowItem)
+ LayoutUnit childMainAxisExtentWithMinWidthConstraint = childMainAxisExtent;
+ if (child->style().logicalMinWidth().isSpecifiedOrIntrinsic()) {
+ if (auto minWidthForChild = computeMainAxisExtentForChild(*child, MinSize, child->style().logicalMinWidth()))
+ childMainAxisExtentWithMinWidthConstraint = std::max(childMainAxisExtent, minWidthForChild.value());
+ }
+ preferredMainAxisExtentWithMinWidthConstraint += childMainAxisExtentWithMinWidthConstraint + borderMarginAndPaddingSpace;
+
+ if (isMultiline() && preferredMainAxisExtentWithMinWidthConstraint > lineBreakLength && lineHasInFlowItem)
break;
orderedChildren.append(child);
lineHasInFlowItem = true;
- preferredMainAxisExtent += childMainAxisMarginBoxExtent;
+
+ preferredMainAxisExtent += childMainAxisExtent + borderMarginAndPaddingSpace;
totalFlexGrow += child->style().flexGrow();
totalWeightedFlexShrink += child->style().flexShrink() * childMainAxisExtent;
LayoutUnit childMinMaxAppliedMainAxisExtent = adjustChildSizeForMinAndMax(*child, childMainAxisExtent);
- minMaxAppliedMainAxisExtent += childMinMaxAppliedMainAxisExtent - childMainAxisExtent + childMainAxisMarginBoxExtent;
+ minMaxAppliedMainAxisExtent += childMinMaxAppliedMainAxisExtent + borderMarginAndPaddingSpace;
}
return true;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes