CSS 2.1 failure: border-collapse-offset-002.htm fails
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 19:11:56 +0000 (19:11 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 19:11:56 +0000 (19:11 +0000)
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:

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

22 files changed:
LayoutTests/ChangeLog
LayoutTests/css2.1/20110323/border-collapse-offset-002.htm [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/dom/HTMLTableElement/colSpan-expected.png
LayoutTests/platform/chromium-linux/fast/dom/HTMLTableElement/createCaption-expected.png
LayoutTests/platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt
LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/colSpan-expected.txt
LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/createCaption-expected.txt
LayoutTests/platform/mac/fast/repaint/table-section-repaint-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h
Source/WebCore/rendering/RenderTableCaption.cpp [new file with mode: 0644]
Source/WebCore/rendering/RenderTableCaption.h [new file with mode: 0644]

index d98a74c..60128af 100644 (file)
@@ -1,3 +1,29 @@
+2011-11-08  Robert Hogan  <robert@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.glazunov@gmail.com>
 
         ScriptController::executeIfJavaScriptURL gets confused by synchronous frame loads
diff --git a/LayoutTests/css2.1/20110323/border-collapse-offset-002.htm b/LayoutTests/css2.1/20110323/border-collapse-offset-002.htm
new file mode 100644 (file)
index 0000000..c4f753e
--- /dev/null
@@ -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="mailto:bmlk@gmx.de">
+    <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders">
+    <link rel="match" href="border-collapse-offset-002-ref.htm">
+    <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
diff --git a/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png b/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png
new file mode 100644 (file)
index 0000000..b0ce258
Binary files /dev/null and b/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png differ
diff --git a/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt b/LayoutTests/platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt
new file mode 100644 (file)
index 0000000..ff8cb58
--- /dev/null
@@ -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"
index 4854b0e..a0ec07a 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/fast/dom/HTMLTableElement/colSpan-expected.png and b/LayoutTests/platform/chromium-linux/fast/dom/HTMLTableElement/colSpan-expected.png differ
index f262587..06f8a53 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/fast/dom/HTMLTableElement/createCaption-expected.png and b/LayoutTests/platform/chromium-linux/fast/dom/HTMLTableElement/createCaption-expected.png differ
index 24d768d..a148074 100644 (file)
@@ -179,9 +179,9 @@ layer at (0,0) size 785x1301
         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 @@ layer at (0,0) size 785x1301
               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]
index 8242264..89be015 100644 (file)
@@ -27,9 +27,9 @@ layer at (0,0) size 800x600
       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 @@ layer at (0,0) size 800x600
       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]
index 76e3f10..9529e58 100644 (file)
@@ -31,10 +31,10 @@ layer at (0,0) size 800x600
           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 @@ layer at (0,0) size 800x600
       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]
index 2f6ecce..ff1a4a7 100644 (file)
@@ -36,7 +36,7 @@ layer at (8,188) size 90x90
 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
index e3f0bdb..a60e8ad 100644 (file)
@@ -1282,6 +1282,7 @@ SET(WebCore_SOURCES
     rendering/RenderSlider.cpp
     rendering/RenderSummary.cpp
     rendering/RenderTable.cpp
+    rendering/RenderTableCaption.cpp
     rendering/RenderTableCell.cpp
     rendering/RenderTableCol.cpp
     rendering/RenderTableRow.cpp
index b8e9346..ae4e623 100644 (file)
@@ -1,3 +1,39 @@
+2011-11-08  Robert Hogan  <robert@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.pandia@motorola.com>
 
         [Gtk] display:none has no effect on <option> element.
index 347e963..e7b1d11 100644 (file)
@@ -3178,6 +3178,8 @@ webcore_sources += \
        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 \
index 4a97a8b..ccf508a 100644 (file)
@@ -1225,6 +1225,7 @@ SOURCES += \
     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 @@ HEADERS += \
     rendering/RenderScrollbarTheme.h \
     rendering/RenderSlider.h \
     rendering/RenderSummary.h \
+    rendering/RenderTableCaption.h \
     rendering/RenderTableCell.h \
     rendering/RenderTableCol.h \
     rendering/RenderTable.h \
index b5ccad0..123e345 100644 (file)
             'rendering/RenderSummary.h',
             'rendering/RenderTable.cpp',
             'rendering/RenderTable.h',
+            'rendering/RenderTableCaption.cpp',
+            'rendering/RenderTableCaption.h',
             'rendering/RenderTableCell.cpp',
             'rendering/RenderTableCell.h',
             'rendering/RenderTableCol.cpp',
index f97e034..feee71c 100755 (executable)
@@ -694,7 +694,7 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
 
         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()) {
index c9ef08a..4cc3d76 100755 (executable)
@@ -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 @@ RenderObject* RenderObject::createObject(Node* node, RenderStyle* style)
     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 @@ void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild)
 
     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();
index 9b3b39a..8ccfeec 100644 (file)
@@ -327,6 +327,7 @@ public:
     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; }
index c956125..d8641e4 100644 (file)
@@ -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 @@ void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild)
 
     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()) {
index 2de900c..54b29c6 100644 (file)
@@ -33,6 +33,7 @@
 namespace WebCore {
 
 class RenderTableCol;
+class RenderTableCaption;
 class RenderTableCell;
 class RenderTableSection;
 class TableLayout;
@@ -252,7 +253,7 @@ private:
     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;
diff --git a/Source/WebCore/rendering/RenderTableCaption.cpp b/Source/WebCore/rendering/RenderTableCaption.cpp
new file mode 100644 (file)
index 0000000..e805f29
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 Robert Hogan <robert@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();
+}
+
+}
diff --git a/Source/WebCore/rendering/RenderTableCaption.h b/Source/WebCore/rendering/RenderTableCaption.h
new file mode 100644 (file)
index 0000000..3a73447
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Robert Hogan <robert@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