Title: [91533] trunk
Revision
91533
Author
[email protected]
Date
2011-07-21 17:14:42 -0700 (Thu, 21 Jul 2011)

Log Message

Source/WebCore: Fix for bug 64046 - Wrong image height in absolutely positioned div in
relatively positioned parent with bottom padding.
https://bugs.webkit.org/show_bug.cgi?id=64046

Patch by Kulanthaivel Palanichamy <[email protected]> on 2011-07-21
Reviewed by David Hyatt.

Test: fast/css/absolute-child-with-percent-height-inside-relative-parent.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::availableLogicalHeightUsing):

LayoutTests: Test to cover absolutely positioned child with percentage height
in relatively positioned parent with bottom padding.
https://bugs.webkit.org/show_bug.cgi?id=64046

Patch by Kulanthaivel Palanichamy <[email protected]> on 2011-07-21
Reviewed by David Hyatt.

* fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.txt: Added.
* fast/css/absolute-child-with-percent-height-inside-relative-parent.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91532 => 91533)


--- trunk/LayoutTests/ChangeLog	2011-07-22 00:00:47 UTC (rev 91532)
+++ trunk/LayoutTests/ChangeLog	2011-07-22 00:14:42 UTC (rev 91533)
@@ -1,3 +1,14 @@
+2011-07-21  Kulanthaivel Palanichamy  <[email protected]>
+
+        Test to cover absolutely positioned child with percentage height
+        in relatively positioned parent with bottom padding.
+        https://bugs.webkit.org/show_bug.cgi?id=64046
+
+        Reviewed by David Hyatt.
+
+        * fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.txt: Added.
+        * fast/css/absolute-child-with-percent-height-inside-relative-parent.html: Added.
+
 2011-07-21  Gavin Peters  <[email protected]>
 
         Extend the protector of a CSS style sheet.  Because checkLoaded() can recursively delete

Added: trunk/LayoutTests/fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.txt (0 => 91533)


--- trunk/LayoutTests/fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/absolute-child-with-percent-height-inside-relative-parent-expected.txt	2011-07-22 00:14:42 UTC (rev 91533)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 0x0
+layer at (87,8) size 627x230
+  RenderBlock (relative positioned) {DIV} at (79,0) size 627x230 [bgcolor=#0000FF]
+layer at (87,8) size 501x230
+  RenderBlock (positioned) {DIV} at (0,0) size 501x230 [bgcolor=#FF0000]
+    RenderImage {IMG} at (51,0) size 400x230
+    RenderText {#text} at (0,0) size 0x0

Added: trunk/LayoutTests/fast/css/absolute-child-with-percent-height-inside-relative-parent.html (0 => 91533)


--- trunk/LayoutTests/fast/css/absolute-child-with-percent-height-inside-relative-parent.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/absolute-child-with-percent-height-inside-relative-parent.html	2011-07-22 00:14:42 UTC (rev 91533)
@@ -0,0 +1,20 @@
+<html>
+<head>
+    <style type="text/css">
+        body {text-align:center;}
+        body * {
+            width: 80%;
+            display: inline-block;
+        }
+        body > div {background: blue;}
+        body > div > div {background: red;}
+    </style>
+	</head>
+	<body>
+		<div style="height:30px;position:relative;padding-bottom:200px;">
+			<div style="height: 100%;position:absolute;">
+				<img src="" style="height: 100%;">
+			</div>
+		</div>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (91532 => 91533)


--- trunk/Source/WebCore/ChangeLog	2011-07-22 00:00:47 UTC (rev 91532)
+++ trunk/Source/WebCore/ChangeLog	2011-07-22 00:14:42 UTC (rev 91533)
@@ -1,3 +1,16 @@
+2011-07-21  Kulanthaivel Palanichamy  <[email protected]>
+
+        Fix for bug 64046 - Wrong image height in absolutely positioned div in
+        relatively positioned parent with bottom padding.
+        https://bugs.webkit.org/show_bug.cgi?id=64046
+
+        Reviewed by David Hyatt.
+
+        Test: fast/css/absolute-child-with-percent-height-inside-relative-parent.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::availableLogicalHeightUsing):
+
 2011-07-21  Gavin Peters  <[email protected]>
 
         Extend the protector of a CSS style sheet.  Because checkLoaded() can recursively delete

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (91532 => 91533)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-07-22 00:00:47 UTC (rev 91532)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-07-22 00:14:42 UTC (rev 91533)
@@ -2055,8 +2055,17 @@
     if (isTableCell() && (h.isAuto() || h.isPercent()))
         return overrideHeight() - borderAndPaddingLogicalWidth();
 
-    if (h.isPercent())
-       return computeContentBoxLogicalHeight(h.calcValue(containingBlock()->availableLogicalHeight()));
+    if (h.isPercent()) {
+        LayoutUnit availableHeight;
+        // https://bugs.webkit.org/show_bug.cgi?id=64046
+        // For absolutely positioned elements whose containing block is based on a block-level element,
+        // the percentage is calculated with respect to the height of the padding box of that element
+        if (isPositioned())
+            availableHeight = containingBlockLogicalHeightForPositioned(containingBlock());
+        else
+            availableHeight = containingBlock()->availableLogicalHeight();
+        return computeContentBoxLogicalHeight(h.calcValue(availableHeight));
+    }
 
     // FIXME: We can't just check top/bottom here.
     // https://bugs.webkit.org/show_bug.cgi?id=46500
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to