Title: [100473] trunk
Revision
100473
Author
rob...@webkit.org
Date
2011-11-16 11:11:56 -0800 (Wed, 16 Nov 2011)

Log Message

CSS 2.1 failure: border-collapse-offset-002.htm fails
https://bugs.webkit.org/show_bug.cgi?id=71705

Source/WebCore:

Table captions are implemented as children of the table but have a special
requirement to expand to the full width of the table rather than just the 'available'
width, i.e. the full width minus padding and borders.

To accomodate this create a RenderTableCaption object that reimplements containingBlockLogicalWidthForContent()
to return the full width of the containing block (i.e. the table) rather than the available width.

Reviewed by Antti Koivisto.

* CMakeLists.txt: Add RenderTableCaption.[cpp|h]
* GNUmakefile.list.am: Add RenderTableCaption.[cpp|h]
* Target.pri: Add RenderTableCaption.[cpp|h]
* WebCore.gypi: Add RenderTableCaption.[cpp|h]
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks): Use RenderTableCaption
* rendering/RenderObject.cpp:
(WebCore::RenderObject::createObject): Add RenderTableCaption.[cpp|h]
(WebCore::RenderObject::addChild): ditto
* rendering/RenderObject.h:
(WebCore::RenderObject::isTableCaption):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::addChild):
* rendering/RenderTable.h:
* rendering/RenderTableCaption.cpp: Added.
(WebCore::RenderTableCaption::RenderTableCaption): Implement RenderTableCaption
(WebCore::RenderTableCaption::~RenderTableCaption):
(WebCore::RenderTableCaption::containingBlockLogicalWidthForContent): Return the containing block's full width rather than it's available width.
* rendering/RenderTableCaption.h: Added.
(WebCore::RenderTableCaption::isTableCaption):
(WebCore::toRenderTableCaption):

LayoutTests:

Table captions now use the width of the table rather than the width of the table minus
the borders. This allows captions to center accurately but unfortunately a lot of mozilla
table tests need to be rebaselined as many of them use captions for explaining the purpose
of individual test files!

Add border-collapse-offset-002.htm which now renders correctly.

Affected tables/mozilla tests are rebaselined in a follow-up patch.

Reviewed by Antti Koivisto.

* css2.1/20110323/border-collapse-offset-002.htm: Added.
* platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt: Added.
* platform/chromium-linux/fast/dom/HTMLTableElement/colSpan-expected.png:
* platform/chromium-linux/fast/dom/HTMLTableElement/createCaption-expected.png:
* platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt:
* platform/chromium-win/fast/dom/HTMLTableElement/colSpan-expected.txt:
* platform/chromium-win/fast/dom/HTMLTableElement/createCaption-expected.txt:
* platform/mac/fast/repaint/table-section-repaint-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (100472 => 100473)


--- trunk/LayoutTests/ChangeLog	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/LayoutTests/ChangeLog	2011-11-16 19:11:56 UTC (rev 100473)
@@ -1,3 +1,29 @@
+2011-11-08  Robert Hogan  <rob...@webkit.org>
+
+        CSS 2.1 failure: border-collapse-offset-002.htm fails
+        https://bugs.webkit.org/show_bug.cgi?id=71705
+
+        Table captions now use the width of the table rather than the width of the table minus
+        the borders. This allows captions to center accurately but unfortunately a lot of mozilla
+        table tests need to be rebaselined as many of them use captions for explaining the purpose 
+        of individual test files!
+        
+        Add border-collapse-offset-002.htm which now renders correctly.
+
+        Affected tables/mozilla tests are rebaselined in a follow-up patch.
+
+        Reviewed by Antti Koivisto.
+
+        * css2.1/20110323/border-collapse-offset-002.htm: Added.
+        * platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png: Added.
+        * platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt: Added.
+        * platform/chromium-linux/fast/dom/HTMLTableElement/colSpan-expected.png:
+        * platform/chromium-linux/fast/dom/HTMLTableElement/createCaption-expected.png:
+        * platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt:
+        * platform/chromium-win/fast/dom/HTMLTableElement/colSpan-expected.txt:
+        * platform/chromium-win/fast/dom/HTMLTableElement/createCaption-expected.txt:
+        * platform/mac/fast/repaint/table-section-repaint-expected.txt:
+
 2011-11-16  Sergey Glazunov  <serg.glazu...@gmail.com>
 
         ScriptController::executeIfJavaScriptURL gets confused by synchronous frame loads

