Title: [123031] trunk
Revision
123031
Author
commit-qu...@webkit.org
Date
2012-07-18 15:28:21 -0700 (Wed, 18 Jul 2012)

Log Message

Content size of child having percent height inside a fixed height container having overflow:auto is wrongly calculated
https://bugs.webkit.org/show_bug.cgi?id=11355

Patch by Pravin D <pravind....@gmail.com> on 2012-07-18
Reviewed by Julien Chaffraix.

Source/WebCore:

The content height of a child must be container height minus padding, border width and height of horizontal scrollbar(if any).

Tests: fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html
       fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
Subtracting the height of the scrollbar from the client height when the client has percentage height.

LayoutTests:

* fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt: Added.
* fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html: Added.
* fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt: Added.
* fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123030 => 123031)


--- trunk/LayoutTests/ChangeLog	2012-07-18 22:22:58 UTC (rev 123030)
+++ trunk/LayoutTests/ChangeLog	2012-07-18 22:28:21 UTC (rev 123031)
@@ -1,3 +1,15 @@
+2012-07-18  Pravin D  <pravind....@gmail.com>
+
+        Content size of child having percent height inside a fixed height container having overflow:auto is wrongly calculated
+        https://bugs.webkit.org/show_bug.cgi?id=11355
+
+        Reviewed by Julien Chaffraix.
+
+        * fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt: Added.
+        * fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html: Added.
+        * fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt: Added.
+        * fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html: Added.
+
 2012-07-18  Filip Pizlo  <fpi...@apple.com>
 
         DFG 32-bit PutById transition stub storage reallocation case copies the first pointer of each JSValue instead of the whole JSValue

Added: trunk/LayoutTests/fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt (0 => 123031)


--- trunk/LayoutTests/fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt	2012-07-18 22:28:21 UTC (rev 123031)
@@ -0,0 +1,14 @@
+Testcase for bug https://bugs.webkit.org/show_bug.cgi?id=11355. When a container having overflow:auto has a horizontal scrollbar, the scrollbar is to be placed between the inner border edge and the outer padding edge. Thus the content height of a child inside the container must not include the height of the horizontal scollbars.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+The height of the inner element box should be 100% of the containers height minus the height of horizontal scrollbar. There should be no vertical scrollable content in the container
+
+PASS document.getElementById("container").scrollHeight == document.getElementById("container").clientHeight is true
+Container height = Inner Box height + scrollbar height
+PASS document.getElementById("container").offsetHeight > document.getElementById("innerBox").offsetHeight is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html (0 => 123031)


--- trunk/LayoutTests/fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html	                        (rev 0)
+++ trunk/LayoutTests/fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html	2012-07-18 22:28:21 UTC (rev 123031)
@@ -0,0 +1,37 @@
+<html>
+<head>
+<style type="text/css">
+#container {
+	width: 200px;
+	height: 100px;
+	overflow: auto; 
+}
+#innerBox {
+	width: 200%;
+	height: 100%;
+}
+</style>
+<script src=""
+</head>
+<body>
+<div id="container">
+	<div id="innerBox" style="background:green"></div>
+</div>
+<script>
+description('Testcase for bug <a href="" \
+When a container having overflow:auto has a horizontal scrollbar, \
+the scrollbar is to be placed between the inner border edge and the outer padding edge. \
+Thus the content height of a child inside the container must not include the height of the horizontal scollbars.');
+
+debug('The height of the inner element box should be 100% of the containers height minus the height of horizontal scrollbar. \
+There should be no vertical scrollable content in the container<br>');
+shouldBeTrue('document.getElementById("container").scrollHeight == document.getElementById("container").clientHeight');
+debug('Container height = Inner Box height + scrollbar height');
+shouldBeTrue('document.getElementById("container").offsetHeight > document.getElementById("innerBox").offsetHeight');
+document.body.removeChild(document.getElementById('container'));
+</script>
+<div id="description"></div>
+<div id="console"></div>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt (0 => 123031)


