Changeset 100473 in webkit


Ignore:
Timestamp:
Nov 16, 2011 11:11:56 AM (12 years ago)
Author:
robert@webkit.org
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:
Location:
trunk
Files:
5 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r100471 r100473  
     12011-11-08  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: border-collapse-offset-002.htm fails
     4        https://bugs.webkit.org/show_bug.cgi?id=71705
     5
     6        Table captions now use the width of the table rather than the width of the table minus
     7        the borders. This allows captions to center accurately but unfortunately a lot of mozilla
     8        table tests need to be rebaselined as many of them use captions for explaining the purpose
     9        of individual test files!
     10       
     11        Add border-collapse-offset-002.htm which now renders correctly.
     12
     13        Affected tables/mozilla tests are rebaselined in a follow-up patch.
     14
     15        Reviewed by Antti Koivisto.
     16
     17        * css2.1/20110323/border-collapse-offset-002.htm: Added.
     18        * platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.png: Added.
     19        * platform/chromium-linux-x86/css2.1/20110323/border-collapse-offset-002-expected.txt: Added.
     20        * platform/chromium-linux/fast/dom/HTMLTableElement/colSpan-expected.png:
     21        * platform/chromium-linux/fast/dom/HTMLTableElement/createCaption-expected.png:
     22        * platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt:
     23        * platform/chromium-win/fast/dom/HTMLTableElement/colSpan-expected.txt:
     24        * platform/chromium-win/fast/dom/HTMLTableElement/createCaption-expected.txt:
     25        * platform/mac/fast/repaint/table-section-repaint-expected.txt:
     26
    1272011-11-16  Sergey Glazunov  <serg.glazunov@gmail.com>
    228
  • trunk/LayoutTests/platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt

    r81820 r100473  
    180180          text run at (0,0) width 389: "The following 2 tables should be identical, ignorning whitespaces:"
    181181      RenderTable {TABLE} at (1,1008) size 80x72 [border: (1px solid #808080)]
    182         RenderBlock {CAPTION} at (0,0) size 78x20
    183           RenderText {#text} at (-2,0) size 80x19
    184             text run at (-2,0) width 80: "NormalTable"
     182        RenderBlock {CAPTION} at (0,0) size 80x20
     183          RenderText {#text} at (0,0) size 80x19
     184            text run at (0,0) width 80: "NormalTable"
    185185        RenderTableSection {TBODY} at (1,21) size 78x50
    186186          RenderTableRow {TR} at (0,2) size 78x22
     
    199199                text run at (13,1) width 24: "opq"
    200200      RenderTable {DIV} at (1,1081) size 135x62 [border: (1px solid #000000)]
    201         RenderBlock {DIV} at (0,0) size 133x20
    202           RenderText {#text} at (-2,0) size 135x19
    203             text run at (-2,0) width 135: "AnonymousTableRow"
     201        RenderBlock {DIV} at (0,0) size 135x20
     202          RenderText {#text} at (0,0) size 135x19
     203            text run at (0,0) width 135: "AnonymousTableRow"
    204204        RenderTableSection (anonymous) at (1,21) size 133x40
    205205          RenderTableRow {DIV} at (0,0) size 133x20
  • trunk/LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/colSpan-expected.txt

    r56267 r100473  
    2828        RenderBR {BR} at (0,0) size 0x19
    2929      RenderTable {TABLE} at (0,238) size 255x76 [border: (1px outset #808080)]
    30         RenderBlock {CAPTION} at (0,0) size 253x20
    31           RenderText {#text} at (26,0) size 201x19
    32             text run at (26,0) width 201: "Testing Default and Regular Input"
     30        RenderBlock {CAPTION} at (0,0) size 255x20
     31          RenderText {#text} at (27,0) size 201x19
     32            text run at (27,0) width 201: "Testing Default and Regular Input"
    3333        RenderTableSection {TBODY} at (1,21) size 253x54
    3434          RenderTableRow {TR} at (0,2) size 253x24
     
    6767        RenderBR {BR} at (0,0) size 0x19
    6868      RenderTable {TABLE} at (0,334) size 189x76 [border: (1px outset #808080)]
    69         RenderBlock {CAPTION} at (0,0) size 187x20
    70           RenderText {#text} at (14,0) size 159x19
    71             text run at (14,0) width 159: "Testing Zero Special Case"
     69        RenderBlock {CAPTION} at (0,0) size 189x20
     70          RenderText {#text} at (15,0) size 159x19
     71            text run at (15,0) width 159: "Testing Zero Special Case"
    7272        RenderTableSection {TBODY} at (1,21) size 187x54
    7373          RenderTableRow {TR} at (0,2) size 187x24
  • trunk/LayoutTests/platform/chromium-win/fast/dom/HTMLTableElement/createCaption-expected.txt

    r78929 r100473  
    3232      RenderBlock {HR} at (0,168) size 784x2 [border: (1px inset #000000)]
    3333      RenderTable {TABLE} at (0,178) size 104x102 [border: (1px outset #808080)]
    34         RenderBlock {CAPTION} at (0,0) size 102x20
     34        RenderBlock {CAPTION} at (0,0) size 104x20
    3535          RenderInline {B} at (0,0) size 40x19
    36             RenderText {#text} at (31,0) size 40x19
    37               text run at (31,0) width 40: "Fruity"
     36            RenderText {#text} at (32,0) size 40x19
     37              text run at (32,0) width 40: "Fruity"
    3838        RenderTableSection {TBODY} at (1,21) size 102x80
    3939          RenderTableRow {TR} at (0,2) size 102x24
     
    6161        RenderBR {BR} at (0,0) size 0x19
    6262      RenderTable {TABLE} at (0,300) size 129x102 [border: (1px outset #808080)]
    63         RenderBlock {CAPTION} at (0,0) size 127x20
     63        RenderBlock {CAPTION} at (0,0) size 129x20
    6464          RenderInline {B} at (0,0) size 77x19
    65             RenderText {#text} at (25,0) size 77x19
    66               text run at (25,0) width 77: "Vegetabley"
     65            RenderText {#text} at (26,0) size 77x19
     66              text run at (26,0) width 77: "Vegetabley"
    6767        RenderTableSection {TBODY} at (1,21) size 127x80
    6868          RenderTableRow {TR} at (0,2) size 127x24
  • trunk/LayoutTests/platform/mac/fast/repaint/table-section-repaint-expected.txt

    r30635 r100473  
    3737  RenderBlock (relative positioned) {DIV} at (0,300) size 90x90
    3838    RenderTable {TABLE} at (0,0) size 60x83 [border: (4px solid #008000)]
    39       RenderBlock {CAPTION} at (21,0) size 10x15
     39      RenderBlock {CAPTION} at (25,0) size 10x15
    4040        RenderBlock {DIV} at (0,0) size 10x15
    4141      RenderTableSection {TBODY} at (4,19) size 52x60
  • trunk/Source/WebCore/CMakeLists.txt

    r100311 r100473  
    12831283    rendering/RenderSummary.cpp
    12841284    rendering/RenderTable.cpp
     1285    rendering/RenderTableCaption.cpp
    12851286    rendering/RenderTableCell.cpp
    12861287    rendering/RenderTableCol.cpp
  • trunk/Source/WebCore/ChangeLog

    r100470 r100473  
     12011-11-08  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: border-collapse-offset-002.htm fails
     4        https://bugs.webkit.org/show_bug.cgi?id=71705
     5
     6        Table captions are implemented as children of the table but have a special
     7        requirement to expand to the full width of the table rather than just the 'available'
     8        width, i.e. the full width minus padding and borders.
     9
     10        To accomodate this create a RenderTableCaption object that reimplements containingBlockLogicalWidthForContent()
     11        to return the full width of the containing block (i.e. the table) rather than the available width.
     12
     13        Reviewed by Antti Koivisto.
     14
     15        * CMakeLists.txt: Add RenderTableCaption.[cpp|h]
     16        * GNUmakefile.list.am: Add RenderTableCaption.[cpp|h]
     17        * Target.pri: Add RenderTableCaption.[cpp|h]
     18        * WebCore.gypi: Add RenderTableCaption.[cpp|h]
     19        * rendering/RenderBlock.cpp:
     20        (WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks): Use RenderTableCaption
     21        * rendering/RenderObject.cpp:
     22        (WebCore::RenderObject::createObject): Add RenderTableCaption.[cpp|h]
     23        (WebCore::RenderObject::addChild): ditto
     24        * rendering/RenderObject.h:
     25        (WebCore::RenderObject::isTableCaption):
     26        * rendering/RenderTable.cpp:
     27        (WebCore::RenderTable::addChild):
     28        * rendering/RenderTable.h:
     29        * rendering/RenderTableCaption.cpp: Added.
     30        (WebCore::RenderTableCaption::RenderTableCaption): Implement RenderTableCaption
     31        (WebCore::RenderTableCaption::~RenderTableCaption):
     32        (WebCore::RenderTableCaption::containingBlockLogicalWidthForContent): Return the containing block's full width rather than it's available width.
     33        * rendering/RenderTableCaption.h: Added.
     34        (WebCore::RenderTableCaption::isTableCaption):
     35        (WebCore::toRenderTableCaption):
     36
    1372011-11-16  Antaryami Pandia  <antaryami.pandia@motorola.com>
    238
  • trunk/Source/WebCore/GNUmakefile.list.am

    r100416 r100473  
    31793179        Source/WebCore/rendering/RenderSummary.cpp \
    31803180        Source/WebCore/rendering/RenderSummary.h \
     3181        Source/WebCore/rendering/RenderTableCaption.cpp \
     3182        Source/WebCore/rendering/RenderTableCaption.h \
    31813183        Source/WebCore/rendering/RenderTableCell.cpp \
    31823184        Source/WebCore/rendering/RenderTableCell.h \
  • trunk/Source/WebCore/Target.pri

    r100441 r100473  
    12261226    rendering/RenderSummary.cpp \
    12271227    rendering/RenderTable.cpp \
     1228    rendering/RenderTableCaption.cpp \
    12281229    rendering/RenderTableCell.cpp \
    12291230    rendering/RenderTableCol.cpp \
     
    23412342    rendering/RenderSlider.h \
    23422343    rendering/RenderSummary.h \
     2344    rendering/RenderTableCaption.h \
    23432345    rendering/RenderTableCell.h \
    23442346    rendering/RenderTableCol.h \
  • trunk/Source/WebCore/WebCore.gypi

    r100416 r100473  
    46644664            'rendering/RenderTable.cpp',
    46654665            'rendering/RenderTable.h',
     4666            'rendering/RenderTableCaption.cpp',
     4667            'rendering/RenderTableCaption.h',
    46664668            'rendering/RenderTableCell.cpp',
    46674669            'rendering/RenderTableCell.h',
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r99613 r100473  
    695695        ASSERT(beforeChildAnonymousContainer->isTable());
    696696        if ((newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_GROUP)
    697                 || (newChild->isRenderBlock() && newChild->style()->display() == TABLE_CAPTION)
     697                || (newChild->isTableCaption())
    698698                || newChild->isTableSection()
    699699                || newChild->isTableRow()
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r100389 r100473  
    5555#include "RenderRuby.h"
    5656#include "RenderRubyText.h"
     57#include "RenderTableCaption.h"
    5758#include "RenderTableCell.h"
    5859#include "RenderTableCol.h"
     
    165166        return new (arena) RenderTableCell(node);
    166167    case TABLE_CAPTION:
    167         return new (arena) RenderBlock(node);
     168        return new (arena) RenderTableCaption(node);
    168169    case BOX:
    169170    case INLINE_BOX:
     
    294295    if (newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_GROUP)
    295296        needsTable = !isTable();
    296     else if (newChild->isRenderBlock() && newChild->style()->display() == TABLE_CAPTION)
     297    else if (newChild->isTableCaption())
    297298        needsTable = !isTable();
    298299    else if (newChild->isTableSection())
  • trunk/Source/WebCore/rendering/RenderObject.h

    r100198 r100473  
    328328    virtual bool isTableCell() const { return false; }
    329329    virtual bool isTableCol() const { return false; }
     330    virtual bool isTableCaption() const { return false; }
    330331    virtual bool isTableRow() const { return false; }
    331332    virtual bool isTableSection() const { return false; }
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r100386 r100473  
    3737#include "LayoutRepainter.h"
    3838#include "RenderLayer.h"
     39#include "RenderTableCaption.h"
    3940#include "RenderTableCell.h"
    4041#include "RenderTableCol.h"
     
    116117    bool wrapInAnonymousSection = !child->isPositioned();
    117118
    118     if (child->isRenderBlock() && child->style()->display() == TABLE_CAPTION) {
    119         m_captions.append(toRenderBlock(child));
     119    if (child->isTableCaption()) {
     120        m_captions.append(toRenderTableCaption(child));
    120121        setNeedsSectionRecalc();
    121122        wrapInAnonymousSection = false;
  • trunk/Source/WebCore/rendering/RenderTable.h

    r100386 r100473  
    3434
    3535class RenderTableCol;
     36class RenderTableCaption;
    3637class RenderTableCell;
    3738class RenderTableSection;
     
    253254    mutable Vector<ColumnStruct> m_columns;
    254255
    255     mutable Vector<RenderBlock*> m_captions;
     256    mutable Vector<RenderTableCaption*> m_captions;
    256257    mutable RenderTableSection* m_head;
    257258    mutable RenderTableSection* m_foot;
Note: See TracChangeset for help on using the changeset viewer.