Unreviewed manual rollout of r107970 which breaks table column widths
authorvsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Feb 2012 14:03:14 +0000 (14:03 +0000)
committervsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Feb 2012 14:03:14 +0000 (14:03 +0000)
updates from javascript (e.g. inspector's network panel).

Source/WebCore:

* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::calcWidthArray):
* rendering/RenderTableCol.h:
(RenderTableCol):

LayoutTests:

* css2.1/20110323/fixed-table-layout-013-expected.html: Removed.
* css2.1/20110323/fixed-table-layout-013.htm: Removed.
* css2.1/20110323/fixed-table-layout-015-expected.html: Removed.
* css2.1/20110323/fixed-table-layout-015.htm: Removed.

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

LayoutTests/ChangeLog
LayoutTests/css2.1/20110323/fixed-table-layout-013-expected.html [deleted file]
LayoutTests/css2.1/20110323/fixed-table-layout-013.htm [deleted file]
LayoutTests/css2.1/20110323/fixed-table-layout-015-expected.html [deleted file]
LayoutTests/css2.1/20110323/fixed-table-layout-015.htm [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/rendering/FixedTableLayout.cpp
Source/WebCore/rendering/RenderTableCol.h

index bb42acb..85e4ada 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-20  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Unreviewed manual rollout of r107970 which breaks table column widths
+        updates from javascript (e.g. inspector's network panel).
+
+        * css2.1/20110323/fixed-table-layout-013-expected.html: Removed.
+        * css2.1/20110323/fixed-table-layout-013.htm: Removed.
+        * css2.1/20110323/fixed-table-layout-015-expected.html: Removed.
+        * css2.1/20110323/fixed-table-layout-015.htm: Removed.
+
 2012-02-20  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: DOMAttrModified should not be fired if the attribute value remains the same
diff --git a/LayoutTests/css2.1/20110323/fixed-table-layout-013-expected.html b/LayoutTests/css2.1/20110323/fixed-table-layout-013-expected.html
deleted file mode 100644 (file)
index 3583ec0..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-    <head>
-        <title>CSS Test: Reference Result</title>
-        <style type="text/css">
-            table
-            {
-                border-collapse: collapse;
-                table-layout: fixed;
-                width: 200px;
-            }
-            #cell
-            {
-                background: black;
-                width: 100px;
-            }
-            #div1
-            {
-                background: blue;
-                width: 100px;
-            }
-            #div1, #cell
-            {
-                height: 1em;
-            }
-        </style>
-    </head>
-    <body>
-        <p>Test passes if the boxes below are the same width.</p>
-        <table>
-            <tr>
-                <td id="cell"></td>
-                <td></td>
-           </tr>
-        </table>
-        <div id="div1"></div>
-    </body>
-</html>
\ No newline at end of file
diff --git a/LayoutTests/css2.1/20110323/fixed-table-layout-013.htm b/LayoutTests/css2.1/20110323/fixed-table-layout-013.htm
deleted file mode 100644 (file)
index 8dadc9a..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-    <head>
-        <title>CSS Test: Fixed table layout - specified column-group width</title>
-        <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
-        <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
-        <meta name="flags" content="">
-        <meta name="assert" content="Specified column-group width is ignored in fixed table layout.">
-        <style type="text/css">
-            table
-            {
-                border-collapse: collapse;
-                table-layout: fixed;
-                width: 200px;
-            }
-            #colgroup
-            {
-                width: 50px;
-            }
-            #cell
-            {
-                background: black;
-            }
-            #div1
-            {
-                background: blue;
-                width: 100px;
-            }
-            #div1, #cell
-            {
-                height: 1em;
-            }
-        </style>
-    </head>
-    <body>
-        <p>Test passes if the boxes below are the same width.</p>
-        <table>
-            <colgroup id="colgroup">
-                <col>
-            </colgroup>
-            <colgroup>
-                <col>
-            </colgroup>
-            <tr>
-                <td id="cell"></td>
-                <td></td>
-           </tr>
-        </table>
-        <div id="div1"></div>
-    </body>
-</html>
\ No newline at end of file
diff --git a/LayoutTests/css2.1/20110323/fixed-table-layout-015-expected.html b/LayoutTests/css2.1/20110323/fixed-table-layout-015-expected.html
deleted file mode 100644 (file)
index 5257815..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-    <head>
-        <title>CSS Test: Reference Result</title>
-        <style type="text/css">
-            table
-            {
-                border-spacing: 0;
-                table-layout: fixed;
-                width: 200px;
-            }
-            #cell
-            {
-                background: black;
-                width: 100px;
-            }
-            td
-            {
-                padding: 0;
-            }
-            #div1
-            {
-                background: blue;
-                width: 100px;
-            }
-            #div1, td
-            {
-                height: 1em;
-            }
-        </style>
-    </head>
-    <body>
-        <p>Test passes if the boxes below are the same width.</p>
-        <table>
-            <tr>
-                <td id="cell"></td>
-                <td></td>
-            </tr>
-        </table>
-        <div id="div1"></div>
-    </body>
-</html>
\ No newline at end of file
diff --git a/LayoutTests/css2.1/20110323/fixed-table-layout-015.htm b/LayoutTests/css2.1/20110323/fixed-table-layout-015.htm
deleted file mode 100644 (file)
index 24da520..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-    <head>
-        <title>CSS Test: Fixed table layout - specified cell width overrides specified column-group width</title>
-        <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
-        <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
-        <meta name="flags" content="">
-        <meta name="assert" content="A column that has both a cell width and column-group width specified will use its cell specified width.">
-        <style type="text/css">
-            table
-            {
-                border-spacing: 0;
-                table-layout: fixed;
-                width: 200px;
-            }
-            #colgroup
-            {
-                width: 75px;
-            }
-            #cell
-            {
-                background: black;
-                width: 100px;
-            }
-            td
-            {
-                padding: 0;
-            }
-            #div1
-            {
-                background: blue;
-                width: 100px;
-            }
-            #div1, td
-            {
-                height: 1em;
-            }
-        </style>
-    </head>
-    <body>
-        <p>Test passes if the boxes below are the same width.</p>
-        <table>
-            <colgroup id="colgroup">
-                <col>
-            </colgroup>
-            <colgroup>
-                <col>
-            </colgroup>
-            <tr>
-                <td id="cell"></td>
-                <td></td>
-            </tr>
-        </table>
-        <div id="div1"></div>
-    </body>
-</html>
\ No newline at end of file
index a8fca5c..0346700 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-20  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Unreviewed manual rollout of r107970 which breaks table column widths
+        updates from javascript (e.g. inspector's network panel).
+
+        * rendering/FixedTableLayout.cpp:
+        (WebCore::FixedTableLayout::calcWidthArray):
+        * rendering/RenderTableCol.h:
+        (RenderTableCol):
+
 2012-02-20  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: [Styles] Inconsistent alignment of non-parsed properties (having an exclamation mark)
index 22cefd2..fe97c63 100644 (file)
@@ -77,20 +77,6 @@ FixedTableLayout::FixedTableLayout(RenderTable* table)
 {
 }
 
-static RenderObject* findNextCol(RenderObject* child)
-{
-    // If child is a colgroup, the next col is the colgroup's first child col.
-    if (RenderObject* next = child->firstChild())
-        return next;
-    // Otherwise it's the next col along.
-    if (RenderObject* next = child->nextSibling())
-        return next;
-    // Failing that, the child is the last col in a colgroup, so the next col is the next col/colgroup after its colgroup.
-    if (child->parent()->isTableCol())
-        return child->parent()->nextSibling();
-    return 0;
-}
-
 int FixedTableLayout::calcWidthArray(int)
 {
     int usedWidth = 0;
@@ -102,43 +88,54 @@ int FixedTableLayout::calcWidthArray(int)
     m_width.fill(Length(Auto));
 
     unsigned currentEffectiveColumn = 0;
-    for (; child && child->isTableCol(); child = findNextCol(child)) {
-
-        // Width specified by column-groups does not affect column width in fixed layout tables
+    Length grpWidth;
+    while (child && child->isTableCol()) {
         RenderTableCol* col = toRenderTableCol(child);
-        if (col->isColGroup())
-            continue;
-        
-        Length colStyleLogicalWidth = col->style()->logicalWidth();
-        int effectiveColWidth = 0;
-        if (colStyleLogicalWidth.isFixed() && colStyleLogicalWidth.value() > 0)
-            effectiveColWidth = colStyleLogicalWidth.value();
-
-        unsigned span = col->span();
-        while (span) {
-            unsigned spanInCurrentEffectiveColumn;
-            if (currentEffectiveColumn >= nEffCols) {
-                m_table->appendColumn(span);
-                nEffCols++;
-                m_width.append(Length());
-                spanInCurrentEffectiveColumn = span;
-            } else {
-                if (span < m_table->spanOfEffCol(currentEffectiveColumn)) {
-                    m_table->splitColumn(currentEffectiveColumn, span);
+        if (col->firstChild())
+            grpWidth = col->style()->logicalWidth();
+        else {
+            Length w = col->style()->logicalWidth();
+            if (w.isAuto())
+                w = grpWidth;
+            int effWidth = 0;
+            if (w.isFixed() && w.value() > 0)
+                effWidth = w.value();
+
+            unsigned span = col->span();
+            while (span) {
+                unsigned spanInCurrentEffectiveColumn;
+                if (currentEffectiveColumn >= nEffCols) {
+                    m_table->appendColumn(span);
                     nEffCols++;
                     m_width.append(Length());
+                    spanInCurrentEffectiveColumn = span;
+                } else {
+                    if (span < m_table->spanOfEffCol(currentEffectiveColumn)) {
+                        m_table->splitColumn(currentEffectiveColumn, span);
+                        nEffCols++;
+                        m_width.append(Length());
+                    }
+                    spanInCurrentEffectiveColumn = m_table->spanOfEffCol(currentEffectiveColumn);
                 }
-                spanInCurrentEffectiveColumn = m_table->spanOfEffCol(currentEffectiveColumn);
-            }
-            if ((colStyleLogicalWidth.isFixed() || colStyleLogicalWidth.isPercent()) && colStyleLogicalWidth.isPositive()) {
-                m_width[currentEffectiveColumn] = colStyleLogicalWidth;
-                m_width[currentEffectiveColumn] *= spanInCurrentEffectiveColumn;
-                usedWidth += effectiveColWidth * spanInCurrentEffectiveColumn;
+                if ((w.isFixed() || w.isPercent()) && w.isPositive()) {
+                    m_width[currentEffectiveColumn] = w;
+                    m_width[currentEffectiveColumn] *= spanInCurrentEffectiveColumn;
+                    usedWidth += effWidth * spanInCurrentEffectiveColumn;
+                }
+                span -= spanInCurrentEffectiveColumn;
+                currentEffectiveColumn++;
             }
-            span -= spanInCurrentEffectiveColumn;
-            currentEffectiveColumn++;
         }
         col->computePreferredLogicalWidths();
+
+        RenderObject* next = child->firstChild();
+        if (!next)
+            next = child->nextSibling();
+        if (!next && child->parent()->isTableCol()) {
+            next = child->parent()->nextSibling();
+            grpWidth = Length();
+        }
+        child = next;
     }
 
     // Iterate over the first row in case some are unspecified.
@@ -155,9 +152,9 @@ int FixedTableLayout::calcWidthArray(int)
 
                 Length w = cell->styleOrColLogicalWidth();
                 unsigned span = cell->colSpan();
-                int effectiveColWidth = 0;
+                int effWidth = 0;
                 if (w.isFixed() && w.isPositive())
-                    effectiveColWidth = w.value();
+                    effWidth = w.value();
                 
                 unsigned usedSpan = 0;
                 unsigned i = 0;
@@ -167,7 +164,7 @@ int FixedTableLayout::calcWidthArray(int)
                     if (m_width[cCol + i].isAuto() && w.type() != Auto) {
                         m_width[cCol + i] = w;
                         m_width[cCol + i] *= eSpan / span;
-                        usedWidth += effectiveColWidth * eSpan / span;
+                        usedWidth += effWidth * eSpan / span;
                     }
                     usedSpan += eSpan;
                     i++;
index f26e88f..76c28a3 100644 (file)
@@ -43,7 +43,7 @@ public:
 
     unsigned span() const { return m_span; }
     void setSpan(unsigned span) { m_span = span; }
-    bool isColGroup() { return firstChild(); }
+
 private:
     virtual RenderObjectChildList* virtualChildren() { return children(); }
     virtual const RenderObjectChildList* virtualChildren() const { return children(); }