--- trunk/LayoutTests/fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto-expected.txt	2012-07-18 22:28:21 UTC (rev 123031)
@@ -0,0 +1,14 @@
+Testcase for bug https://bugs.webkit.org/show_bug.cgi?id=11355. When a container having overflow:auto has a horizontal scrollbar, the scrollbar is to be placed between the inner border edge and the outer padding edge. Thus the content height of a replaced child inside the container must not include the height of the horizontal scollbars.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+The height of the inner element box should be 100% of the containers height minus the height of horizontal scrollbar. There should be no vertical scrollable content in the container
+
+PASS document.getElementById("container").scrollHeight == document.getElementById("container").clientHeight is true
+Container height = Inner replaced element height + scrollbar height
+PASS document.getElementById("container").offsetHeight > document.getElementById("replacedElement").offsetHeight is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html (0 => 123031)


--- trunk/LayoutTests/fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html	                        (rev 0)
+++ trunk/LayoutTests/fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html	2012-07-18 22:28:21 UTC (rev 123031)
@@ -0,0 +1,37 @@
+<html>
+<head>
+<style type="text/css">
+#container {
+	width: 200px;
+	height: 100px;
+	overflow: auto; 
+}
+#replacedElement {
+	width: 200%;
+	height: 100%;
+}
+</style>
+<script src=""
+</head>
+<body>
+<div id="container">
+	<img id="replacedElement" style="background:green"/>
+</div>
+<script>
+description('Testcase for bug <a href="" \
+When a container having overflow:auto has a horizontal scrollbar, \
+the scrollbar is to be placed between the inner border edge and the outer padding edge. \
+Thus the content height of a replaced child inside the container must not include the height of the horizontal scollbars.');
+
+debug('The height of the inner element box should be 100% of the containers height minus the height of horizontal scrollbar. \
+There should be no vertical scrollable content in the container<br>');
+shouldBeTrue('document.getElementById("container").scrollHeight == document.getElementById("container").clientHeight');
+debug('Container height = Inner replaced element height + scrollbar height');
+shouldBeTrue('document.getElementById("container").offsetHeight > document.getElementById("replacedElement").offsetHeight');
+document.body.removeChild(document.getElementById('container'));
+</script>
+<div id="description"></div>
+<div id="console"></div>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (123030 => 123031)


--- trunk/Source/WebCore/ChangeLog	2012-07-18 22:22:58 UTC (rev 123030)
+++ trunk/Source/WebCore/ChangeLog	2012-07-18 22:28:21 UTC (rev 123031)
@@ -1,3 +1,20 @@
+2012-07-18  Pravin D  <pravind....@gmail.com>
+
+        Content size of child having percent height inside a fixed height container having overflow:auto is wrongly calculated
+        https://bugs.webkit.org/show_bug.cgi?id=11355
+
+        Reviewed by Julien Chaffraix.
+
+        The content height of a child must be container height minus padding, border width and height of horizontal scrollbar(if any).
+
+        Tests: fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html
+               fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+        Subtracting the height of the scrollbar from the client height when the client has percentage height.
+
 2012-07-18  Anantanarayanan G Iyengar  <ana...@chromium.org>
 
         [chromium] Ensure that the compositor code which is aware of flipped status of video-textures

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (123030 => 123031)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-07-18 22:22:58 UTC (rev 123030)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-07-18 22:28:21 UTC (rev 123031)
@@ -2123,12 +2123,11 @@
             result = cb->overrideLogicalContentHeight();
             includeBorderPadding = true;
         }
-    }
-    // Otherwise we only use our percentage height if our containing block had a specified
-    // height.
-    else if (cbstyle->logicalHeight().isFixed())
-        result = cb->computeContentBoxLogicalHeight(cbstyle->logicalHeight().value());
-    else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) {
+    } else if (cbstyle->logicalHeight().isFixed()) {
+        // Otherwise we only use our percentage height if our containing block had a specified height.
+        LayoutUnit contentBoxHeightWithScrollbar = cb->computeContentBoxLogicalHeight(cbstyle->logicalHeight().value());
+        result = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
+    } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) {
         // We need to recur and compute the percentage height for our containing block.
         result = cb->computePercentageLogicalHeight(cbstyle->logicalHeight());
         if (result != -1)
@@ -2265,7 +2264,10 @@
                     cb = cb->containingBlock();
                 }
             }
-            return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight));
+            availableHeight = computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight));
+            if (cb->style()->logicalHeight().isFixed())
+                availableHeight = max<LayoutUnit>(0, availableHeight - toRenderBox(cb)->scrollbarLogicalHeight());
+            return availableHeight;
         }
         case ViewportPercentageWidth:
         case ViewportPercentageHeight:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to