Title: [123696] trunk
- Revision
- 123696
- Author
- t...@chromium.org
- Date
- 2012-07-25 19:24:47 -0700 (Wed, 25 Jul 2012)
Log Message
flexitems can overflow the flexbox due to rounding
https://bugs.webkit.org/show_bug.cgi?id=92163
Reviewed by Levi Weintraub.
Source/WebCore:
Don't round flex item sizes and use LayoutPoint for the location of flex items.
Test: css3/flexbox/flex-rounding.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::resolveFlexibleLengths):
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
(WebCore::RenderFlexibleBox::layoutColumnReverse):
LayoutTests:
Tests for dividing space in non-integral amounts.
* css3/flexbox/flex-rounding-expected.txt: Added.
* css3/flexbox/flex-rounding.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (123695 => 123696)
--- trunk/LayoutTests/ChangeLog 2012-07-26 02:19:09 UTC (rev 123695)
+++ trunk/LayoutTests/ChangeLog 2012-07-26 02:24:47 UTC (rev 123696)
@@ -1,3 +1,15 @@
+2012-07-25 Tony Chang <t...@chromium.org>
+
+ flexitems can overflow the flexbox due to rounding
+ https://bugs.webkit.org/show_bug.cgi?id=92163
+
+ Reviewed by Levi Weintraub.
+
+ Tests for dividing space in non-integral amounts.
+
+ * css3/flexbox/flex-rounding-expected.txt: Added.
+ * css3/flexbox/flex-rounding.html: Added.
+
2012-07-25 Yoshifumi Inoue <yo...@chromium.org>
[Tests] Re-factor fast/forms/number/number-spinbutton-change-and-input-events.html
Added: trunk/LayoutTests/css3/flexbox/flex-rounding-expected.txt (0 => 123696)
--- trunk/LayoutTests/css3/flexbox/flex-rounding-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/flexbox/flex-rounding-expected.txt 2012-07-26 02:24:47 UTC (rev 123696)
@@ -0,0 +1,8 @@
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
Added: trunk/LayoutTests/css3/flexbox/flex-rounding.html (0 => 123696)
--- trunk/LayoutTests/css3/flexbox/flex-rounding.html (rev 0)
+++ trunk/LayoutTests/css3/flexbox/flex-rounding.html 2012-07-26 02:24:47 UTC (rev 123696)
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+<style>
+.flexbox {
+ display: -webkit-flex;
+ background-color: #aaa;
+ position: relative;
+}
+.flexbox :nth-child(1) {
+ background-color: blue;
+}
+.flexbox :nth-child(2) {
+ background-color: green;
+}
+.flexbox :nth-child(3) {
+ background-color: red;
+}
+.flexbox :nth-child(4) {
+ background-color: yellow;
+}
+.flexbox :nth-child(5) {
+ background-color: purple;
+}
+.flexbox :nth-child(6) {
+ background-color: orange;
+}
+.flexbox :nth-child(7) {
+ background-color: lime;
+}
+
+.flexbox > div {
+ -webkit-flex: 1;
+}
+.column {
+ -webkit-flex-direction: column;
+ width: 200px;
+ height: 200px;
+}
+</style>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<script src=""
+<body _onload_="checkLayout('.flexbox')">
+
+<div class="flexbox" style="width: 101px; height: 10px">
+ <div data-expected-width="51" data-offset-x="0"></div>
+ <div data-expected-width="50" data-offset-x="51"></div>
+</div>
+
+<div class="flexbox" style="width: 100px; height: 10px">
+ <div data-expected-width="33" data-offset-x="0"></div>
+ <div data-expected-width="34" data-offset-x="33"></div>
+ <div data-expected-width="33" data-offset-x="67"></div>
+</div>
+
+<div class="flexbox" style="-webkit-flex-direction: row-reverse; width: 101px; height: 10px">
+ <div data-expected-width="50" data-offset-x="51"></div>
+ <div data-expected-width="51" data-offset-x="0"></div>
+</div>
+
+<div class="flexbox" style="-webkit-flex-direction: row-reverse; width: 100px; height: 10px">
+ <div data-expected-width="33" data-offset-x="67"></div>
+ <div data-expected-width="34" data-offset-x="33"></div>
+ <div data-expected-width="33" data-offset-x="0"></div>
+</div>
+
+<div class="flexbox" style="-webkit-flex-direction: column; height: 101px; width: 100px">
+ <div data-expected-height="51" data-offset-y="0"></div>
+ <div data-expected-height="50" data-offset-y="51"></div>
+</div>
+
+<div class="flexbox" style="-webkit-flex-direction: column; height: 100px; width: 100px">
+ <div data-expected-height="33" data-offset-y="0"></div>
+ <div data-expected-height="34" data-offset-y="33"></div>
+ <div data-expected-height="33" data-offset-y="67"></div>
+</div>
+
+<div class="flexbox" style="-webkit-flex-direction: column-reverse; height: 101px; width: 100px">
+ <div data-expected-height="50" data-offset-y="51"></div>
+ <div data-expected-height="51" data-offset-y="0"></div>
+</div>
+
+<div class="flexbox" style="-webkit-flex-direction: column-reverse; height: 100px; width: 100px">
+ <div data-expected-height="33" data-offset-y="67"></div>
+ <div data-expected-height="34" data-offset-y="33"></div>
+ <div data-expected-height="33" data-offset-y="0"></div>
+</div>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (123695 => 123696)
--- trunk/Source/WebCore/ChangeLog 2012-07-26 02:19:09 UTC (rev 123695)
+++ trunk/Source/WebCore/ChangeLog 2012-07-26 02:24:47 UTC (rev 123696)
@@ -1,3 +1,19 @@
+2012-07-25 Tony Chang <t...@chromium.org>
+
+ flexitems can overflow the flexbox due to rounding
+ https://bugs.webkit.org/show_bug.cgi?id=92163
+
+ Reviewed by Levi Weintraub.
+
+ Don't round flex item sizes and use LayoutPoint for the location of flex items.
+
+ Test: css3/flexbox/flex-rounding.html
+
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
+ (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
+ (WebCore::RenderFlexibleBox::layoutColumnReverse):
+
2012-07-25 Jonathan Dong <jonathan.d...@torchmobile.com.cn>
[BlackBerry] Integrate certmgr with CredentialBackingStore
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (123695 => 123696)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2012-07-26 02:19:09 UTC (rev 123695)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2012-07-26 02:24:47 UTC (rev 123696)
@@ -878,9 +878,9 @@
LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(child);
LayoutUnit childSize = preferredChildSize;
if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == PositiveFlexibility && isfinite(totalFlexGrow))
- childSize += static_cast<int>(lroundf(availableFreeSpace * child->style()->flexGrow() / totalFlexGrow));
+ childSize += availableFreeSpace * child->style()->flexGrow() / totalFlexGrow;
else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && isfinite(totalWeightedFlexShrink))
- childSize += static_cast<int>(lroundf(availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink));
+ childSize += availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink;
LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(child, childSize, flexboxAvailableContentExtent);
childSizes.append(adjustedChildSize);
@@ -1018,7 +1018,7 @@
mainAxisOffset += flowAwareMarginStartForChild(child);
LayoutUnit childMainExtent = mainAxisExtentForChild(child);
- IntPoint childLocation(shouldFlipMainAxis ? totalMainExtent - mainAxisOffset - childMainExtent : mainAxisOffset,
+ LayoutPoint childLocation(shouldFlipMainAxis ? totalMainExtent - mainAxisOffset - childMainExtent : mainAxisOffset,
crossAxisOffset + flowAwareMarginBeforeForChild(child));
// FIXME: Supporting layout deltas.
@@ -1061,7 +1061,7 @@
mainAxisOffset -= mainAxisExtentForChild(child) + flowAwareMarginEndForChild(child);
LayoutRect oldRect = child->frameRect();
- setFlowAwareLocationForChild(child, IntPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child)));
+ setFlowAwareLocationForChild(child, LayoutPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child)));
if (!selfNeedsLayout() && child->checkForRepaintDuringLayout())
child->repaintDuringLayoutIfMoved(oldRect);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes