Hit ASSERTION FAILED: table()->collapseBorders() on techcrunch.com
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 20:27:08 +0000 (20:27 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 20:27:08 +0000 (20:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76405

Reviewed by Julien Chaffraix.

Source/WebCore:

Tests: fast/css/nested-table-with-collapsed-borders.html

Change recalcCollapsedBorders() so that it only collects border values for the current
table. Calculating the borders for nested tables was wrong as well as wasting cycles, though it would never
have impacted rendering since a cell only paints the borders that match its own.

* rendering/RenderTable.cpp:
(WebCore::RenderTable::recalcCollapsedBorders):

LayoutTests:

* fast/css/nested-table-with-collapsed-borders-expected.html: Added.
* fast/css/nested-table-with-collapsed-borders.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/nested-table-with-collapsed-borders-expected.html [new file with mode: 0644]
LayoutTests/fast/css/nested-table-with-collapsed-borders.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTable.cpp

index 971f22b..dada9e0 100644 (file)
@@ -1,3 +1,13 @@
+2012-01-18  Robert Hogan  <robert@webkit.org>
+
+        Hit ASSERTION FAILED: table()->collapseBorders() on techcrunch.com
+        https://bugs.webkit.org/show_bug.cgi?id=76405
+
+        Reviewed by Julien Chaffraix.
+
+        * fast/css/nested-table-with-collapsed-borders-expected.html: Added.
+        * fast/css/nested-table-with-collapsed-borders.html: Added.
+
 2012-01-19  David Hyatt  <hyatt@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=76644
diff --git a/LayoutTests/fast/css/nested-table-with-collapsed-borders-expected.html b/LayoutTests/fast/css/nested-table-with-collapsed-borders-expected.html
new file mode 100644 (file)
index 0000000..1feec51
--- /dev/null
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>This test will assert if a parent table attempts to calculate collapsed borders 
+               for a cell in a nested table that does not have collapsed borders.</title>
+        <style type="text/css">
+            #table1
+            {
+                border-collapse: collapse;
+                height: 2in;
+                width: 2in;
+            }
+            #table2
+            {
+                height: 2in;
+                width: 2in;
+            }
+            td
+            {
+                border: 5px solid black;
+            }
+        </style>
+    </head>
+    <body>
+        <table id="table1">
+            <tr>
+                <td></td>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td>
+                    <table id="table2">
+                        <tr>
+                            <td></td>
+                            <td></td>
+                            <td></td>
+                        </tr>
+                    </table>
+                </td>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td></td>
+                <td></td>
+                <td></td>
+            </tr>
+        </table>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/css/nested-table-with-collapsed-borders.html b/LayoutTests/fast/css/nested-table-with-collapsed-borders.html
new file mode 100644 (file)
index 0000000..785401a
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>This test will assert if a parent table attempts to calculate the collapsed borders of a nested table.</title>
+        <style type="text/css">
+            #table1
+            {
+                border-collapse: collapse;
+                height: 2in;
+                width: 2in;
+            }
+            #table2
+            {
+                height: 2in;
+                width: 2in;
+            }
+            td
+            {
+                border: 5px solid black;
+            }
+        </style>
+    </head>
+    <body>
+        <table id="table1">
+            <tr>
+                <td></td>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td>
+                    <table id="table2">
+                        <tr>
+                            <td></td>
+                            <td></td>
+                            <td></td>
+                        </tr>
+                    </table>
+                </td>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td></td>
+                <td></td>
+                <td></td>
+            </tr>
+        </table>
+    </body>
+</html>
\ No newline at end of file
index 7b66da0..efab1ba 100755 (executable)
@@ -1,3 +1,19 @@
+2012-01-18  Robert Hogan  <robert@webkit.org>
+
+        Hit ASSERTION FAILED: table()->collapseBorders() on techcrunch.com
+        https://bugs.webkit.org/show_bug.cgi?id=76405
+
+        Reviewed by Julien Chaffraix.
+
+        Tests: fast/css/nested-table-with-collapsed-borders.html
+
+        Change recalcCollapsedBorders() so that it only collects border values for the current
+        table. Calculating the borders for nested tables was wrong as well as wasting cycles, though it would never
+        have impacted rendering since a cell only paints the borders that match its own.
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::recalcCollapsedBorders):
+
 2012-01-18  Jer Noble  <jer.noble@apple.com>
 
         Make WebAudio API const-correct.
index a8eef9d..a56c75d 100644 (file)
@@ -447,10 +447,19 @@ void RenderTable::recalcCollapsedBorders()
         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);
+    for (RenderObject* section = firstChild(); section; section = section->nextSibling()) {
+        if (!section->isTableSection())
+            continue;
+        for (RenderObject* row = section->firstChild(); row; row = row->nextSibling()) {
+            if (!row->isTableRow())
+                continue;
+            for (RenderObject* cell = row->firstChild(); cell; cell = cell->nextSibling()) {
+                if (!cell->isTableCell())
+                    continue;
+                ASSERT(cell->table() == this);
+                toRenderTableCell(cell)->collectBorderValues(m_collapsedBorders);
+            }
+        }
     }
     RenderTableCell::sortBorderValues(m_collapsedBorders);
 }