- Revision
- 124793
- Author
- [email protected]
- Date
- 2012-08-06 12:17:20 -0700 (Mon, 06 Aug 2012)
Log Message
need tests to ensure flexboxes play nicely with box-sizing
https://bugs.webkit.org/show_bug.cgi?id=70771
Reviewed by Tony Chang.
Source/WebCore:
Anytime we grab the width/height off of the RenderStyle, we need to adjust
it for box-sizing. Fortunately, we only do this two places in RenderFlexibleBox.
Also, delete crossAxisLength since it's unused.
Test: css3/flexbox/box-sizing.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
* rendering/RenderFlexibleBox.h:
LayoutTests:
* css3/flexbox/box-sizing-expected.txt: Added.
* css3/flexbox/box-sizing.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (124792 => 124793)
--- trunk/LayoutTests/ChangeLog 2012-08-06 19:04:31 UTC (rev 124792)
+++ trunk/LayoutTests/ChangeLog 2012-08-06 19:17:20 UTC (rev 124793)
@@ -1,3 +1,13 @@
+2012-07-31 Ojan Vafai <[email protected]>
+
+ need tests to ensure flexboxes play nicely with box-sizing
+ https://bugs.webkit.org/show_bug.cgi?id=70771
+
+ Reviewed by Tony Chang.
+
+ * css3/flexbox/box-sizing-expected.txt: Added.
+ * css3/flexbox/box-sizing.html: Added.
+
2012-08-06 John J. Barton <[email protected]>
Web Inspector: WebInspector.linkifyStringAsFragment gives wrong typeof lineNumber
Added: trunk/LayoutTests/css3/flexbox/box-sizing-expected.txt (0 => 124793)
--- trunk/LayoutTests/css3/flexbox/box-sizing-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/flexbox/box-sizing-expected.txt 2012-08-06 19:17:20 UTC (rev 124793)
@@ -0,0 +1,31 @@
+All blue boxes are 100x100px with box-sizing: border-box and 2px border (4px border-top), we expect offsetWidth/Height to be 100x100
+flex-flow: default, orange box has width: 300px
+
+PASS
+flex-flow: default, orange box has width: 400px
+
+PASS
+flex-flow: default, orange box has width: auto
+
+PASS
+flex-flow: default, orange box has width: auto, flex-box has box-sizing: border-box
+
+PASS
+flex-flow: column, red box has height: 300px
+
+PASS
+flex-flow: column, red box has height: 400px
+
+PASS
+flex-flow: column, red box has height: auto
+
+PASS
+flex-box has box-sizing: border-box and flex-wrap: wrap;
+
+PASS
+flex-box has box-sizing: default and flex-wrap: wrap;
+
+PASS
+flex-flow: column, flex-box has box-sizing: border-box, flex items have flex: 1
+
+PASS
Property changes on: trunk/LayoutTests/css3/flexbox/box-sizing-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/css3/flexbox/box-sizing.html (0 => 124793)
--- trunk/LayoutTests/css3/flexbox/box-sizing.html (rev 0)
+++ trunk/LayoutTests/css3/flexbox/box-sizing.html 2012-08-06 19:17:20 UTC (rev 124793)
@@ -0,0 +1,104 @@
+
+<!DOCTYPE html>
+<html>
+<style>
+.flexbox {
+ display: -webkit-flex;
+ border: 2px solid orange;
+}
+.column {
+ -webkit-flex-flow: column;
+}
+.h3 {
+ height: 300px;
+}
+.w3 {
+ width: 300px;
+}
+.h4 {
+ height: 400px;
+}
+.w4 {
+ width: 400px;
+}
+.border-box, .flexbox > div {
+ box-sizing: border-box;
+ height: 100px;
+ width: 100px;
+ border: 2px solid lightblue;
+ border-top-width: 4px;
+ padding: 3px;
+}
+</style>
+<script src=""
+<body _onload_="checkLayout('.flexbox')">
+
+All blue boxes are 100x100px with box-sizing: border-box and 2px border (4px border-top), we expect offsetWidth/Height to be <b>100x100</b>
+
+<h3>flex-flow: default, orange box has width: 300px</h3>
+<div class="flexbox" style="width: 300px">
+ <div></div><div></div><div></div>
+</div>
+
+<h3>flex-flow: default, orange box has width: 400px</h3>
+<div class="flexbox" style="width: 400px">
+ <div></div><div></div><div></div>
+</div>
+
+<h3>flex-flow: default, orange box has width: auto</h3>
+<div class="flexbox">
+ <div></div><div></div><div></div>
+</div>
+
+<h3>flex-flow: default, orange box has width: auto, flex-box has box-sizing: border-box</h3>
+<div class="flexbox border-box">
+ <div></div><div></div><div></div>
+</div>
+
+<h3>flex-flow: column, red box has height: 300px</h3>
+<div class="flexbox column" style="height: 300px">
+ <div></div><div></div><div></div>
+</div>
+
+<h3>flex-flow: column, red box has height: 400px</h3>
+<div class="flexbox column" style="height: 400px">
+ <div></div><div></div><div></div>
+</div>
+
+<h3>flex-flow: column, red box has height: auto</h3>
+<div class="flexbox column">
+ <div></div><div></div><div></div>
+</div>
+
+<h3>flex-box has box-sizing: border-box and flex-wrap: wrap;</h3>
+<div class="flexbox column" style="box-sizing: border-box; border: 2px solid lightblue; padding: 3px; height: 200px; width: 100px; -webkit-flex-wrap: wrap; position: relative" data-expected-width=100 data-expected-height=200>
+ <div data-offset-x=3></div><div data-offset-x=103></div><div data-offset-x=203></div>
+</div>
+
+<h3>flex-box has box-sizing: default and flex-wrap: wrap;</h3>
+<div class="flexbox column" style="border: 2px solid lightblue; padding: 3px; height: 200px; width: 100px; -webkit-flex-wrap: wrap; position: relative" data-expected-width=110 data-expected-height=210>
+ <div data-offset-x=3></div><div data-offset-x=3></div><div data-offset-x=103></div>
+</div>
+
+<h3>flex-flow: column, flex-box has box-sizing: border-box, flex items have flex: 1</h3>
+<div class="flexbox column" style="box-sizing: border-box; border: 2px solid lightblue; padding: 3px; height: 343px; width: 100px;" data-expected-width=100 data-expected-height=343>
+ <div style="-webkit-flex: 1" data-expected-height=111></div>
+ <div style="-webkit-flex: 1" data-expected-height=111></div>
+ <div style="-webkit-flex: 1" data-expected-height=111></div>
+</div>
+
+<script>
+ function addExpectedSizes(flexItem) {
+ if (!flexItem.hasAttribute('data-expected-height'))
+ flexItem.setAttribute('data-expected-height', 100);
+ if (!flexItem.hasAttribute('data-expected-width'))
+ flexItem.setAttribute('data-expected-width', 100);
+ }
+ [].forEach.call(document.querySelectorAll(".flexbox > div"), addExpectedSizes);
+ [].forEach.call(document.querySelectorAll(".border-box"), addExpectedSizes);
+
+ if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+</body>
+</html>
Property changes on: trunk/LayoutTests/css3/flexbox/box-sizing.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (124792 => 124793)
--- trunk/Source/WebCore/ChangeLog 2012-08-06 19:04:31 UTC (rev 124792)
+++ trunk/Source/WebCore/ChangeLog 2012-08-06 19:17:20 UTC (rev 124793)
@@ -1,3 +1,20 @@
+2012-07-31 Ojan Vafai <[email protected]>
+
+ need tests to ensure flexboxes play nicely with box-sizing
+ https://bugs.webkit.org/show_bug.cgi?id=70771
+
+ Reviewed by Tony Chang.
+
+ Anytime we grab the width/height off of the RenderStyle, we need to adjust
+ it for box-sizing. Fortunately, we only do this two places in RenderFlexibleBox.
+ Also, delete crossAxisLength since it's unused.
+
+ Test: css3/flexbox/box-sizing.html
+
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
+ * rendering/RenderFlexibleBox.h:
+
2012-08-06 John J. Barton <[email protected]>
Web Inspector: WebInspector.linkifyStringAsFragment gives wrong typeof lineNumber
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (124792 => 124793)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2012-08-06 19:04:31 UTC (rev 124792)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2012-08-06 19:17:20 UTC (rev 124793)
@@ -360,11 +360,6 @@
return flexLength;
}
-Length RenderFlexibleBox::crossAxisLength() const
-{
- return isHorizontalFlow() ? style()->height() : style()->width();
-}
-
void RenderFlexibleBox::setCrossAxisExtent(LayoutUnit extent)
{
if (isHorizontalFlow())
@@ -410,7 +405,7 @@
LayoutUnit heightIncludingScrollbar = computeContentLogicalHeightUsing(heightType, height);
if (heightIncludingScrollbar == -1)
return -1;
- return std::max(LayoutUnit(0), heightIncludingScrollbar - scrollbarLogicalHeight());
+ return std::max(LayoutUnit(0), computeContentBoxLogicalHeight(heightIncludingScrollbar) - scrollbarLogicalHeight());
}
WritingMode RenderFlexibleBox::transformedWritingMode() const
@@ -609,7 +604,9 @@
LayoutUnit mainAxisExtent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->maxPreferredLogicalWidth();
return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child);
}
- return std::max(LayoutUnit(0), minimumValueForLength(flexBasis, mainAxisContentExtent(), view()));
+ LayoutUnit extent = minimumValueForLength(flexBasis, mainAxisContentExtent(), view());
+ extent = isColumnFlow() ? child->computeContentBoxLogicalHeight(extent) : child->computeContentBoxLogicalWidth(extent);
+ return std::max(LayoutUnit(0), extent);
}
LayoutUnit RenderFlexibleBox::computeAvailableFreeSpace(LayoutUnit preferredMainAxisExtent)
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (124792 => 124793)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2012-08-06 19:04:31 UTC (rev 124792)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2012-08-06 19:17:20 UTC (rev 124793)
@@ -77,7 +77,6 @@
bool isColumnFlow() const;
bool isLeftToRightFlow() const;
bool isMultiline() const;
- Length crossAxisLength() const;
Length flexBasisForChild(RenderBox* child) const;
void setCrossAxisExtent(LayoutUnit);
LayoutUnit crossAxisExtentForChild(RenderBox* child);