Title: [143377] trunk
Revision
143377
Author
t...@chromium.org
Date
2013-02-19 13:18:00 -0800 (Tue, 19 Feb 2013)

Log Message

Border changes on tables with collapsed borders doesn't relayout table cells
https://bugs.webkit.org/show_bug.cgi?id=109774

Reviewed by David Hyatt.

Source/WebCore:

Test: fast/table/border-collapsing/dynamic-border-width-change.html

Changes to border top and border bottom on table rows also changes the size
of the table cell causing a relayout to be needed.

* rendering/RenderTableRow.cpp:
(WebCore::borderWidthChanged): Also include border top and bottom.
(WebCore::RenderTableRow::styleDidChange): Remove logical from the helper function name.

LayoutTests:

* fast/table/border-collapsing/dynamic-border-width-change-expected.txt: Added.
* fast/table/border-collapsing/dynamic-border-width-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143376 => 143377)


--- trunk/LayoutTests/ChangeLog	2013-02-19 20:56:14 UTC (rev 143376)
+++ trunk/LayoutTests/ChangeLog	2013-02-19 21:18:00 UTC (rev 143377)
@@ -1,3 +1,13 @@
+2013-02-19  Tony Chang  <t...@chromium.org>
+
+        Border changes on tables with collapsed borders doesn't relayout table cells
+        https://bugs.webkit.org/show_bug.cgi?id=109774
+
+        Reviewed by David Hyatt.
+
+        * fast/table/border-collapsing/dynamic-border-width-change-expected.txt: Added.
+        * fast/table/border-collapsing/dynamic-border-width-change.html: Added.
+
 2013-02-19  Simon Fraser  <simon.fra...@apple.com>
 
         Add a test result missed in r143074.

Added: trunk/LayoutTests/fast/table/border-collapsing/dynamic-border-width-change-expected.txt (0 => 143377)


--- trunk/LayoutTests/fast/table/border-collapsing/dynamic-border-width-change-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/table/border-collapsing/dynamic-border-width-change-expected.txt	2013-02-19 21:18:00 UTC (rev 143377)
@@ -0,0 +1,3 @@
+This test passes if no red is showing.
+
+PASS

Added: trunk/LayoutTests/fast/table/border-collapsing/dynamic-border-width-change.html (0 => 143377)


--- trunk/LayoutTests/fast/table/border-collapsing/dynamic-border-width-change.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/border-collapsing/dynamic-border-width-change.html	2013-02-19 21:18:00 UTC (rev 143377)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+table {
+    border-collapse:collapse;
+    width: 100px;
+}
+td {
+    background-color: red;
+    width: 100%;
+    padding-top: 0;
+    padding-bottom: 0;
+}
+</style>
+<script src=""
+<script>
+window._onload_ = function()
+{
+    document.body.offsetLeft;
+    document.getElementById("row1").style.borderTop = "50px solid green";
+    document.getElementById("row2").style.borderBottom = "50px solid green";
+    checkLayout("#container");
+}
+</script>
+</head>
+<body>
+<p>This test passes if no red is showing.</p>
+
+<div id="container">
+<table data-expected-height="50">
+<tr id="row1" data-expected-height="25">
+  <td data-expected-height="25"></td>
+</tr>
+</table>
+
+<table data-expected-height="50">
+<tr id="row2" data-expected-height="25">
+  <td data-expected-height="25"></td>
+</tr>
+</table>
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (143376 => 143377)


--- trunk/Source/WebCore/ChangeLog	2013-02-19 20:56:14 UTC (rev 143376)
+++ trunk/Source/WebCore/ChangeLog	2013-02-19 21:18:00 UTC (rev 143377)
@@ -1,3 +1,19 @@
+2013-02-19  Tony Chang  <t...@chromium.org>
+
+        Border changes on tables with collapsed borders doesn't relayout table cells
+        https://bugs.webkit.org/show_bug.cgi?id=109774
+
+        Reviewed by David Hyatt.
+
+        Test: fast/table/border-collapsing/dynamic-border-width-change.html
+
+        Changes to border top and border bottom on table rows also changes the size
+        of the table cell causing a relayout to be needed.
+
+        * rendering/RenderTableRow.cpp:
+        (WebCore::borderWidthChanged): Also include border top and bottom.
+        (WebCore::RenderTableRow::styleDidChange): Remove logical from the helper function name.
+
 2013-02-19  Kentaro Hara  <hara...@chromium.org>
 
         Unreviewed. Rebaselined run-bindings-tests.

Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (143376 => 143377)


--- trunk/Source/WebCore/rendering/RenderTableRow.cpp	2013-02-19 20:56:14 UTC (rev 143376)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp	2013-02-19 21:18:00 UTC (rev 143377)
@@ -54,13 +54,11 @@
     section()->setNeedsCellRecalc();
 }
 
-static bool borderLogicalWidthChanged(const RenderStyle* oldStyle, const RenderStyle* newStyle)
+static bool borderWidthChanged(const RenderStyle* oldStyle, const RenderStyle* newStyle)
 {
-    if (newStyle->isHorizontalWritingMode())
-        return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth()
-            || oldStyle->borderRightWidth() != newStyle->borderRightWidth();
-
-    return oldStyle->borderTopWidth() != newStyle->borderTopWidth()
+    return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth()
+        || oldStyle->borderTopWidth() != newStyle->borderTopWidth()
+        || oldStyle->borderRightWidth() != newStyle->borderRightWidth()
         || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth();
 }
 
@@ -80,7 +78,7 @@
         if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style()->border())
             table->invalidateCollapsedBorders();
         
-        if (table && oldStyle && diff == StyleDifferenceLayout && needsLayout() && table->collapseBorders() && borderLogicalWidthChanged(oldStyle, style())) {
+        if (table && oldStyle && diff == StyleDifferenceLayout && needsLayout() && table->collapseBorders() && borderWidthChanged(oldStyle, style())) {
             // If the border width changes on a row, we need to make sure the cells in the row know to lay out again.
             // This only happens when borders are collapsed, since they end up affecting the border sides of the cell
             // itself.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to