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
+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
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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]
--- /dev/null
+<!--
+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>
+
--- /dev/null
+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
+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
, 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)
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)
updateLayerTransform();
+ // Layout was changed, so probably borders too.
+ invalidateCollapsedBorders();
+
computeOverflow(clientLogicalBottom());
statePusher.pop();
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.
}
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);
#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;
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; }
void subtractCaptionRect(LayoutRect&) const;
+ void recalcCollapsedBorders();
void recalcCaption(RenderBlock*) const;
void recalcSections() const;
void adjustLogicalHeightForCaption();
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;
{
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
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);
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();
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);
}
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();
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;
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;
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)
{
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()