Redrawing dirty parts of a large table is very slow
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Sep 2011 19:56:21 +0000 (19:56 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Sep 2011 19:56:21 +0000 (19:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=64546

Patch by Konstantin Scheglov <scheglov@google.com> on 2011-09-23
Reviewed by David Hyatt.

Source/WebCore:

Move CollapsedBorderValues into RenderTable.h.
Calculate collapsed borders only once and re-use during paintObject().
Invalidate cache when cell, row, row group, col, col group or table border is changed.

Tests: fast/table/border-collapsing/cached-cell-append.html
       fast/table/border-collapsing/cached-cell-remove.html
       fast/table/border-collapsing/cached-change-cell-border-color.html
       fast/table/border-collapsing/cached-change-cell-border-width.html
       fast/table/border-collapsing/cached-change-col-border-color.html
       fast/table/border-collapsing/cached-change-col-border-width.html
       fast/table/border-collapsing/cached-change-colgroup-border-color.html
       fast/table/border-collapsing/cached-change-colgroup-border-width.html
       fast/table/border-collapsing/cached-change-row-border-color.html
       fast/table/border-collapsing/cached-change-row-border-width.html
       fast/table/border-collapsing/cached-change-table-border-color.html
       fast/table/border-collapsing/cached-change-table-border-width.html
       fast/table/border-collapsing/cached-change-tbody-border-color.html
       fast/table/border-collapsing/cached-change-tbody-border-width.html

* rendering/RenderTable.cpp:
(WebCore::RenderTable::RenderTable):
(WebCore::RenderTable::styleDidChange): Invalidate cache on border change.
(WebCore::RenderTable::layout): Invalidate cache if layout changed.
(WebCore::RenderTable::recalcCollapsedBorders): Ensures that cache is valid.
(WebCore::RenderTable::paintObject): Use cached collapsed borders.
* rendering/RenderTable.h:
(WebCore::RenderTable::invalidateCollapsedBorders): Accessor to mark cache invalid.
(WebCore::RenderTable::currentBorderValue): Rename to use word "value".
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::styleDidChange): If border changed, invalidate cache.

Rename to use word "value".
(WebCore::addBorderStyle):
(WebCore::RenderTableCell::collectBorderValues):
(WebCore::compareBorderValuesForQSort):
(WebCore::RenderTableCell::sortBorderValues):
(WebCore::RenderTableCell::paintCollapsedBorder):
* rendering/RenderTableCell.h:

If border changed, invalidate cache.
* rendering/RenderTableCol.cpp:
(WebCore::RenderTableCol::styleDidChange):
* rendering/RenderTableCol.h:
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::styleDidChange):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::styleDidChange):

LayoutTests:

Tests for invalidating collapsed borders cache.

* fast/table/border-collapsing/cached-cell-append-expected.png: Added.
* fast/table/border-collapsing/cached-cell-append-expected.txt: Added.
* fast/table/border-collapsing/cached-cell-append.html: Added.
* fast/table/border-collapsing/cached-cell-remove-expected.png: Added.
* fast/table/border-collapsing/cached-cell-remove-expected.txt: Added.
* fast/table/border-collapsing/cached-cell-remove.html: Added.
* fast/table/border-collapsing/cached-change-cell-border-color-expected.png: Added.
* fast/table/border-collapsing/cached-change-cell-border-color-expected.txt: Added.
* fast/table/border-collapsing/cached-change-cell-border-color.html: Added.
* fast/table/border-collapsing/cached-change-cell-border-width-expected.png: Added.
* fast/table/border-collapsing/cached-change-cell-border-width-expected.txt: Added.
* fast/table/border-collapsing/cached-change-cell-border-width.html: Added.
* fast/table/border-collapsing/cached-change-col-border-color-expected.png: Added.
* fast/table/border-collapsing/cached-change-col-border-color-expected.txt: Added.
* fast/table/border-collapsing/cached-change-col-border-color.html: Added.
* fast/table/border-collapsing/cached-change-col-border-width-expected.png: Added.
* fast/table/border-collapsing/cached-change-col-border-width-expected.txt: Added.
* fast/table/border-collapsing/cached-change-col-border-width.html: Added.
* fast/table/border-collapsing/cached-change-colgroup-border-color-expected.png: Added.
* fast/table/border-collapsing/cached-change-colgroup-border-color-expected.txt: Added.
* fast/table/border-collapsing/cached-change-colgroup-border-color.html: Added.
* fast/table/border-collapsing/cached-change-colgroup-border-width-expected.png: Added.
* fast/table/border-collapsing/cached-change-colgroup-border-width-expected.txt: Added.
* fast/table/border-collapsing/cached-change-colgroup-border-width.html: Added.
* fast/table/border-collapsing/cached-change-row-border-color-expected.png: Added.
* fast/table/border-collapsing/cached-change-row-border-color-expected.txt: Added.
* fast/table/border-collapsing/cached-change-row-border-color.html: Added.
* fast/table/border-collapsing/cached-change-row-border-width-expected.png: Added.
* fast/table/border-collapsing/cached-change-row-border-width-expected.txt: Added.
* fast/table/border-collapsing/cached-change-row-border-width.html: Added.
* fast/table/border-collapsing/cached-change-table-border-color-expected.png: Added.
* fast/table/border-collapsing/cached-change-table-border-color-expected.txt: Added.
* fast/table/border-collapsing/cached-change-table-border-color.html: Added.
* fast/table/border-collapsing/cached-change-table-border-width-expected.png: Added.
* fast/table/border-collapsing/cached-change-table-border-width-expected.txt: Added.
* fast/table/border-collapsing/cached-change-table-border-width.html: Added.
* fast/table/border-collapsing/cached-change-tbody-border-color-expected.png: Added.
* fast/table/border-collapsing/cached-change-tbody-border-color-expected.txt: Added.
* fast/table/border-collapsing/cached-change-tbody-border-color.html: Added.
* fast/table/border-collapsing/cached-change-tbody-border-width-expected.png: Added.
* fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt: Added.
* fast/table/border-collapsing/cached-change-tbody-border-width.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95852 268f45cc-cd09-0410-ab3c-d52691b4dbfc

