Title: [149553] trunk
Revision
149553
Author
[email protected]
Date
2013-05-04 00:44:44 -0700 (Sat, 04 May 2013)

Log Message

REGRESSION(r140907): Incorrect baseline on cells after updating vertical-align
https://bugs.webkit.org/show_bug.cgi?id=115432

Reviewed by Julien Chaffraix.

Source/WebCore:

If a cell changes vertical-align any intrinsic padding it has is now redundant. It
needs to calculate its new height from RenderTableRow::layout() and then find its
new intrinsic padding in RenderTableSection::layoutRows().

Test: fast/table/correct-baseline-after-style-change.html

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::styleDidChange):

LayoutTests:

* fast/table/correct-baseline-after-style-change-expected.html: Added.
* fast/table/correct-baseline-after-style-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149552 => 149553)


--- trunk/LayoutTests/ChangeLog	2013-05-04 07:30:35 UTC (rev 149552)
+++ trunk/LayoutTests/ChangeLog	2013-05-04 07:44:44 UTC (rev 149553)
@@ -1,3 +1,13 @@
+2013-04-30  Robert Hogan  <[email protected]>
+
+        REGRESSION(r140907): Incorrect baseline on cells after updating vertical-align
+        https://bugs.webkit.org/show_bug.cgi?id=115432
+
+        Reviewed by Julien Chaffraix.
+
+        * fast/table/correct-baseline-after-style-change-expected.html: Added.
+        * fast/table/correct-baseline-after-style-change.html: Added.
+
 2013-05-03  Arnaud Renevier  <[email protected]>
 
         incorrect repainting when a table has a transform

Added: trunk/LayoutTests/fast/table/correct-baseline-after-style-change-expected.html (0 => 149553)


--- trunk/LayoutTests/fast/table/correct-baseline-after-style-change-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/correct-baseline-after-style-change-expected.html	2013-05-04 07:44:44 UTC (rev 149553)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            td {
+                border: 1px solid gray;
+                vertical-align: baseline;
+            }
+            input {
+                visibility: hidden;
+            }
+        </style>
+    </head>
+    <body>
+        <p>webkit.org/b/115432: There should be no extra space between the top of the text and the top of the table.</p>
+        <form>
+            <table>
+                <tr>
+                    <td>Text</td>
+                    <td>Text<br>Text<br>Text</td>
+                </tr>
+            </table>
+        </form>
+    </body>
+</html>
Property changes on: trunk/LayoutTests/fast/table/correct-baseline-after-style-change-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/table/correct-baseline-after-style-change.html (0 => 149553)


--- trunk/LayoutTests/fast/table/correct-baseline-after-style-change.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/correct-baseline-after-style-change.html	2013-05-04 07:44:44 UTC (rev 149553)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            td {
+                border: 1px solid gray;
+            }
+            input {
+                visibility: hidden;
+            }
+        </style>
+    </head>
+    <body>
+        <p>webkit.org/b/115432: There should be no extra space between the top of the text and the top of the table.</p>
+        <form>
+            <table>
+                <tr>
+                    <td>Text</td>
+                    <td>Text<br>Text<br>Text</td>
+                </tr>
+            </table>
+        </form>
+        <script>
+            var cells = document.getElementsByTagName("td");
+            // Ensure layout has run so that we properly invalidate.
+            cells[0].offsetLeft;
+            for (var i = 0; i < cells.length; ++i)
+                cells[i].style.verticalAlign = "baseline";
+            cells[0].offsetLeft;
+        </script>
+    </body>
+</html>
Property changes on: trunk/LayoutTests/fast/table/correct-baseline-after-style-change.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (149552 => 149553)


--- trunk/Source/WebCore/ChangeLog	2013-05-04 07:30:35 UTC (rev 149552)
+++ trunk/Source/WebCore/ChangeLog	2013-05-04 07:44:44 UTC (rev 149553)
@@ -1,3 +1,19 @@
+2013-04-30  Robert Hogan  <[email protected]>
+
+        REGRESSION(r140907): Incorrect baseline on cells after updating vertical-align
+        https://bugs.webkit.org/show_bug.cgi?id=115432
+
+        Reviewed by Julien Chaffraix.
+
+        If a cell changes vertical-align any intrinsic padding it has is now redundant. It
+        needs to calculate its new height from RenderTableRow::layout() and then find its
+        new intrinsic padding in RenderTableSection::layoutRows().
+
+        Test: fast/table/correct-baseline-after-style-change.html
+
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::styleDidChange):
+
 2013-05-03  Arnaud Renevier  <[email protected]>
 
         incorrect repainting when a table has a transform

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (149552 => 149553)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2013-05-04 07:30:35 UTC (rev 149552)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2013-05-04 07:44:44 UTC (rev 149553)
@@ -405,6 +405,11 @@
     if (parent() && section() && oldStyle && style()->height() != oldStyle->height())
         section()->rowLogicalHeightChanged(rowIndex());
 
+    // Our intrinsic padding pushes us down to align with the baseline of other cells on the row. If our vertical-align
+    // has changed then so will the padding needed to align with other cells - clear it so we can recalculate it from scratch.
+    if (oldStyle && style()->verticalAlign() != oldStyle->verticalAlign())
+        clearIntrinsicPadding();
+
     // If border was changed, notify table.
     if (parent()) {
         RenderTable* table = this->table();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to