Title: [97074] trunk
Revision
97074
Author
infe...@chromium.org
Date
2011-10-10 11:58:12 -0700 (Mon, 10 Oct 2011)

Log Message

Handle insertion into an anonymous table part that
is followed by a non-anonymous block correctly.
https://bugs.webkit.org/show_bug.cgi?id=69536

Reviewed by Dan Bernstein.

Source/WebCore: 

Tests: fast/table/table-insert-before-non-anonymous-block.html

* rendering/RenderTable.cpp:
(WebCore::RenderTable::addChild):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::addChild):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::addChild):
(WebCore::RenderTableSection::splitColumn):

LayoutTests: 

* fast/table/table-insert-before-non-anonymous-block-expected.png: Added.
* fast/table/table-insert-before-non-anonymous-block-expected.txt: Added.
* fast/table/table-insert-before-non-anonymous-block.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97073 => 97074)


--- trunk/LayoutTests/ChangeLog	2011-10-10 18:56:48 UTC (rev 97073)
+++ trunk/LayoutTests/ChangeLog	2011-10-10 18:58:12 UTC (rev 97074)
@@ -1,3 +1,15 @@
+2011-10-10  Abhishek Arya  <infe...@chromium.org>
+
+        Handle insertion into an anonymous table part that
+        is followed by a non-anonymous block correctly.
+        https://bugs.webkit.org/show_bug.cgi?id=69536
+
+        Reviewed by Dan Bernstein.
+
+        * fast/table/table-insert-before-non-anonymous-block-expected.png: Added.
+        * fast/table/table-insert-before-non-anonymous-block-expected.txt: Added.
+        * fast/table/table-insert-before-non-anonymous-block.html: Added.
+
 2011-10-10  Pavel Feldman  <pfeld...@google.com>
 
         Web Inspector: annotate DOMAgent, Debugger(Presentation)Model with types.

Added: trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block-expected.txt (0 => 97074)


--- trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block-expected.txt	2011-10-10 18:58:12 UTC (rev 97074)
@@ -0,0 +1,55 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x466
+  RenderBlock {HTML} at (0,0) size 800x466
+    RenderBody {BODY} at (8,8) size 784x450
+      RenderTable {DIV} at (0,0) size 100x50
+        RenderTableSection (anonymous) at (0,0) size 100x50
+          RenderTableRow (anonymous) at (0,0) size 100x50
+            RenderTableCell {DIV} at (0,0) size 50x0 [bgcolor=#0000FF] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
+        RenderTableSection {DIV} at (0,50) size 100x0
+      RenderTable {DIV} at (0,50) size 100x50
+        RenderTableSection (anonymous) at (0,0) size 100x50
+          RenderTableRow (anonymous) at (0,0) size 100x50
+            RenderTableCell {DIV} at (0,0) size 50x0 [bgcolor=#0000FF] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
+          RenderTableRow {DIV} at (0,50) size 100x0
+      RenderTable {DIV} at (0,100) size 100x50
+        RenderTableSection (anonymous) at (0,0) size 100x50
+          RenderTableRow (anonymous) at (0,0) size 100x50
+            RenderTableCell {DIV} at (0,0) size 50x0 [bgcolor=#0000FF] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
+        RenderBlock {DIV} at (0,0) size 100x0
+      RenderTable {DIV} at (0,150) size 100x50
+        RenderTableSection (anonymous) at (0,0) size 100x50
+          RenderTableRow (anonymous) at (0,0) size 100x50
+            RenderTableCell {DIV} at (0,0) size 50x0 [bgcolor=#0000FF] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
+        RenderTableCol {DIV} at (0,0) size 0x0
+      RenderTable {DIV} at (0,200) size 50x50
+        RenderTableSection (anonymous) at (0,0) size 50x50
+          RenderTableRow (anonymous) at (0,0) size 50x50
+            RenderTableCell {DIV} at (0,0) size 50x0 [bgcolor=#0000FF] [r=0 c=0 rs=1 cs=1]
+          RenderTableRow {DIV} at (0,50) size 50x0
+        RenderTableSection {DIV} at (0,50) size 50x0
+      RenderTable {DIV} at (0,250) size 100x50
+        RenderTableSection (anonymous) at (0,0) size 100x50
+          RenderTableRow (anonymous) at (0,0) size 100x50
+            RenderTableCell {DIV} at (0,0) size 50x0 [bgcolor=#0000FF] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
+        RenderTableCol {DIV} at (0,0) size 0x0
+      RenderTable {DIV} at (0,300) size 101x50
+        RenderTableSection (anonymous) at (0,0) size 101x50
+          RenderTableRow (anonymous) at (0,0) size 101x50
+            RenderTableCell {DIV} at (0,0) size 50x0 [bgcolor=#0000FF] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell (anonymous) at (100,0) size 1x0 [r=0 c=2 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 1x0
+      RenderTable {DIV} at (0,350) size 100x100
+        RenderTableSection (anonymous) at (0,0) size 100x100
+          RenderTableRow (anonymous) at (0,0) size 100x100
+            RenderTableCell (anonymous) at (0,0) size 50x100 [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#0000FF]
+              RenderBlock {DIV} at (0,50) size 50x50 [bgcolor=#0000FF]
+            RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]

Added: trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block.html (0 => 97074)


--- trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block.html	2011-10-10 18:58:12 UTC (rev 97074)
@@ -0,0 +1,116 @@
+<!DOCTYPE html>
+<html>
+<body style="font-family: ahem; -webkit-font-smoothing: none;">
+<style>
+    div.table { display: table; }
+    div.section { display: table-row-group; }
+    div.caption { display: table-caption; }
+    div.colgroup { display: table-column-group; }
+    div.col { display: table-column; }
+    div.cell { display: table-cell; width: 50px; height: 50px; background-color: blue; }
+    div.row { display: table-row; }
+    div.block { width: 50px; height: 50px; background-color: blue; }
+</style>
+
+<div class="table" id="table-1">
+    <div class="cell"></div>
+    <div class="section" id="tbody-1">
+    </div>
+</div>
+
+<div class="table" id="table-2">
+    <div class="cell"></div>
+    <div class="row" id="row"></div>
+</div>
+
+<div class="table" id="table-3">
+    <div class="cell"></div>
+    <div class="caption" id="caption">
+    </div>
+</div>
+
+<div class="table" id="table-4">
+    <div class="cell"></div>
+    <div class="colgroup" id="colgroup">
+    </div>
+</div>
+
+<div class="table" id="table-5">
+    <div class="cell"></div>
+    <div class="section" id="tbody-5">
+    </div>
+</div>
+
+<div class="table" id="table-6">
+    <div class="cell"></div>
+    <div class="col" id="col-6">
+    </div>
+</div>
+
+<div class="table" id="table-7">
+    <div class="cell"></div>
+    <div id="block">
+    </div>
+</div>
+
+<div class="table" id="table-8">
+    <div class="block"></div>
+    <div class="cell" id="cell"></div>
+</div>
+
+<script>
+    function createCell()
+    {
+        var cell = document.createElement("div");
+        cell.className = "cell";
+        return cell;
+    }
+
+    function insertCell(tableID, beforeID)
+    {
+        var table = document.getElementById(tableID);
+        var before = document.getElementById(beforeID);
+        table.insertBefore(createCell(), before);
+    }
+
+    function createRow()
+    {
+        var row = document.createElement("div");
+        row.className = "row";
+        return row;
+    }
+
+    function insertRow(tableID, beforeID)
+    {
+        var table = document.getElementById(tableID);
+        var before = document.getElementById(beforeID);
+        table.insertBefore(createRow(), before);
+    }
+
+    function createBlock()
+    {
+        var block = document.createElement("div");
+        block.className = "block";
+        return block;
+    }
+
+    function insertBlock(tableID, beforeID)
+    {
+        var table = document.getElementById(tableID);
+        var before = document.getElementById(beforeID);
+        table.insertBefore(createBlock(), before);
+    }
+
+    document.body.offsetTop;
+
+    insertCell("table-1", "tbody-1");
+    insertCell("table-2", "row");
+    insertCell("table-3", "caption");
+    insertCell("table-4", "colgroup");
+    insertRow("table-5", "tbody-5");
+    insertCell("table-6", "col-6");
+    insertCell("table-7", "block");
+    insertBlock("table-8", "cell");
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (97073 => 97074)


--- trunk/Source/WebCore/ChangeLog	2011-10-10 18:56:48 UTC (rev 97073)
+++ trunk/Source/WebCore/ChangeLog	2011-10-10 18:58:12 UTC (rev 97074)
@@ -1,3 +1,21 @@
+2011-10-10  Abhishek Arya  <infe...@chromium.org>
+
+        Handle insertion into an anonymous table part that
+        is followed by a non-anonymous block correctly.
+        https://bugs.webkit.org/show_bug.cgi?id=69536
+
+        Reviewed by Dan Bernstein.
+
+        Tests: fast/table/table-insert-before-non-anonymous-block.html
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::addChild):
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::addChild):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::addChild):
+        (WebCore::RenderTableSection::splitColumn):
+
 2011-10-10  Kent Tamura  <tk...@chromium.org>
 
         Make static functions in HTMLSelectElement.cpp member functions of HTMLSelectElement class

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (97073 => 97074)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2011-10-10 18:56:48 UTC (rev 97073)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2011-10-10 18:58:12 UTC (rev 97074)
@@ -184,6 +184,15 @@
         return;
     }
 
+    if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) {
+        RenderObject* section = beforeChild->previousSibling();
+        if (section && section->isTableSection()) {
+            ASSERT(section->isAnonymous());
+            section->addChild(child);
+            return;
+        }
+    }
+
     RenderObject* lastBox = beforeChild;
     while (lastBox && lastBox->parent()->isAnonymous() && !lastBox->isTableSection() && lastBox->style()->display() != TABLE_CAPTION && lastBox->style()->display() != TABLE_COLUMN_GROUP)
         lastBox = lastBox->parent();

Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (97073 => 97074)


--- trunk/Source/WebCore/rendering/RenderTableRow.cpp	2011-10-10 18:56:48 UTC (rev 97073)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp	2011-10-10 18:58:12 UTC (rev 97074)
@@ -104,6 +104,15 @@
             return;
         }
 
+        if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) {
+            RenderObject* cell = beforeChild->previousSibling();
+            if (cell && cell->isTableCell()) {
+                ASSERT(cell->isAnonymous());
+                cell->addChild(child);
+                return;
+            }
+        }
+
         // If beforeChild is inside an anonymous cell, insert into the cell.
         if (last && !last->isTableCell() && last->parent() && last->parent()->isAnonymous() && !last->parent()->isBeforeOrAfterContent()) {
             last->parent()->addChild(child, beforeChild);

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (97073 => 97074)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2011-10-10 18:56:48 UTC (rev 97073)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2011-10-10 18:58:12 UTC (rev 97074)
@@ -117,6 +117,15 @@
             return;
         }
 
+        if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) {
+            RenderObject* row = beforeChild->previousSibling();
+            if (row && row->isTableRow()) {
+                ASSERT(row->isAnonymous());
+                row->addChild(child);
+                return;
+            }
+        }
+
         // If beforeChild is inside an anonymous cell/row, insert into the cell or into
         // the anonymous row containing it, if there is one.
         RenderObject* lastBox = last;
@@ -1178,6 +1187,8 @@
 
 void RenderTableSection::splitColumn(int pos, int first)
 {
+    ASSERT(!m_needsCellRecalc);
+
     if (m_cCol > pos)
         m_cCol++;
     for (int row = 0; row < m_gridRows; ++row) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to