Title: [104313] trunk
- Revision
- 104313
- Author
- [email protected]
- Date
- 2012-01-06 12:05:06 -0800 (Fri, 06 Jan 2012)
Log Message
Need to relayout when stretching the height of a flex item
https://bugs.webkit.org/show_bug.cgi?id=75661
Reviewed by Ojan Vafai.
Source/WebCore:
Test: css3/flexbox/flex-align-stretch.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computePreferredMainAxisExtent): Always clear the override size since
it may be set when aligning.
(WebCore::RenderFlexibleBox::alignChildren): Only relayout if the height changed.
LayoutTests:
* css3/flexbox/flex-align-stretch-expected.txt: Added.
* css3/flexbox/flex-align-stretch.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (104312 => 104313)
--- trunk/LayoutTests/ChangeLog 2012-01-06 20:01:55 UTC (rev 104312)
+++ trunk/LayoutTests/ChangeLog 2012-01-06 20:05:06 UTC (rev 104313)
@@ -1,3 +1,13 @@
+2012-01-06 Tony Chang <[email protected]>
+
+ Need to relayout when stretching the height of a flex item
+ https://bugs.webkit.org/show_bug.cgi?id=75661
+
+ Reviewed by Ojan Vafai.
+
+ * css3/flexbox/flex-align-stretch-expected.txt: Added.
+ * css3/flexbox/flex-align-stretch.html: Added.
+
2012-01-06 Dmitry Lomov <[email protected]>
Unreviewed: [Chromium] rebaselining IMAGE expectations after http://trac.webkit.org/changeset/104240/
Added: trunk/LayoutTests/css3/flexbox/flex-align-stretch-expected.txt (0 => 104313)
--- trunk/LayoutTests/css3/flexbox/flex-align-stretch-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/flexbox/flex-align-stretch-expected.txt 2012-01-06 20:05:06 UTC (rev 104313)
@@ -0,0 +1,4 @@
+PASS
+PASS
+PASS
+PASS
Added: trunk/LayoutTests/css3/flexbox/flex-align-stretch.html (0 => 104313)
--- trunk/LayoutTests/css3/flexbox/flex-align-stretch.html (rev 0)
+++ trunk/LayoutTests/css3/flexbox/flex-align-stretch.html 2012-01-06 20:05:06 UTC (rev 104313)
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+<style>
+body {
+ margin: 0;
+}
+.flexbox {
+ display: -webkit-flexbox;
+ background-color: #aaa;
+ position: relative;
+}
+.flexbox div {
+ border: 0;
+}
+
+.flexbox > :nth-child(1) {
+ background-color: blue;
+}
+.flexbox > :nth-child(2) {
+ background-color: green;
+}
+.flexbox > :nth-child(3) {
+ background-color: red;
+}
+
+.absolute {
+ position: absolute;
+ width: 50px;
+ height: 50px;
+ background-color: yellow !important;
+}
+</style>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+</script>
+<script src=""
+<body _onload_="checkFlexBoxen()">
+<div class="flexbox" style="width: 600px">
+ <div data-expected-height="100" style="width: -webkit-flex(1 0 0); position: relative">
+ <div data-offset-x="0" data-offset-y="50" class="absolute" style="bottom:0;"></div>
+ </div>
+ <div data-expected-height="100" style="width: -webkit-flex(1 0 0); height: 100px"></div>
+ <div data-expected-height="100" style="width: -webkit-flex(1 0 0); position: relative">
+ <div data-offset-x="0" data-offset-y="50" class="absolute" style="bottom:0;"></div>
+ </div>
+</div>
+
+<div style="-webkit-writing-mode: horizontal-bt">
+<div class="flexbox" style="width: 600px">
+ <div data-expected-height="100" style="width: -webkit-flex(1 0 0); position: relative">
+ <div data-offset-x="0" data-offset-y="0" class="absolute" style="top:0;"></div>
+ </div>
+ <div data-expected-height="100" style="width: -webkit-flex(1 0 0); height: 100px"></div>
+ <div data-expected-height="100" style="width: -webkit-flex(1 0 0); position: relative">
+ <div data-offset-x="0" data-offset-y="50" class="absolute" style="bottom:0;"></div>
+ </div>
+</div>
+</div>
+
+<div style="-webkit-writing-mode: vertical-rl">
+<div class="flexbox" style="height: 200px">
+ <div data-expected-width="100" style="height: -webkit-flex(1 0 0); position: relative">
+ <div data-offset-x="0" data-offset-y="0" class="absolute" style="left:0;"></div>
+ </div>
+ <div data-expected-width="100" style="height: -webkit-flex(1 0 0); width: 100px"></div>
+ <div data-expected-width="100" style="height: -webkit-flex(1 0 0); position: relative">
+ <div data-offset-x="0" data-offset-y="0" class="absolute" style="left:0;"></div>
+ </div>
+</div>
+</div>
+
+<div style="-webkit-writing-mode: vertical-lr">
+<div class="flexbox" style="height: 200px">
+ <div data-expected-width="100" style="height: -webkit-flex(1 0 0); position: relative">
+ <div data-offset-x="50" data-offset-y="0" class="absolute" style="right:0;"></div>
+ </div>
+ <div data-expected-width="100" style="height: -webkit-flex(1 0 0); width: 100px"></div>
+ <div data-expected-width="100" style="height: -webkit-flex(1 0 0); position: relative">
+ <div data-offset-x="0" data-offset-y="0" class="absolute" style="left:0;"></div>
+ </div>
+</div>
+</div>
+
+</html>
Modified: trunk/Source/WebCore/ChangeLog (104312 => 104313)
--- trunk/Source/WebCore/ChangeLog 2012-01-06 20:01:55 UTC (rev 104312)
+++ trunk/Source/WebCore/ChangeLog 2012-01-06 20:05:06 UTC (rev 104313)
@@ -1,3 +1,17 @@
+2012-01-06 Tony Chang <[email protected]>
+
+ Need to relayout when stretching the height of a flex item
+ https://bugs.webkit.org/show_bug.cgi?id=75661
+
+ Reviewed by Ojan Vafai.
+
+ Test: css3/flexbox/flex-align-stretch.html
+
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::computePreferredMainAxisExtent): Always clear the override size since
+ it may be set when aligning.
+ (WebCore::RenderFlexibleBox::alignChildren): Only relayout if the height changed.
+
2012-01-06 Anders Carlsson <[email protected]>
Add ScrollElasticityControllerClient::immediateScrollBy
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (104312 => 104313)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2012-01-06 20:01:55 UTC (rev 104312)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2012-01-06 20:05:06 UTC (rev 104313)
@@ -488,8 +488,8 @@
LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent();
for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+ child->clearOverrideSize();
if (mainAxisLengthForChild(child).isAuto()) {
- child->clearOverrideSize();
if (!relayoutChildren)
child->setChildNeedsLayout(true);
child->layoutIfNeeded();
@@ -698,10 +698,17 @@
switch (child->style()->flexAlign()) {
case AlignStretch: {
if (!isColumnFlow() && child->style()->logicalHeight().isAuto()) {
+ LayoutUnit logicalHeightBefore = child->logicalHeight();
LayoutUnit stretchedLogicalHeight = child->logicalHeight() + RenderFlexibleBox::availableAlignmentSpaceForChild(child);
child->setLogicalHeight(stretchedLogicalHeight);
child->computeLogicalHeight();
- // FIXME: We need to relayout if the height changed.
+
+ if (child->logicalHeight() != logicalHeightBefore) {
+ child->setOverrideHeight(child->logicalHeight());
+ child->setLogicalHeight(0);
+ child->setChildNeedsLayout(true);
+ child->layoutIfNeeded();
+ }
}
break;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes