2010-04-30 Yoshiki Hayashi <yhayashi@google.com>
authorhamaji@chromium.org <hamaji@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 May 2010 07:07:03 +0000 (07:07 +0000)
committerhamaji@chromium.org <hamaji@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 May 2010 07:07:03 +0000 (07:07 +0000)
        Reviewed by Shinichiro Hamaji.

        https://bugs.webkit.org/show_bug.cgi?id=38249

        Fixes an issue where border height and padding height are ignored when computing vertically shrinking flexbox's height.

        * fast/flexbox/child-flexing-expected.txt: Added.
        * fast/flexbox/child-flexing.html: Added.
2010-04-30  Yoshiki Hayashi  <yhayashi@google.com>

        Reviewed by Shinichiro Hamaji.

        https://bugs.webkit.org/show_bug.cgi?id=38249

        Fixes an issue where border height and padding height are ignored when computing vertically shrinking flexbox's height.

        Test: fast/flexbox/child-flexing.html

        * rendering/RenderFlexibleBox.cpp:
        (WebCore::RenderFlexibleBox::allowedChildFlex):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@58630 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/flexbox/child-flexing-expected.txt [new file with mode: 0644]
LayoutTests/fast/flexbox/child-flexing.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderFlexibleBox.cpp

index e5fcd95..71fceea 100644 (file)
@@ -1,3 +1,14 @@
+2010-04-30  Yoshiki Hayashi  <yhayashi@google.com>
+
+        Reviewed by Shinichiro Hamaji.
+
+        https://bugs.webkit.org/show_bug.cgi?id=38249
+        
+        Fixes an issue where border height and padding height are ignored when computing vertically shrinking flexbox's height.
+
+        * fast/flexbox/child-flexing-expected.txt: Added.
+        * fast/flexbox/child-flexing.html: Added.
+
 2010-04-30  Shinichiro Hamaji  <hamaji@chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/flexbox/child-flexing-expected.txt b/LayoutTests/fast/flexbox/child-flexing-expected.txt