56 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/table/border-collapsing/cached-cell-append-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-cell-append-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-cell-append.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-cell-remove-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-cell-remove-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-cell-remove.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-col-border-color-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-col-border-color-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-col-border-color.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-col-border-width-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-col-border-width-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-col-border-width.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-row-border-color-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-row-border-color-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-row-border-color.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-row-border-width.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-table-border-color-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-table-border-color-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-table-border-color.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-table-border-width-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-table-border-width-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-table-border-width.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.png [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width.html [new file with mode: 0644]
LayoutTests/fast/table/border-collapsing/resources/cached.css [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCell.h
Source/WebCore/rendering/RenderTableCol.cpp
Source/WebCore/rendering/RenderTableCol.h
Source/WebCore/rendering/RenderTableRow.cpp
Source/WebCore/rendering/RenderTableSection.cpp

index 8f4ee23..33b3c7e 100644 (file)
@@ -1,3 +1,55 @@
+2011-09-23  Konstantin Scheglov  <scheglov@google.com>
+
+        Redrawing dirty parts of a large table is very slow
+        https://bugs.webkit.org/show_bug.cgi?id=64546
+
+        Reviewed by David Hyatt.
+
+        Tests for invalidating collapsed borders cache.
+
+        * fast/table/border-collapsing/cached-cell-append-expected.png: Added.
+        * fast/table/border-collapsing/cached-cell-append-expected.txt: Added.
+        * fast/table/border-collapsing/cached-cell-append.html: Added.
+        * fast/table/border-collapsing/cached-cell-remove-expected.png: Added.
+        * fast/table/border-collapsing/cached-cell-remove-expected.txt: Added.
+        * fast/table/border-collapsing/cached-cell-remove.html: Added.
+        * fast/table/border-collapsing/cached-change-cell-border-color-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-cell-border-color-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-cell-border-color.html: Added.
+        * fast/table/border-collapsing/cached-change-cell-border-width-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-cell-border-width-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-cell-border-width.html: Added.
+        * fast/table/border-collapsing/cached-change-col-border-color-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-col-border-color-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-col-border-color.html: Added.
+        * fast/table/border-collapsing/cached-change-col-border-width-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-col-border-width-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-col-border-width.html: Added.
+        * fast/table/border-collapsing/cached-change-colgroup-border-color-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-colgroup-border-color-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-colgroup-border-color.html: Added.
+        * fast/table/border-collapsing/cached-change-colgroup-border-width-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-colgroup-border-width-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-colgroup-border-width.html: Added.
+        * fast/table/border-collapsing/cached-change-row-border-color-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-row-border-color-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-row-border-color.html: Added.
+        * fast/table/border-collapsing/cached-change-row-border-width-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-row-border-width-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-row-border-width.html: Added.
+        * fast/table/border-collapsing/cached-change-table-border-color-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-table-border-color-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-table-border-color.html: Added.
+        * fast/table/border-collapsing/cached-change-table-border-width-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-table-border-width-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-table-border-width.html: Added.
+        * fast/table/border-collapsing/cached-change-tbody-border-color-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-tbody-border-color-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-tbody-border-color.html: Added.
+        * fast/table/border-collapsing/cached-change-tbody-border-width-expected.png: Added.
+        * fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt: Added.
+        * fast/table/border-collapsing/cached-change-tbody-border-width.html: Added.
+
 2011-09-23  Jochen Eisinger  <jochen@chromium.org>
 
         Clarify wording in cross origin XSL tests and enable on all platforms
diff --git a/LayoutTests/fast/table/border-collapsing/cached-cell-append-expected.png b/LayoutTests/fast/table/border-collapsing/cached-cell-append-expected.png
new file mode 100644 (file)
index 0000000..21b49d8
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-cell-append-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-cell-append-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-cell-append-expected.txt
new file mode 100644 (file)
index 0000000..36d3ed1
--- /dev/null
@@ -0,0 +1,10 @@
+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
+      RenderTable {TABLE} at (0,0) size 115x54 [border: (2px solid #0000FF)]
+        RenderTableSection {TBODY} at (2,2) size 112x50
+          RenderTableRow {TR} at (0,0) size 112x50
+            RenderTableCell {TD} at (0,22) size 56x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (56,23) size 56x4 [border: (1px none #000000) (3px solid #FFFF00)] [r=0 c=1 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-cell-append.html b/LayoutTests/fast/table/border-collapsing/cached-cell-append.html
new file mode 100644 (file)
index 0000000..fcd29f9
--- /dev/null
@@ -0,0 +1,30 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we append new cell, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                newCell = document.createElement("td");
+                newCell.style.borderLeftWidth = "6px";
+                newCell.style.borderLeftStyle = "solid";
+                newCell.style.borderLeftColor = "yellow";
+                document.getElementById("row").appendChild(newCell);
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:2px solid blue">
+            <tr id="row">
+                <td style="border:4px solid lime"/>
+            </tr>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-cell-remove-expected.png b/LayoutTests/fast/table/border-collapsing/cached-cell-remove-expected.png
new file mode 100644 (file)
index 0000000..df561be
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-cell-remove-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-cell-remove-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-cell-remove-expected.txt
new file mode 100644 (file)
index 0000000..9dddee3
--- /dev/null
@@ -0,0 +1,10 @@
+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
+      RenderTable {TABLE} at (0,0) size 113x54 [border: (2px solid #0000FF)]
+        RenderTableSection {TBODY} at (2,2) size 110x50
+          RenderTableRow {TR} at (0,0) size 110x50
+            RenderTableCell {TD} at (0,22) size 55x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (55,23) size 55x4 [border: (1px none #000000)] [r=0 c=1 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-cell-remove.html b/LayoutTests/fast/table/border-collapsing/cached-cell-remove.html
new file mode 100644 (file)
index 0000000..8489cf9
--- /dev/null
@@ -0,0 +1,29 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we remove cell, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                barCell = document.getElementById("bar");
+                document.getElementById("row").removeChild(barCell);
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:2px solid blue">
+            <tr id="row">
+                <td style="border:4px solid lime"/>
+                <td style="border-left:6px solid yellow" id="bar"/>
+                <td/>
+            </tr>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color-expected.png
new file mode 100644 (file)
index 0000000..3dda69f
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color-expected.txt
new file mode 100644 (file)
index 0000000..30d2e33
--- /dev/null
@@ -0,0 +1,10 @@
+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
+      RenderTable {TABLE} at (0,0) size 114x54 [border: (2px solid #0000FF)]
+        RenderTableSection {TBODY} at (2,2) size 111x50
+          RenderTableRow {TR} at (0,0) size 111x50
+            RenderTableCell {TD} at (0,22) size 56x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (56,23) size 55x4 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color.html b/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-color.html
new file mode 100644 (file)
index 0000000..797c81d
--- /dev/null
@@ -0,0 +1,27 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change cell border color, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("foo").style.borderColor = "lime";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:2px solid blue">
+            <tr>
+                <td style="border:4px solid pink" id="foo"/>
+                <td style="border:1px solid black"/>
+            </tr>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width-expected.png
new file mode 100644 (file)
index 0000000..96d398a
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width-expected.txt
new file mode 100644 (file)
index 0000000..7bcd704
--- /dev/null
@@ -0,0 +1,10 @@
+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
+      RenderTable {TABLE} at (0,0) size 113x54 [border: (2px solid #0000FF)]
+        RenderTableSection {TBODY} at (2,2) size 110x50
+          RenderTableRow {TR} at (0,0) size 110x50
+            RenderTableCell {TD} at (0,22) size 55x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (55,23) size 55x4 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width.html b/LayoutTests/fast/table/border-collapsing/cached-change-cell-border-width.html
new file mode 100644 (file)
index 0000000..6b833cc
--- /dev/null
@@ -0,0 +1,27 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change cell border width, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("foo").style.borderWidth = "4px";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:2px solid blue">
+            <tr>
+                <td style="border:1px solid lime" id="foo"/>
+                <td style="border:1px solid black"/>
+            </tr>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color-expected.png
new file mode 100644 (file)
index 0000000..2f8de19
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color-expected.txt
new file mode 100644 (file)
index 0000000..2921b8b
--- /dev/null
@@ -0,0 +1,13 @@
+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
+layer at (8,8) size 114x54
+  RenderTable {TABLE} at (0,0) size 114x54 [border: (2px solid #0000FF)]
+    RenderTableSection {TBODY} at (2,2) size 111x50
+      RenderTableRow {TR} at (0,0) size 111x50
+        RenderTableCell {TD} at (0,22) size 56x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+        RenderTableCell {TD} at (56,23) size 55x4 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1]
+layer at (90,30) size 20x20
+  RenderBlock (positioned) {DIV} at (82,22) size 20x20 [bgcolor=#FFFF00]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color.html b/LayoutTests/fast/table/border-collapsing/cached-change-cell-sl-border-color.html
new file mode 100644 (file)
index 0000000..d81663f
--- /dev/null
@@ -0,0 +1,34 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we:
+1. Remove DIV text, this requests layout for DIV, but only simplified layout for TABLE;
+2. Change cell border color, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                // remove text, this requests layout for DIV,
+                // but only simplified layout for TABLE
+                document.getElementById("blockDiv").innerText = "";
+                // change color, no layout for TABLE, only repaint
+                document.getElementById("foo").style.borderColor = "lime";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:2px solid blue; position: relative;">
+            <tr>
+                <td style="border:4px solid pink" id="foo"/>
+                <td style="border:1px solid black"/>
+                <div id="blockDiv">A</div>
+            </tr>
+        </table>
+    </body>
+</html>
+        
\ No newline at end of file
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-col-border-color-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-col-border-color-expected.png
new file mode 100644 (file)
index 0000000..dadbdcf
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-col-border-color-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-col-border-color-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-col-border-color-expected.txt
new file mode 100644 (file)
index 0000000..304fa87
--- /dev/null
@@ -0,0 +1,16 @@
+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
+      RenderTable {TABLE} at (0,0) size 113x104 [border: (2px solid #0000FF)]
+        RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COL} at (0,0) size 0x0 [border: (4px solid #FFFF00)]
+          RenderTableCol {COL} at (0,0) size 0x0
+        RenderTableSection {TBODY} at (2,2) size 110x100
+          RenderTableRow {TR} at (0,0) size 110x50
+            RenderTableCell {TD} at (0,22) size 56x5 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (56,23) size 54x3 [border: (1px none #000000)] [r=0 c=1 rs=1 cs=1]
+          RenderTableRow {TR} at (0,50) size 110x50
+            RenderTableCell {TD} at (0,72) size 56x5 [border: (1px none #000000)] [r=1 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (56,74) size 54x2 [border: none] [r=1 c=1 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-col-border-color.html b/LayoutTests/fast/table/border-collapsing/cached-change-col-border-color.html
new file mode 100644 (file)
index 0000000..481e9d0
--- /dev/null
@@ -0,0 +1,37 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change col border color, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("col").style.borderColor = "yellow";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue">
+            <colgroup>
+                <col style="border:4px solid pink" id="col">
+                <col>
+            </colgroup>
+            <tbody>
+                <tr>
+                    <td style="border:2px solid lime"/>
+                    <td/>
+                </tr>
+                <tr>
+                    <td/>
+                    <td/>
+                </tr>
+            </tbody>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-col-border-width-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-col-border-width-expected.png
new file mode 100644 (file)
index 0000000..f8b4a9f
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-col-border-width-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-col-border-width-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-col-border-width-expected.txt
new file mode 100644 (file)
index 0000000..fd38e18
--- /dev/null
@@ -0,0 +1,16 @@
+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
+      RenderTable {TABLE} at (0,0) size 110x104 [border: (2px solid #0000FF)]
+        RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COL} at (0,0) size 0x0 [border: (4px solid #FFFF00)]
+          RenderTableCol {COL} at (0,0) size 0x0
+        RenderTableSection {TBODY} at (2,2) size 107x100
+          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: (1px 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]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-col-border-width.html b/LayoutTests/fast/table/border-collapsing/cached-change-col-border-width.html
new file mode 100644 (file)
index 0000000..1602c27
--- /dev/null
@@ -0,0 +1,37 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change col border width, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("col").style.borderWidth = "4px";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue">
+            <colgroup>
+                <col style="border:1px solid yellow" id="col">
+                <col>
+            </colgroup>
+            <tbody>
+                <tr>
+                    <td style="border:2px solid lime"/>
+                    <td/>
+                </tr>
+                <tr>
+                    <td/>
+                    <td/>
+                </tr>
+            </tbody>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color-expected.png
new file mode 100644 (file)
index 0000000..91beb02
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color-expected.txt
new file mode 100644 (file)
index 0000000..035c63e
--- /dev/null
@@ -0,0 +1,20 @@
+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
+      RenderTable {TABLE} at (0,0) size 164x102 [border: (1px solid #0000FF)]
+        RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (4px solid #FFFF00)]
+          RenderTableCol {COL} at (0,0) size 0x0
+          RenderTableCol {COL} at (0,0) size 0x0
+        RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COL} at (0,0) size 0x0
+        RenderTableSection {TBODY} at (1,1) size 162x100
+          RenderTableRow {TR} at (0,0) size 162x50
+            RenderTableCell {TD} at (0,22) size 55x5 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (55,23) size 55x4 [border: (2px none #000000)] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (110,23) size 52x3 [border: (1px none #000000)] [r=0 c=2 rs=1 cs=1]
+          RenderTableRow {TR} at (0,50) size 162x50
+            RenderTableCell {TD} at (0,72) size 55x5 [border: (1px none #000000)] [r=1 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (55,73) size 55x4 [border: none] [r=1 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (110,74) size 52x2 [r=1 c=2 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color.html b/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-color.html
new file mode 100644 (file)
index 0000000..e5cd66a
--- /dev/null
@@ -0,0 +1,42 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change colgroup border color, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("colgroup").style.borderColor = "yellow";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue">
+            <colgroup style="border:4px solid pink" id="colgroup">
+                <col>
+                <col>
+            </colgroup>
+            <colgroup>
+                <col>
+            </colgroup>
+            <tbody>
+                <tr>
+                    <td style="border:2px solid lime"/>
+                    <td/>
+                    <td/>
+                </tr>
+                <tr>
+                    <td/>
+                    <td/>
+                    <td/>
+                </tr>
+            </tbody>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width-expected.png
new file mode 100644 (file)
index 0000000..f2c23a9
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width-expected.txt
new file mode 100644 (file)
index 0000000..d69b891
--- /dev/null
@@ -0,0 +1,20 @@
+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
+      RenderTable {TABLE} at (0,0) size 161x102 [border: (1px solid #0000FF)]
+        RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (4px solid #FFFF00)]
+          RenderTableCol {COL} at (0,0) size 0x0
+          RenderTableCol {COL} at (0,0) size 0x0
+        RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COL} at (0,0) size 0x0
+        RenderTableSection {TBODY} at (1,1) size 159x100
+          RenderTableRow {TR} at (0,0) size 159x50
+            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 54x4 [border: (2px none #000000)] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (107,23) size 52x3 [border: (1px none #000000)] [r=0 c=2 rs=1 cs=1]
+          RenderTableRow {TR} at (0,50) size 159x50
+            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 54x4 [border: none] [r=1 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (107,74) size 52x2 [r=1 c=2 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width.html b/LayoutTests/fast/table/border-collapsing/cached-change-colgroup-border-width.html
new file mode 100644 (file)
index 0000000..9ca49be
--- /dev/null
@@ -0,0 +1,42 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change colgroup border width, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("colgroup").style.borderWidth = "4px";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue">
+            <colgroup style="border:1px solid yellow" id="colgroup">
+                <col>
+                <col>
+            </colgroup>
+            <colgroup>
+                <col>
+            </colgroup>
+            <tbody>
+                <tr>
+                    <td style="border:2px solid lime"/>
+                    <td/>
+                    <td/>
+                </tr>
+                <tr>
+                    <td/>
+                    <td/>
+                    <td/>
+                </tr>
+            </tbody>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-row-border-color-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-row-border-color-expected.png
new file mode 100644 (file)
index 0000000..bb9b9b8
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-row-border-color-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-row-border-color-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-row-border-color-expected.txt
new file mode 100644 (file)
index 0000000..47c6a57
--- /dev/null
@@ -0,0 +1,11 @@
+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
+      RenderTable {TABLE} at (0,0) size 60x103 [border: (2px solid #0000FF)]
+        RenderTableSection {TBODY} at (2,2) size 56x100
+          RenderTableRow {TR} at (0,0) size 56x50 [border: (4px solid #FFFF00)]
+            RenderTableCell {TD} at (0,22) size 56x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+          RenderTableRow {TR} at (0,50) size 56x50
+            RenderTableCell {TD} at (0,73) size 56x4 [border: (2px none #000000)] [r=1 c=0 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-row-border-color.html b/LayoutTests/fast/table/border-collapsing/cached-change-row-border-color.html
new file mode 100644 (file)
index 0000000..bc1893d
--- /dev/null
@@ -0,0 +1,29 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change row border color, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("row").style.borderColor = "yellow";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue">
+            <tr style="border:4px solid pink" id="row">
+                <td style="border:2px solid lime"/>
+            </tr>
+            <tr>
+                <td/>
+            </tr>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.png
new file mode 100644 (file)
index 0000000..ca29d83
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.txt
new file mode 100644 (file)
index 0000000..af723c6
--- /dev/null
@@ -0,0 +1,11 @@
+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
+      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,23) size 54x4 [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]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width.html b/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width.html
new file mode 100644 (file)
index 0000000..112f84c
--- /dev/null
@@ -0,0 +1,29 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change row border width, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("row").style.borderWidth = "4px";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue">
+            <tr style="border:1px solid yellow" id="row">
+                <td style="border:2px solid lime"/>
+            </tr>
+            <tr>
+                <td/>
+            </tr>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-table-border-color-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-table-border-color-expected.png
new file mode 100644 (file)
index 0000000..7667602
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-table-border-color-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-table-border-color-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-table-border-color-expected.txt
new file mode 100644 (file)
index 0000000..a29e86c
--- /dev/null
@@ -0,0 +1,9 @@
+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
+      RenderTable {TABLE} at (0,0) size 60x54 [border: (2px solid #FFFF00)]
+        RenderTableSection {TBODY} at (2,2) size 56x50
+          RenderTableRow {TR} at (0,0) size 56x50
+            RenderTableCell {TD} at (0,22) size 56x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-table-border-color.html b/LayoutTests/fast/table/border-collapsing/cached-change-table-border-color.html
new file mode 100644 (file)
index 0000000..9b62164
--- /dev/null
@@ -0,0 +1,26 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change table border color, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("tbl").style.borderColor = "yellow";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:4px solid blue" id="tbl">
+            <tr>
+                <td style="border:2px solid lime"/>
+            </tr>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-table-border-width-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-table-border-width-expected.png
new file mode 100644 (file)
index 0000000..3aa711a
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-table-border-width-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-table-border-width-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-table-border-width-expected.txt
new file mode 100644 (file)
index 0000000..b66d816
--- /dev/null
@@ -0,0 +1,9 @@
+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
+      RenderTable {TABLE} at (0,0) size 58x54 [border: (2px solid #0000FF)]
+        RenderTableSection {TBODY} at (2,2) size 54x50
+          RenderTableRow {TR} at (0,0) size 54x50
+            RenderTableCell {TD} at (0,23) size 54x4 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-table-border-width.html b/LayoutTests/fast/table/border-collapsing/cached-change-table-border-width.html
new file mode 100644 (file)
index 0000000..ac764fb
--- /dev/null
@@ -0,0 +1,26 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change table border width, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("tbl").style.borderWidth = "4px";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue" id="tbl">
+            <tr>
+                <td style="border:2px solid lime"/>
+            </tr>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color-expected.png
new file mode 100644 (file)
index 0000000..9253c48
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color-expected.txt
new file mode 100644 (file)
index 0000000..2621a03
--- /dev/null
@@ -0,0 +1,17 @@
+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
+      RenderTable {TABLE} at (0,0) size 114x153 [border: (2px solid #0000FF)]
+        RenderTableSection {TBODY} at (2,2) size 110x100 [border: (4px solid #FFFF00)]
+          RenderTableRow {TR} at (0,0) size 110x50
+            RenderTableCell {TD} at (0,22) size 55x5 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (55,23) size 55x4 [border: (2px none #000000)] [r=0 c=1 rs=1 cs=1]
+          RenderTableRow {TR} at (0,50) size 110x50
+            RenderTableCell {TD} at (0,72) size 55x5 [border: (1px none #000000)] [r=1 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (55,73) size 55x4 [border: none] [r=1 c=1 rs=1 cs=1]
+        RenderTableSection {TBODY} at (2,102) size 110x50
+          RenderTableRow {TR} at (0,0) size 110x50
+            RenderTableCell {TD} at (0,23) size 55x4 [border: (2px none #000000)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (55,23) size 55x4 [border: (2px none #000000)] [r=0 c=1 rs=1 cs=1]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color.html b/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-color.html
new file mode 100644 (file)
index 0000000..2fa5ecc
--- /dev/null
@@ -0,0 +1,39 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change tbody border color, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("tbody").style.borderColor = "yellow";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue">
+            <tbody style="border:4px solid pink" id="tbody">
+                <tr>
+                    <td style="border:2px solid lime"/>
+                    <td/>
+                </tr>
+                <tr>
+                    <td/>
+                    <td/>
+                </tr>
+            </tbody>
+            <tbody>
+                <tr>
+                    <td/>
+                    <td/>
+                </tr>
+            </tbody>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.png b/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.png
new file mode 100644 (file)
index 0000000..b9b7757
Binary files /dev/null and b/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.png differ
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt b/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width-expected.txt
new file mode 100644 (file)
index 0000000..e101ac5
--- /dev/null
@@ -0,0 +1,17 @@
+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
+      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]
diff --git a/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width.html b/LayoutTests/fast/table/border-collapsing/cached-change-tbody-border-width.html
new file mode 100644 (file)
index 0000000..69cc44c
--- /dev/null
@@ -0,0 +1,39 @@
+<!--
+Calculating collapsed borders for big tables is expensive, so we cache them and recalculate when needed.
+Here we change tbody border width, expect that cache is invalidated and paint produces expected image.
+-->
+<html>
+    <head>
+        <title></title>
+        <link rel="stylesheet" href="resources/cached.css">
+        <script type="text/javascript">
+            function test() {
+                document.body.offsetTop;
+                if (window.layoutTestController)
+                    layoutTestController.display();
+                document.getElementById("tbody").style.borderWidth = "4px";
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        <table style="border-collapse:collapse; border:1px solid blue">
+            <tbody style="border:1px solid yellow" id="tbody">
+                <tr>
+                    <td style="border:2px solid lime"/>
+                    <td/>
+                </tr>
+                <tr>
+                    <td/>
+                    <td/>
+                </tr>
+            </tbody>
+            <tbody>
+                <tr>
+                    <td/>
+                    <td/>
+                </tr>
+            </tbody>
+        </table>
+    </body>
+</html>
+
diff --git a/LayoutTests/fast/table/border-collapsing/resources/cached.css b/LayoutTests/fast/table/border-collapsing/resources/cached.css
new file mode 100644 (file)
index 0000000..069d13e
--- /dev/null
@@ -0,0 +1,14 @@
+TD {
+    width: 50px;
+    height: 50px;
+}
+
+DIV#blockDiv {
+    display: block;
+    background: yellow;
+    position: absolute;
+    width: 20px;
+    height: 20px;
+    left: 80px;
+    top: 20px;
+}
\ No newline at end of file
index 0dcc028..aa0bebe 100644 (file)
@@ -1,3 +1,58 @@
+2011-09-23  Konstantin Scheglov  <scheglov@google.com>
+
+        Redrawing dirty parts of a large table is very slow
+        https://bugs.webkit.org/show_bug.cgi?id=64546
+
+        Reviewed by David Hyatt.
+
+        Move CollapsedBorderValues into RenderTable.h.
+        Calculate collapsed borders only once and re-use during paintObject().
+        Invalidate cache when cell, row, row group, col, col group or table border is changed.
+
+        Tests: fast/table/border-collapsing/cached-cell-append.html
+               fast/table/border-collapsing/cached-cell-remove.html
+               fast/table/border-collapsing/cached-change-cell-border-color.html
+               fast/table/border-collapsing/cached-change-cell-border-width.html
+               fast/table/border-collapsing/cached-change-col-border-color.html
+               fast/table/border-collapsing/cached-change-col-border-width.html
+               fast/table/border-collapsing/cached-change-colgroup-border-color.html
+               fast/table/border-collapsing/cached-change-colgroup-border-width.html
+               fast/table/border-collapsing/cached-change-row-border-color.html
+               fast/table/border-collapsing/cached-change-row-border-width.html
+               fast/table/border-collapsing/cached-change-table-border-color.html
+               fast/table/border-collapsing/cached-change-table-border-width.html
+               fast/table/border-collapsing/cached-change-tbody-border-color.html
+               fast/table/border-collapsing/cached-change-tbody-border-width.html
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::RenderTable):
+        (WebCore::RenderTable::styleDidChange): Invalidate cache on border change.
+        (WebCore::RenderTable::layout): Invalidate cache if layout changed.
+        (WebCore::RenderTable::recalcCollapsedBorders): Ensures that cache is valid.
+        (WebCore::RenderTable::paintObject): Use cached collapsed borders.
+        * rendering/RenderTable.h:
+        (WebCore::RenderTable::invalidateCollapsedBorders): Accessor to mark cache invalid.
+        (WebCore::RenderTable::currentBorderValue): Rename to use word "value".
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::styleDidChange): If border changed, invalidate cache.
+
+        Rename to use word "value".
+        (WebCore::addBorderStyle):
+        (WebCore::RenderTableCell::collectBorderValues):
+        (WebCore::compareBorderValuesForQSort):
+        (WebCore::RenderTableCell::sortBorderValues):
+        (WebCore::RenderTableCell::paintCollapsedBorder):
+        * rendering/RenderTableCell.h:
+        
+        If border changed, invalidate cache.
+        * rendering/RenderTableCol.cpp:
+        (WebCore::RenderTableCol::styleDidChange):
+        * rendering/RenderTableCol.h:
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::styleDidChange):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::styleDidChange):
+
 2011-09-23  Mark Hahnenberg  <mhahnenberg@apple.com>
 
         Add static version of JSCell::visitChildren
index 3c29a48..2ccd795 100644 (file)
@@ -54,8 +54,9 @@ RenderTable::RenderTable(Node* node)
     , m_foot(0)
     , m_firstBody(0)
     , m_currentBorder(0)
+    , m_collapsedBordersValid(false)
     , m_hasColElements(false)
-    , m_needsSectionRecalc(0)
+    , m_needsSectionRecalc(false)
     , m_hSpacing(0)
     , m_vSpacing(0)
     , m_borderStart(0)
@@ -91,6 +92,10 @@ void RenderTable::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
         else
             m_tableLayout = adoptPtr(new AutoTableLayout(this));
     }
+
+    // If border was changed, invalidate collapsed borders cache.
+    if (!needsLayout() && oldStyle && oldStyle->border() != style()->border())
+        invalidateCollapsedBorders();
 }
 
 static inline void resetSectionPointerIfNotBefore(RenderTableSection*& ptr, RenderObject* before)
@@ -396,6 +401,9 @@ void RenderTable::layout()
 
     updateLayerTransform();
 
+    // Layout was changed, so probably borders too.
+    invalidateCollapsedBorders();
+
     computeOverflow(clientLogicalBottom());
 
     statePusher.pop();
@@ -415,6 +423,22 @@ void RenderTable::layout()
     setNeedsLayout(false);
 }
 
+// Collect all the unique border values that we want to paint in a sorted list.
+void RenderTable::recalcCollapsedBorders()
+{
+    if (m_collapsedBordersValid)
+        return;
+    m_collapsedBordersValid = true;
+    m_collapsedBorders.clear();
+    RenderObject* stop = nextInPreOrderAfterChildren();
+    for (RenderObject* o = firstChild(); o && o != stop; o = o->nextInPreOrder()) {
+        if (o->isTableCell())
+            toRenderTableCell(o)->collectBorderValues(m_collapsedBorders);
+    }
+    RenderTableCell::sortBorderValues(m_collapsedBorders);
+}
+
+
 void RenderTable::addOverflowFromChildren()
 {
     // Add overflow from borders.
@@ -505,20 +529,13 @@ void RenderTable::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
     }
     
     if (collapseBorders() && paintPhase == PaintPhaseChildBlockBackground && style()->visibility() == VISIBLE) {
-        // Collect all the unique border styles that we want to paint in a sorted list.  Once we
-        // have all the styles sorted, we then do individual passes, painting each style of border
-        // from lowest precedence to highest precedence.
+        recalcCollapsedBorders();
+        // Using our cached sorted styles, we then do individual passes,
+        // painting each style of border from lowest precedence to highest precedence.
         info.phase = PaintPhaseCollapsedTableBorders;
-        RenderTableCell::CollapsedBorderStyles borderStyles;
-        RenderObject* stop = nextInPreOrderAfterChildren();
-        for (RenderObject* o = firstChild(); o && o != stop; o = o->nextInPreOrder()) {
-            if (o->isTableCell())
-                toRenderTableCell(o)->collectBorderStyles(borderStyles);
-        }
-        RenderTableCell::sortBorderStyles(borderStyles);
-        size_t count = borderStyles.size();
+        size_t count = m_collapsedBorders.size();
         for (size_t i = 0; i < count; ++i) {
-            m_currentBorder = &borderStyles[i];
+            m_currentBorder = &m_collapsedBorders[i];
             for (RenderObject* child = firstChild(); child; child = child->nextSibling())
                 if (child->isTableSection()) {
                     LayoutPoint childPoint = flipForWritingMode(toRenderTableSection(child), paintOffset, ParentToChildFlippingAdjustment);
index 8279cea..f18b840 100644 (file)
 #define RenderTable_h
 
 #include "CSSPropertyNames.h"
+#include "CollapsedBorderValue.h"
 #include "RenderBlock.h"
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
-class CollapsedBorderValue;
 class RenderTableCol;
 class RenderTableCell;
 class RenderTableSection;
@@ -200,7 +200,13 @@ public:
     RenderTableCell* cellBefore(const RenderTableCell*) const;
     RenderTableCell* cellAfter(const RenderTableCell*) const;
  
-    const CollapsedBorderValue* currentBorderStyle() const { return m_currentBorder; }
+    typedef Vector<CollapsedBorderValue> CollapsedBorderValues;
+    void invalidateCollapsedBorders()
+    {
+        m_collapsedBordersValid = false;
+        m_collapsedBorders.clear();
+    }
+    const CollapsedBorderValue* currentBorderValue() const { return m_currentBorder; }
     
     bool hasSections() const { return m_head || m_foot || m_firstBody; }
 
@@ -245,6 +251,7 @@ private:
 
     void subtractCaptionRect(LayoutRect&) const;
 
+    void recalcCollapsedBorders();
     void recalcCaption(RenderBlock*) const;
     void recalcSections() const;
     void adjustLogicalHeightForCaption();
@@ -259,7 +266,9 @@ private:
 
     OwnPtr<TableLayout> m_tableLayout;
 
+    CollapsedBorderValues m_collapsedBorders;
     const CollapsedBorderValue* m_currentBorder;
+    bool m_collapsedBordersValid : 1;
     
     mutable bool m_hasColElements : 1;
     mutable bool m_needsSectionRecalc : 1;
index 86af6ff..f1e2742 100644 (file)
@@ -317,6 +317,13 @@ void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* ol
 {
     RenderBlock::styleDidChange(diff, oldStyle);
     setHasBoxDecorations(true);
+
+    // If border was changed, notify table.
+    if (parent()) {
+        RenderTable* table = this->table();
+        if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout()&& oldStyle && oldStyle->border() != style()->border())
+            table->invalidateCollapsedBorders();
+    }
 }
 
 // The following rules apply for resolving conflicts and figuring out which border
@@ -871,26 +878,27 @@ public:
     int m_count;
 };
 
-static void addBorderStyle(RenderTableCell::CollapsedBorderStyles& borderStyles, CollapsedBorderValue borderValue)
+static void addBorderStyle(RenderTable::CollapsedBorderValues& borderValues,
+                           CollapsedBorderValue borderValue)
 {
     if (!borderValue.exists())
         return;
-    size_t count = borderStyles.size();
+    size_t count = borderValues.size();
     for (size_t i = 0; i < count; ++i)
-        if (borderStyles[i] == borderValue)
+        if (borderValues[i] == borderValue)
             return;
-    borderStyles.append(borderValue);
+    borderValues.append(borderValue);
 }
 
-void RenderTableCell::collectBorderStyles(CollapsedBorderStyles& borderStyles) const
+void RenderTableCell::collectBorderValues(RenderTable::CollapsedBorderValues& borderValues) const
 {
-    addBorderStyle(borderStyles, collapsedStartBorder());
-    addBorderStyle(borderStyles, collapsedEndBorder());
-    addBorderStyle(borderStyles, collapsedBeforeBorder());
-    addBorderStyle(borderStyles, collapsedAfterBorder());
+    addBorderStyle(borderValues, collapsedStartBorder());
+    addBorderStyle(borderValues, collapsedEndBorder());
+    addBorderStyle(borderValues, collapsedBeforeBorder());
+    addBorderStyle(borderValues, collapsedAfterBorder());
 }
 
-static int compareBorderStylesForQSort(const void* pa, const void* pb)
+static int compareBorderValuesForQSort(const void* pa, const void* pb)
 {
     const CollapsedBorderValue* a = static_cast<const CollapsedBorderValue*>(pa);
     const CollapsedBorderValue* b = static_cast<const CollapsedBorderValue*>(pb);
@@ -899,15 +907,15 @@ static int compareBorderStylesForQSort(const void* pa, const void* pb)
     return compareBorders(*a, *b);
 }
 
-void RenderTableCell::sortBorderStyles(CollapsedBorderStyles& borderStyles)
+void RenderTableCell::sortBorderValues(RenderTable::CollapsedBorderValues& borderValues)
 {
-    qsort(borderStyles.data(), borderStyles.size(), sizeof(CollapsedBorderValue),
-        compareBorderStylesForQSort);
+    qsort(borderValues.data(), borderValues.size(), sizeof(CollapsedBorderValue),
+        compareBorderValuesForQSort);
 }
 
 void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, const LayoutRect& paintRect)
 {
-    if (!table()->currentBorderStyle() || graphicsContext->paintingDisabled())
+    if (!table()->currentBorderValue() || graphicsContext->paintingDisabled())
         return;
     
     CollapsedBorderValue leftVal = collapsedLeftBorder();
@@ -947,7 +955,7 @@ void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, con
     bool antialias = shouldAntialiasLines(graphicsContext);
     
     for (CollapsedBorder* border = borders.nextBorder(); border; border = borders.nextBorder()) {
-        if (border->borderValue == *table()->currentBorderStyle())
+        if (border->borderValue == *table()->currentBorderValue())
             drawLineForBoxSide(graphicsContext, border->x1, border->y1, border->x2, border->y2, border->side, 
                                border->borderValue.color(), border->style, 0, 0, antialias);
     }
index 5b235d6..acae61a 100644 (file)
@@ -86,9 +86,8 @@ public:
     CollapsedBorderValue collapsedTopBorder() const;
     CollapsedBorderValue collapsedBottomBorder() const;
 
-    typedef Vector<CollapsedBorderValue, 100> CollapsedBorderStyles;
-    void collectBorderStyles(CollapsedBorderStyles&) const;
-    static void sortBorderStyles(CollapsedBorderStyles&);
+    void collectBorderValues(RenderTable::CollapsedBorderValues&) const;
+    static void sortBorderValues(RenderTable::CollapsedBorderValues&);
 
     virtual void updateFromElement();
 
index 8e99923..60cc5b9 100644 (file)
@@ -44,6 +44,18 @@ RenderTableCol::RenderTableCol(Node* node)
     updateFromElement();
 }
 
+void RenderTableCol::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
+{
+    RenderBox::styleDidChange(diff, oldStyle);
+
+    // If border was changed, notify table.
+    if (parent()) {
+        RenderTable* table = this->table();
+        if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style()->border())
+            table->invalidateCollapsedBorders();
+    }
+}
+
 void RenderTableCol::updateFromElement()
 {
     int oldSpan = m_span;
index c8a0630..220482f 100644 (file)
@@ -59,6 +59,8 @@ private:
     virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
     virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
 
+    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
     RenderTable* table() const;
 
     RenderObjectChildList m_children;
index e8b6272..d5264d1 100644 (file)
@@ -78,6 +78,13 @@ void RenderTableRow::styleDidChange(StyleDifference diff, const RenderStyle* old
 
     if (parent())
         updateBeforeAndAfterContent();
+
+    // If border was changed, notify table.
+    if (parent()) {
+        RenderTable* table = this->table();
+        if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style()->border())
+            table->invalidateCollapsedBorders();
+    }
 }
 
 void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild)
index 0badb82..77d0752 100644 (file)
@@ -81,6 +81,11 @@ void RenderTableSection::styleDidChange(StyleDifference diff, const RenderStyle*
 {
     RenderBox::styleDidChange(diff, oldStyle);
     propagateStyleToAnonymousChildren();
+
+    // If border was changed, notify table.
+    RenderTable* table = this->table();
+    if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style()->border())
+        table->invalidateCollapsedBorders();
 }
 
 void RenderTableSection::willBeDestroyed()