Title: [145104] trunk
Revision
145104
Author
o...@chromium.org
Date
2013-03-07 10:59:41 -0800 (Thu, 07 Mar 2013)

Log Message

Recalculate borders at the beginning of table layout
https://bugs.webkit.org/show_bug.cgi?id=111634

Reviewed by Julien Chaffraix.

Source/WebCore:

Doing it in convertStyleLogicalWidthToComputedWidth missed some dynamic
relayout cases. I confirmed that the new results match the results we
would get if we set the border width initially instead of dynamically.

* rendering/RenderTable.cpp:
(WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
(WebCore::RenderTable::layout):

LayoutTests:

* fast/table/border-collapsing/cached-change-row-border-width-expected.png:
* fast/table/border-collapsing/cached-change-row-border-width-expected.txt:
* fast/table/border-collapsing/cached-change-tbody-border-width-expected.png:
* fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (145103 => 145104)


--- trunk/LayoutTests/ChangeLog	2013-03-07 18:57:19 UTC (rev 145103)
+++ trunk/LayoutTests/ChangeLog	2013-03-07 18:59:41 UTC (rev 145104)
@@ -1,3 +1,15 @@
+2013-03-06  Ojan Vafai  <o...@chromium.org>
+
+        Recalculate borders at the beginning of table layout
+        https://bugs.webkit.org/show_bug.cgi?id=111634
+
+        Reviewed by Julien Chaffraix.
+
+        * fast/table/border-collapsing/cached-change-row-border-width-expected.png:
+        * fast/table/border-collapsing/cached-change-row-border-width-expected.txt:
+        * fast/table/border-collapsing/cached-change-tbody-border-width-expected.png:
+        * fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt:
+
 2013-03-07  Rafael Weinstein  <rafa...@chromium.org>
 
         Unreviewed gardening.

Modified: trunk/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.txt (145103 => 145104)


--- trunk/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.txt	2013-03-07 18:57:19 UTC (rev 145103)
+++ trunk/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.txt	2013-03-07 18:59:41 UTC (rev 145104)
@@ -4,8 +4,8 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderTable {TABLE} at (0,0) size 56x103 [border: (2px solid #0000FF)]
-        RenderTableSection {TBODY} at (1,2) size 54x100
-          RenderTableRow {TR} at (0,0) size 54x50 [border: (4px solid #FFFF00)]
-            RenderTableCell {TD} at (0,22) size 54x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
-          RenderTableRow {TR} at (0,50) size 54x50
-            RenderTableCell {TD} at (0,73) size 54x3 [border: (2px none #000000)] [r=1 c=0 rs=1 cs=1]
+        RenderTableSection {TBODY} at (2,2) size 52x100
+          RenderTableRow {TR} at (0,0) size 52x50 [border: (4px solid #FFFF00)]
+            RenderTableCell {TD} at (0,22) size 52x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+          RenderTableRow {TR} at (0,50) size 52x50
+            RenderTableCell {TD} at (0,73) size 52x4 [border: (2px none #000000)] [r=1 c=0 rs=1 cs=1]

Modified: trunk/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt (145103 => 145104)


--- trunk/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt	2013-03-07 18:57:19 UTC (rev 145103)
+++ trunk/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt	2013-03-07 18:59:41 UTC (rev 145104)
@@ -4,14 +4,14 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderTable {TABLE} at (0,0) size 109x153 [border: (2px solid #0000FF)]
-        RenderTableSection {TBODY} at (1,2) size 107x100 [border: (4px solid #FFFF00)]
-          RenderTableRow {TR} at (0,0) size 107x50
-            RenderTableCell {TD} at (0,23) size 54x4 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (54,23) size 53x3 [border: (2px none #000000)] [r=0 c=1 rs=1 cs=1]
-          RenderTableRow {TR} at (0,50) size 107x50
-            RenderTableCell {TD} at (0,73) size 54x3 [border: (1px none #000000)] [r=1 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (54,74) size 53x2 [border: none] [r=1 c=1 rs=1 cs=1]
-        RenderTableSection {TBODY} at (1,102) size 107x50
-          RenderTableRow {TR} at (0,0) size 107x50
-            RenderTableCell {TD} at (0,23) size 54x3 [border: (2px none #000000)] [r=0 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (54,23) size 53x3 [border: (2px none #000000)] [r=0 c=1 rs=1 cs=1]
+        RenderTableSection {TBODY} at (2,2) size 105x100 [border: (4px solid #FFFF00)]
+          RenderTableRow {TR} at (0,0) size 105x50
+            RenderTableCell {TD} at (0,22) size 53x5 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (53,23) size 52x4 [border: (2px none #000000)] [r=0 c=1 rs=1 cs=1]
+          RenderTableRow {TR} at (0,50) size 105x50
+            RenderTableCell {TD} at (0,72) size 53x5 [border: (1px none #000000)] [r=1 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (53,73) size 52x4 [border: none] [r=1 c=1 rs=1 cs=1]
+        RenderTableSection {TBODY} at (2,102) size 105x50
+          RenderTableRow {TR} at (0,0) size 105x50
+            RenderTableCell {TD} at (0,23) size 53x4 [border: (2px none #000000)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (53,23) size 52x4 [border: (2px none #000000)] [r=0 c=1 rs=1 cs=1]

Modified: trunk/Source/WebCore/ChangeLog (145103 => 145104)


--- trunk/Source/WebCore/ChangeLog	2013-03-07 18:57:19 UTC (rev 145103)
+++ trunk/Source/WebCore/ChangeLog	2013-03-07 18:59:41 UTC (rev 145104)
@@ -1,3 +1,18 @@
+2013-03-06  Ojan Vafai  <o...@chromium.org>
+
+        Recalculate borders at the beginning of table layout
+        https://bugs.webkit.org/show_bug.cgi?id=111634
+
+        Reviewed by Julien Chaffraix.
+
+        Doing it in convertStyleLogicalWidthToComputedWidth missed some dynamic
+        relayout cases. I confirmed that the new results match the results we
+        would get if we set the border width initially instead of dynamically.
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
+        (WebCore::RenderTable::layout):
+
 2013-03-07  David Hyatt  <hy...@apple.com>
 
         border-fit-adjust should happen at layout time rather than paint time

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (145103 => 145104)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2013-03-07 18:57:19 UTC (rev 145103)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2013-03-07 18:59:41 UTC (rev 145104)
@@ -316,11 +316,9 @@
     // HTML tables' width styles already include borders and paddings, but CSS tables' width styles do not.
     LayoutUnit borders = 0;
     bool isCSSTable = !node() || !node()->hasTagName(tableTag);
-    if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive()) {
-        recalcBordersInRowDirection();
-        if (style()->boxSizing() == CONTENT_BOX)
+    if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive() && style()->boxSizing() == CONTENT_BOX)
             borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() : paddingStart() + paddingEnd());
-    }
+
     return minimumValueForLength(styleLogicalWidth, availableWidth, view()) + borders;
 }
 
@@ -389,6 +387,9 @@
         return;
 
     recalcSectionsIfNeeded();
+    // FIXME: We should do this recalc lazily in borderStart/borderEnd so that we don't have to make sure
+    // to call this before we call borderStart/borderEnd to avoid getting a stale value.
+    recalcBordersInRowDirection();
         
     LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
     LayoutStateMaintainer statePusher(view(), this, locationOffset(), style()->isFlippedBlocksWritingMode());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to