new file mode 100644 (file)
index 0000000..0c68a39
--- /dev/null
@@ -0,0 +1,21 @@
+Check if box-flex specified flexboxes expand or shrink correctly. If you see any scrollbars, then the test has failed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+vertically expanding
+PASS element.scrollHeight is 100
+PASS element.scrollWidth is 100
+vertically shrinking
+PASS element.scrollHeight is 100
+PASS element.scrollWidth is 100
+horizontally expanding
+PASS element.scrollHeight is 100
+PASS element.scrollWidth is 100
+horizontally shrinking
+PASS element.scrollHeight is 100
+PASS element.scrollWidth is 100
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/flexbox/child-flexing.html b/LayoutTests/fast/flexbox/child-flexing.html
new file mode 100644 (file)
index 0000000..050e73a
--- /dev/null
@@ -0,0 +1,146 @@
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+<style>
+div.box {
+  display: -moz-box;
+  display: -khtml-box;
+  display: box;
+}
+
+div.outer {
+  width: 100px;
+  height: 100px;
+  background-color: red;
+  -moz-box-align: top;
+  -khtml-box-align: top;
+  position: relative;
+  overflow: auto;
+}
+
+div.vertical {
+  -moz-box-orient: vertical;
+  -khtml-box-orient: vertical;
+  box-orient: vertical;
+}
+
+div.horizontal {
+  -moz-box-orient: horizontal;
+  -khtml-box-orient: horizontal;
+  box-orient: horizontal;
+}
+
+div.verticalMiddle {
+  width: 100px;
+  height: 90px;
+  background-color: black;
+}
+
+div.expandVerticalBottom {
+  width: 10px;
+  height: 5px;
+  background-color: black;
+  -moz-box-flex: 1;
+  -webkit-box-flex: 1;
+  box-flex: 1;
+  border-left: 60px solid olive;
+  border-top: 2px solid blue;
+  padding-right: 30px;
+  padding-bottom: 2px;
+}
+
+div.shrinkVerticalBottom {
+  width: 10px;
+  height: 20px;
+  background-color: black;
+  -moz-box-flex: 1;
+  -webkit-box-flex: 1;
+  box-flex: 1;
+  border-left: 60px solid olive;
+  border-top: 2px solid blue;
+  padding-right: 30px;
+  padding-bottom: 2px;
+}
+
+div.horizontalMiddle {
+  width: 90px;
+  height: 100px;
+  background-color: black;
+}
+
+div.expandHorizontalRight {
+  width: 5px;
+  height: 10px;
+  background-color: black;
+  -moz-box-flex: 1;
+  -webkit-box-flex: 1;
+  box-flex: 1;
+  border-left: 2px solid olive;
+  border-top: 60px solid blue;
+  padding-right: 2px;
+  padding-bottom: 30px;
+}
+
+div.shrinkHorizontalRight {
+  width: 20px;
+  height: 10px;
+  background-color: black;
+  -moz-box-flex: 1;
+  -webkit-box-flex: 1;
+  box-flex: 1;
+  border-left: 2px solid olive;
+  border-top: 60px solid blue;
+  padding-right: 2px;
+  padding-bottom: 30px;
+}
+</style>
+</head>
+<body>
+<div class="box vertical outer" id="expandVertical">
+  <div class="verticalMiddle"></div>
+  <div class="expandVerticalBottom"></div>
+</div>
+<div class="box vertical outer" id="shrinkVertical">
+  <div class="verticalMiddle"></div>
+  <div class="shrinkVerticalBottom"></div>
+</div>
+<div class="box horizontal outer" id="expandHorizontal">
+  <div class="horizontalMiddle"></div>
+  <div class="expandHorizontalRight"></div>
+</div>
+<div class="box horizontal outer" id="shrinkHorizontal">
+  <div class="horizontalMiddle"></div>
+  <div class="shrinkHorizontalRight"></div>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Check if box-flex specified flexboxes expand or shrink correctly. If you see any scrollbars, then the test has failed.");
+
+var element = null;
+
+debug("vertically expanding");
+element = document.getElementById("expandVertical");
+shouldBe("element.scrollHeight", "100");
+shouldBe("element.scrollWidth", "100");
+
+debug("vertically shrinking");
+element = document.getElementById("shrinkVertical");
+shouldBe("element.scrollHeight", "100");
+shouldBe("element.scrollWidth", "100");
+
+debug("horizontally expanding");
+element = document.getElementById("expandHorizontal");
+shouldBe("element.scrollHeight", "100");
+shouldBe("element.scrollWidth", "100");
+
+debug("horizontally shrinking");
+element = document.getElementById("shrinkHorizontal");
+shouldBe("element.scrollHeight", "100");
+shouldBe("element.scrollWidth", "100");
+
+successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
index 9b54c0c..dba7ace 100644 (file)
@@ -1,3 +1,16 @@
+2010-04-30  Yoshiki Hayashi  <yhayashi@google.com>
+
+        Reviewed by Shinichiro Hamaji.
+
+        https://bugs.webkit.org/show_bug.cgi?id=38249
+        
+        Fixes an issue where border height and padding height are ignored when computing vertically shrinking flexbox's height.
+
+        Test: fast/flexbox/child-flexing.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::allowedChildFlex):
+
 2010-04-30  Shinichiro Hamaji  <hamaji@chromium.org>
 
         Reviewed by Darin Adler.
index abc0532..238b16d 100644 (file)
@@ -1059,7 +1059,7 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign
     } else {
         if (child->style()->minHeight().isFixed()) {
             int minH = child->style()->minHeight().value();
-            int h = child->overrideHeight() - (child->borderLeft() + child->borderRight() + child->paddingLeft() + child->paddingRight());
+            int h = child->overrideHeight() - child->borderAndPaddingHeight();
             int allowedShrinkage = min(0, minH - h);
             return allowedShrinkage;
         }