Added: trunk/LayoutTests/css2.1/20110323/border-collapse-offset-002.htm (0 => 100473)


--- trunk/LayoutTests/css2.1/20110323/border-collapse-offset-002.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/border-collapse-offset-002.htm	2011-11-16 19:11:56 UTC (rev 100473)
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html><head>
+    <title>CSS Test: border collapse</title>
+    <link rel="author" title="Bernd Mielke" href=""
+    <link rel="help" href=""
+    <link rel="match" href=""
+    <meta name="flags" content="">
+<style type="text/css">
+td {width: 100px; text-align:center}
+caption {border:solid 4px green}
+
+</style>
+</head>
+
+<body>
+
+<table style="border-collapse:collapse;"><caption>caption</caption>
+  <tbody><tr><td style="border:solid 4px orange; height:30px">cell 1</td></tr>
+</tbody></table>
+
+
+
+</body></html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/border-collapse-offset-002.htm
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/platform/chromium-linux/fast/dom/HTMLTableElement/colSpan-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/dom/HTMLTableElement/createCaption-expected.png


(Binary files differ)

Added: trunk/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt (0 => 100473)


--- trunk/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt	2011-11-16 19:11:56 UTC (rev 100473)
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x84
+  RenderBlock {HTML} at (0,0) size 800x84
+    RenderBody {BODY} at (8,8) size 784x68
+      RenderTable {TABLE} at (0,0) size 110x68 [border: (2px none #808080)]
+        RenderBlock {CAPTION} at (0,0) size 110x28 [border: (4px solid #008000)]
+          RenderText {#text} at (33,4) size 44x19
+            text run at (33,4) width 44: "caption"
+        RenderTableSection {TBODY} at (2,30) size 106x36
+          RenderTableRow {TR} at (0,0) size 106x36
+            RenderTableCell {TD} at (0,5) size 106x26 [border: (2px solid #FFA500)] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (37,3) size 32x19
+                text run at (37,3) width 32: "cell 1"
Property changes on: trunk/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt (100472 => 100473)


--- trunk/LayoutTests/platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/LayoutTests/platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt	2011-11-16 19:11:56 UTC (rev 100473)
@@ -179,9 +179,9 @@
         RenderText {#text} at (0,0) size 389x19
           text run at (0,0) width 389: "The following 2 tables should be identical, ignorning whitespaces:"
       RenderTable {TABLE} at (1,1008) size 80x72 [border: (1px solid #808080)]
-        RenderBlock {CAPTION} at (0,0) size 78x20
-          RenderText {#text} at (-2,0) size 80x19
-            text run at (-2,0) width 80: "NormalTable"
+        RenderBlock {CAPTION} at (0,0) size 80x20
+          RenderText {#text} at (0,0) size 80x19
+            text run at (0,0) width 80: "NormalTable"
         RenderTableSection {TBODY} at (1,21) size 78x50
           RenderTableRow {TR} at (0,2) size 78x22
             RenderTableCell {TD} at (42,2) size 34x22 [r=0 c=0 rs=1 cs=1]
@@ -198,9 +198,9 @@
               RenderText {#text} at (13,1) size 24x19
                 text run at (13,1) width 24: "opq"
       RenderTable {DIV} at (1,1081) size 135x62 [border: (1px solid #000000)]
-        RenderBlock {DIV} at (0,0) size 133x20
-          RenderText {#text} at (-2,0) size 135x19
-            text run at (-2,0) width 135: "AnonymousTableRow"
+        RenderBlock {DIV} at (0,0) size 135x20
+          RenderText {#text} at (0,0) size 135x19
+            text run at (0,0) width 135: "AnonymousTableRow"
         RenderTableSection (anonymous) at (1,21) size 133x40
           RenderTableRow {DIV} at (0,0) size 133x20
             RenderTableCell {DIV} at (70,0) size 63x20 [r=0 c=0 rs=1 cs=1]

Modified: trunk/LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/colSpan-expected.txt (100472 => 100473)


--- trunk/LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/colSpan-expected.txt	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/colSpan-expected.txt	2011-11-16 19:11:56 UTC (rev 100473)
@@ -27,9 +27,9 @@
       RenderBlock (anonymous) at (0,218) size 784x20
         RenderBR {BR} at (0,0) size 0x19
       RenderTable {TABLE} at (0,238) size 255x76 [border: (1px outset #808080)]
-        RenderBlock {CAPTION} at (0,0) size 253x20
-          RenderText {#text} at (26,0) size 201x19
-            text run at (26,0) width 201: "Testing Default and Regular Input"
+        RenderBlock {CAPTION} at (0,0) size 255x20
+          RenderText {#text} at (27,0) size 201x19
+            text run at (27,0) width 201: "Testing Default and Regular Input"
         RenderTableSection {TBODY} at (1,21) size 253x54
           RenderTableRow {TR} at (0,2) size 253x24
             RenderTableCell {TD} at (2,2) size 31x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
@@ -66,9 +66,9 @@
       RenderBlock (anonymous) at (0,314) size 784x20
         RenderBR {BR} at (0,0) size 0x19
       RenderTable {TABLE} at (0,334) size 189x76 [border: (1px outset #808080)]
-        RenderBlock {CAPTION} at (0,0) size 187x20
-          RenderText {#text} at (14,0) size 159x19
-            text run at (14,0) width 159: "Testing Zero Special Case"
+        RenderBlock {CAPTION} at (0,0) size 189x20
+          RenderText {#text} at (15,0) size 159x19
+            text run at (15,0) width 159: "Testing Zero Special Case"
         RenderTableSection {TBODY} at (1,21) size 187x54
           RenderTableRow {TR} at (0,2) size 187x24
             RenderTableCell {TD} at (2,2) size 42x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]

Modified: trunk/LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/createCaption-expected.txt (100472 => 100473)


--- trunk/LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/createCaption-expected.txt	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/createCaption-expected.txt	2011-11-16 19:11:56 UTC (rev 100473)
@@ -31,10 +31,10 @@
           text run at (0,20) width 549: "failure, the first table will have no caption, and the second table will have the caption Things."
       RenderBlock {HR} at (0,168) size 784x2 [border: (1px inset #000000)]
       RenderTable {TABLE} at (0,178) size 104x102 [border: (1px outset #808080)]
-        RenderBlock {CAPTION} at (0,0) size 102x20
+        RenderBlock {CAPTION} at (0,0) size 104x20
           RenderInline {B} at (0,0) size 40x19
-            RenderText {#text} at (31,0) size 40x19
-              text run at (31,0) width 40: "Fruity"
+            RenderText {#text} at (32,0) size 40x19
+              text run at (32,0) width 40: "Fruity"
         RenderTableSection {TBODY} at (1,21) size 102x80
           RenderTableRow {TR} at (0,2) size 102x24
             RenderTableCell {TH} at (2,2) size 49x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
@@ -60,10 +60,10 @@
       RenderBlock (anonymous) at (0,280) size 784x20
         RenderBR {BR} at (0,0) size 0x19
       RenderTable {TABLE} at (0,300) size 129x102 [border: (1px outset #808080)]
-        RenderBlock {CAPTION} at (0,0) size 127x20
+        RenderBlock {CAPTION} at (0,0) size 129x20
           RenderInline {B} at (0,0) size 77x19
-            RenderText {#text} at (25,0) size 77x19
-              text run at (25,0) width 77: "Vegetabley"
+            RenderText {#text} at (26,0) size 77x19
+              text run at (26,0) width 77: "Vegetabley"
         RenderTableSection {TBODY} at (1,21) size 127x80
           RenderTableRow {TR} at (0,2) size 127x24
             RenderTableCell {TH} at (2,2) size 72x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]

Modified: trunk/LayoutTests/platform/mac/fast/repaint/table-section-repaint-expected.txt (100472 => 100473)


--- trunk/LayoutTests/platform/mac/fast/repaint/table-section-repaint-expected.txt	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/LayoutTests/platform/mac/fast/repaint/table-section-repaint-expected.txt	2011-11-16 19:11:56 UTC (rev 100473)
@@ -36,7 +36,7 @@
 layer at (8,308) size 90x90
   RenderBlock (relative positioned) {DIV} at (0,300) size 90x90
     RenderTable {TABLE} at (0,0) size 60x83 [border: (4px solid #008000)]
-      RenderBlock {CAPTION} at (21,0) size 10x15
+      RenderBlock {CAPTION} at (25,0) size 10x15
         RenderBlock {DIV} at (0,0) size 10x15
       RenderTableSection {TBODY} at (4,19) size 52x60
         RenderTableRow {TR} at (0,0) size 52x30

Modified: trunk/Source/WebCore/CMakeLists.txt (100472 => 100473)


--- trunk/Source/WebCore/CMakeLists.txt	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/CMakeLists.txt	2011-11-16 19:11:56 UTC (rev 100473)
@@ -1282,6 +1282,7 @@
     rendering/RenderSlider.cpp
     rendering/RenderSummary.cpp
     rendering/RenderTable.cpp
+    rendering/RenderTableCaption.cpp
     rendering/RenderTableCell.cpp
     rendering/RenderTableCol.cpp
     rendering/RenderTableRow.cpp

Modified: trunk/Source/WebCore/ChangeLog (100472 => 100473)


--- trunk/Source/WebCore/ChangeLog	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/ChangeLog	2011-11-16 19:11:56 UTC (rev 100473)
@@ -1,3 +1,39 @@
+2011-11-08  Robert Hogan  <rob...@webkit.org>
+
+        CSS 2.1 failure: border-collapse-offset-002.htm fails
+        https://bugs.webkit.org/show_bug.cgi?id=71705
+
+        Table captions are implemented as children of the table but have a special
+        requirement to expand to the full width of the table rather than just the 'available'
+        width, i.e. the full width minus padding and borders.
+
+        To accomodate this create a RenderTableCaption object that reimplements containingBlockLogicalWidthForContent()
+        to return the full width of the containing block (i.e. the table) rather than the available width.
+
+        Reviewed by Antti Koivisto.
+
+        * CMakeLists.txt: Add RenderTableCaption.[cpp|h]
+        * GNUmakefile.list.am: Add RenderTableCaption.[cpp|h]
+        * Target.pri: Add RenderTableCaption.[cpp|h]
+        * WebCore.gypi: Add RenderTableCaption.[cpp|h]
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks): Use RenderTableCaption
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::createObject): Add RenderTableCaption.[cpp|h]
+        (WebCore::RenderObject::addChild): ditto
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isTableCaption):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::addChild):
+        * rendering/RenderTable.h:
+        * rendering/RenderTableCaption.cpp: Added.
+        (WebCore::RenderTableCaption::RenderTableCaption): Implement RenderTableCaption
+        (WebCore::RenderTableCaption::~RenderTableCaption):
+        (WebCore::RenderTableCaption::containingBlockLogicalWidthForContent): Return the containing block's full width rather than it's available width.
+        * rendering/RenderTableCaption.h: Added.
+        (WebCore::RenderTableCaption::isTableCaption):
+        (WebCore::toRenderTableCaption):
+
 2011-11-16  Antaryami Pandia  <antaryami.pan...@motorola.com>
 
         [Gtk] display:none has no effect on <option> element.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (100472 => 100473)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-11-16 19:11:56 UTC (rev 100473)
@@ -3178,6 +3178,8 @@
 	Source/WebCore/rendering/RenderSlider.h \
 	Source/WebCore/rendering/RenderSummary.cpp \
 	Source/WebCore/rendering/RenderSummary.h \
+	Source/WebCore/rendering/RenderTableCaption.cpp \
+	Source/WebCore/rendering/RenderTableCaption.h \
 	Source/WebCore/rendering/RenderTableCell.cpp \
 	Source/WebCore/rendering/RenderTableCell.h \
 	Source/WebCore/rendering/RenderTableCol.cpp \

Modified: trunk/Source/WebCore/Target.pri (100472 => 100473)


--- trunk/Source/WebCore/Target.pri	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/Target.pri	2011-11-16 19:11:56 UTC (rev 100473)
@@ -1225,6 +1225,7 @@
     rendering/RenderSlider.cpp \
     rendering/RenderSummary.cpp \
     rendering/RenderTable.cpp \
+    rendering/RenderTableCaption.cpp \
     rendering/RenderTableCell.cpp \
     rendering/RenderTableCol.cpp \
     rendering/RenderTableRow.cpp \
@@ -2340,6 +2341,7 @@
     rendering/RenderScrollbarTheme.h \
     rendering/RenderSlider.h \
     rendering/RenderSummary.h \
+    rendering/RenderTableCaption.h \
     rendering/RenderTableCell.h \
     rendering/RenderTableCol.h \
     rendering/RenderTable.h \

Modified: trunk/Source/WebCore/WebCore.gypi (100472 => 100473)


--- trunk/Source/WebCore/WebCore.gypi	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/WebCore.gypi	2011-11-16 19:11:56 UTC (rev 100473)
@@ -4663,6 +4663,8 @@
             'rendering/RenderSummary.h',
             'rendering/RenderTable.cpp',
             'rendering/RenderTable.h',
+            'rendering/RenderTableCaption.cpp',
+            'rendering/RenderTableCaption.h',
             'rendering/RenderTableCell.cpp',
             'rendering/RenderTableCell.h',
             'rendering/RenderTableCol.cpp',

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (100472 => 100473)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-11-16 19:11:56 UTC (rev 100473)
@@ -694,7 +694,7 @@
 
         ASSERT(beforeChildAnonymousContainer->isTable());
         if ((newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_GROUP)
-                || (newChild->isRenderBlock() && newChild->style()->display() == TABLE_CAPTION)
+                || (newChild->isTableCaption())
                 || newChild->isTableSection()
                 || newChild->isTableRow()
                 || newChild->isTableCell()) {

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (100472 => 100473)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2011-11-16 19:11:56 UTC (rev 100473)
@@ -54,6 +54,7 @@
 #include "RenderRegion.h"
 #include "RenderRuby.h"
 #include "RenderRubyText.h"
+#include "RenderTableCaption.h"
 #include "RenderTableCell.h"
 #include "RenderTableCol.h"
 #include "RenderTableRow.h"
@@ -164,7 +165,7 @@
     case TABLE_CELL:
         return new (arena) RenderTableCell(node);
     case TABLE_CAPTION:
-        return new (arena) RenderBlock(node);
+        return new (arena) RenderTableCaption(node);
     case BOX:
     case INLINE_BOX:
         return new (arena) RenderDeprecatedFlexibleBox(node);
@@ -293,7 +294,7 @@
 
     if (newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_GROUP)
         needsTable = !isTable();
-    else if (newChild->isRenderBlock() && newChild->style()->display() == TABLE_CAPTION)
+    else if (newChild->isTableCaption())
         needsTable = !isTable();
     else if (newChild->isTableSection())
         needsTable = !isTable();

Modified: trunk/Source/WebCore/rendering/RenderObject.h (100472 => 100473)


--- trunk/Source/WebCore/rendering/RenderObject.h	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2011-11-16 19:11:56 UTC (rev 100473)
@@ -327,6 +327,7 @@
     virtual bool isTable() const { return false; }
     virtual bool isTableCell() const { return false; }
     virtual bool isTableCol() const { return false; }
+    virtual bool isTableCaption() const { return false; }
     virtual bool isTableRow() const { return false; }
     virtual bool isTableSection() const { return false; }
     virtual bool isTextControl() const { return false; }

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (100472 => 100473)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2011-11-16 19:11:56 UTC (rev 100473)
@@ -36,6 +36,7 @@
 #include "HTMLNames.h"
 #include "LayoutRepainter.h"
 #include "RenderLayer.h"
+#include "RenderTableCaption.h"
 #include "RenderTableCell.h"
 #include "RenderTableCol.h"
 #include "RenderTableSection.h"
@@ -115,8 +116,8 @@
 
     bool wrapInAnonymousSection = !child->isPositioned();
 
-    if (child->isRenderBlock() && child->style()->display() == TABLE_CAPTION) {
-        m_captions.append(toRenderBlock(child));
+    if (child->isTableCaption()) {
+        m_captions.append(toRenderTableCaption(child));
         setNeedsSectionRecalc();
         wrapInAnonymousSection = false;
     } else if (child->isTableCol()) {

Modified: trunk/Source/WebCore/rendering/RenderTable.h (100472 => 100473)


--- trunk/Source/WebCore/rendering/RenderTable.h	2011-11-16 19:03:49 UTC (rev 100472)
+++ trunk/Source/WebCore/rendering/RenderTable.h	2011-11-16 19:11:56 UTC (rev 100473)
@@ -33,6 +33,7 @@
 namespace WebCore {
 
 class RenderTableCol;
+class RenderTableCaption;
 class RenderTableCell;
 class RenderTableSection;
 class TableLayout;
@@ -252,7 +253,7 @@
     mutable Vector<LayoutUnit> m_columnPos;
     mutable Vector<ColumnStruct> m_columns;
 
-    mutable Vector<RenderBlock*> m_captions;
+    mutable Vector<RenderTableCaption*> m_captions;
     mutable RenderTableSection* m_head;
     mutable RenderTableSection* m_foot;
     mutable RenderTableSection* m_firstBody;

Added: trunk/Source/WebCore/rendering/RenderTableCaption.cpp (0 => 100473)


--- trunk/Source/WebCore/rendering/RenderTableCaption.cpp	                        (rev 0)
+++ trunk/Source/WebCore/rendering/RenderTableCaption.cpp	2011-11-16 19:11:56 UTC (rev 100473)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 Robert Hogan <rob...@roberthogan.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "RenderTableCaption.h"
+
+using namespace std;
+
+namespace WebCore {
+
+RenderTableCaption::RenderTableCaption(Node* node)
+    : RenderBlock(node)
+{
+}
+
+RenderTableCaption::~RenderTableCaption()
+{
+}
+
+LayoutUnit RenderTableCaption::containingBlockLogicalWidthForContent() const
+{
+    RenderBlock* cb = containingBlock();
+    return cb->logicalWidth();
+}
+
+}
Property changes on: trunk/Source/WebCore/rendering/RenderTableCaption.cpp
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Source/WebCore/rendering/RenderTableCaption.h (0 => 100473)


--- trunk/Source/WebCore/rendering/RenderTableCaption.h	                        (rev 0)
+++ trunk/Source/WebCore/rendering/RenderTableCaption.h	2011-11-16 19:11:56 UTC (rev 100473)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Robert Hogan <rob...@roberthogan.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RenderTableCaption_h
+#define RenderTableCaption_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+class RenderTableCaption : public RenderBlock {
+public:
+    explicit RenderTableCaption(Node*);
+    virtual ~RenderTableCaption();
+    
+    virtual LayoutUnit containingBlockLogicalWidthForContent() const;
+    virtual bool isTableCaption() const { return true; }
+};
+
+inline RenderTableCaption* toRenderTableCaption(RenderObject* object)
+{
+    ASSERT(!object || object->isTableCaption());
+    return static_cast<RenderTableCaption*>(object);
+}
+
+} // namespace WebCore
+
+#endif // RenderTableCaption_h
Property changes on: trunk/Source/WebCore/rendering/RenderTableCaption.h
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to