Title: [117633] trunk
Revision
117633
Author
[email protected]
Date
2012-05-18 14:42:31 -0700 (Fri, 18 May 2012)

Log Message

Percentage height replaced elements sometimes cause overflow of table contents
https://bugs.webkit.org/show_bug.cgi?id=85581

Patch by Terry Anderson <[email protected]> on 2012-05-18
Reviewed by Eric Seidel.

Source/WebCore:

Test: fast/replaced/table-replaced-element.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
This change guarantees that the containing block of a replaced element with percentage
height will be marked as having a percentage height descendant.

LayoutTests:

* fast/replaced/table-replaced-element-expected.txt: Added.
* fast/replaced/table-replaced-element.html: Added.
New layout test.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117632 => 117633)


--- trunk/LayoutTests/ChangeLog	2012-05-18 21:39:54 UTC (rev 117632)
+++ trunk/LayoutTests/ChangeLog	2012-05-18 21:42:31 UTC (rev 117633)
@@ -1,3 +1,14 @@
+2012-05-18  Terry Anderson  <[email protected]>
+
+        Percentage height replaced elements sometimes cause overflow of table contents
+        https://bugs.webkit.org/show_bug.cgi?id=85581
+
+        Reviewed by Eric Seidel.
+
+        * fast/replaced/table-replaced-element-expected.txt: Added.
+        * fast/replaced/table-replaced-element.html: Added.
+        New layout test.
+
 2012-05-18  Tony Chang  <[email protected]>
 
         Unreviewed, fixing mac baselines after r117613.

Added: trunk/LayoutTests/fast/replaced/table-replaced-element-expected.txt (0 => 117633)


--- trunk/LayoutTests/fast/replaced/table-replaced-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/replaced/table-replaced-element-expected.txt	2012-05-18 21:42:31 UTC (rev 117633)
@@ -0,0 +1,9 @@
+
+Layout test for WebKit bug 85581.
+
+This tests that the contents of a table do not overflow when the table contains an image with percentage height. For this test to pass, the blue rectangle should be entirely within the table border and/or you should see a 'PASS' message below.
+
+Height of table: 306
+Height of table contents: 280
+PASS: Table contents do not overflow outside of table border.
+

Added: trunk/LayoutTests/fast/replaced/table-replaced-element.html (0 => 117633)


--- trunk/LayoutTests/fast/replaced/table-replaced-element.html	                        (rev 0)
+++ trunk/LayoutTests/fast/replaced/table-replaced-element.html	2012-05-18 21:42:31 UTC (rev 117633)
@@ -0,0 +1,56 @@
+<html>
+<head>
+<title>Layout test for WebKit bug 85581</title>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function log(message)
+{
+    var console = document.getElementById('console');
+    console.appendChild(document.createTextNode(message));
+    console.appendChild(document.createElement('br'));
+}
+
+function runTest()
+{
+    var tableHeight = document.getElementById('table').offsetHeight;
+    var div1Height = parseInt(document.getElementById('div1').style.height);
+    var div2Height = parseInt(document.getElementById('div2').style.height);
+    var imageHeight = document.getElementById('image').height;
+    var contentsHeight = div1Height + div2Height + imageHeight;
+
+    log("Height of table: " + tableHeight);
+    log("Height of table contents: " + contentsHeight);
+    if (contentsHeight < tableHeight)
+        log("PASS: Table contents do not overflow outside of table border.");
+    else
+        log("FAIL: Table contents overflow outside of table border.");
+
+}
+</script>
+
+</head>
+<body _onload_="runTest()">
+
+<table id="table" style="width: 100%;" border="1">
+  <tr>
+    <td style="vertical-align: top;">
+      <div>
+        <p>
+          <div id="div1" style="height: 200px; width: 100%;"></div>
+          <img id="image" src="" style="height: 60%;">
+          <div id="div2" style="height: 20px; width: 100%;"></div>
+        </p>
+      </div>
+    </td>
+  </tr>
+</table>
+
+<p> Layout test for <a href="" bug 85581</a>.  </p>
+<p> This tests that the contents of a table do not overflow when the table contains an image with percentage height. For this test to pass, the blue rectangle should be entirely within the table border and/or you should see a 'PASS' message below. </p>
+<p id="console"></p>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (117632 => 117633)


--- trunk/Source/WebCore/ChangeLog	2012-05-18 21:39:54 UTC (rev 117632)
+++ trunk/Source/WebCore/ChangeLog	2012-05-18 21:42:31 UTC (rev 117633)
@@ -1,3 +1,17 @@
+2012-05-18  Terry Anderson  <[email protected]>
+
+        Percentage height replaced elements sometimes cause overflow of table contents
+        https://bugs.webkit.org/show_bug.cgi?id=85581
+
+        Reviewed by Eric Seidel.
+
+        Test: fast/replaced/table-replaced-element.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+        This change guarantees that the containing block of a replaced element with percentage
+        height will be marked as having a percentage height descendant.
+
 2012-05-18  Viatcheslav Ostapenko  <[email protected]>
 
         [Qt] REGRESSION(r117501): It made almost all tests assert in debug mode

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (117632 => 117633)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-05-18 21:39:54 UTC (rev 117632)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-05-18 21:42:31 UTC (rev 117633)
@@ -2324,8 +2324,8 @@
                         availableHeight = max(availableHeight, intrinsicLogicalHeight());
                         return valueForLength(logicalHeight, availableHeight - borderAndPaddingLogicalHeight());
                     }
+                    toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderBox*>(this));
                     cb = cb->containingBlock();
-                    toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderBox*>(this));
                 }
             }
             return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to