⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 117758 in webkit


Ignore:
Timestamp:
May 21, 2012, 3:48:21 AM (14 years ago)
Author:
kov@webkit.org
Message:

Merge 113252 - Add helpers to create anonymous table parts.
https://bugs.webkit.org/show_bug.cgi?id=83116

Reviewed by Julien Chaffraix.

Source/WebCore:

The patch introduces helpers to create anonymous table parts by
introducing a new static function createAnonymousWithParentRenderer.
The function builds a new anonymous wrapper of the same type as the class,
inheriting style properties from parent and sets a display based on
argument/default values. Also we streamline the RenderBlock functions
to match this naming convention.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::createAnonymousBlockWithSameTypeAs):
(WebCore::RenderBlock::createAnonymousWithParentRendererAndDisplay):
(WebCore):
(WebCore::RenderBlock::createAnonymousColumnsWithParentRendererAndDisplay):
(WebCore::RenderBlock::createAnonymousColumnSpanWithParentRendererAndDisplay):

  • rendering/RenderBlock.h:

(RenderBlock):
(WebCore::RenderBlock::createAnonymousBlock):
(WebCore::RenderBlock::createAnonymousColumnsBlock):
(WebCore::RenderBlock::createAnonymousColumnSpanBlock):

  • rendering/RenderButton.cpp:

(WebCore::RenderButton::addChild):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::addChild):

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::addChild):
(WebCore::RenderTable::createAnonymousWithParentRendererAndDisplay):
(WebCore):

  • rendering/RenderTable.h:

(RenderTable):

  • rendering/RenderTableCell.cpp:

(WebCore::RenderTableCell::createAnonymousWithParentRendererAndDisplay):
(WebCore):

  • rendering/RenderTableCell.h:

(RenderTableCell):

  • rendering/RenderTableRow.cpp:

(WebCore::RenderTableRow::addChild):
(WebCore::RenderTableRow::createAnonymousWithParentRendererAndDisplay):
(WebCore):

  • rendering/RenderTableRow.h:

(RenderTableRow):

  • rendering/RenderTableSection.cpp:

(WebCore::RenderTableSection::addChild):
(WebCore::RenderTableSection::createAnonymousWithParentRendererAndDisplay):
(WebCore):

  • rendering/RenderTableSection.h:

(RenderTableSection):

LayoutTests:

Rebaselining tests because we now correctly inherit the bidi override.

  • platform/chromium-mac/fast/css/bidi-override-in-anonymous-block-expected.txt:
  • platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt:

Conflicts:

Source/WebCore/rendering/RenderTableSection.h

Location:
releases/WebKitGTK/webkit-1.8
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog

    r117757 r117758  
     12012-04-04  Abhishek Arya  <inferno@chromium.org>
     2
     3        Add helpers to create anonymous table parts.
     4        https://bugs.webkit.org/show_bug.cgi?id=83116
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        Rebaselining tests because we now correctly inherit the bidi override.
     9
     10        * platform/chromium-mac/fast/css/bidi-override-in-anonymous-block-expected.txt:
     11        * platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt:
     12
    1132012-02-22  Abhishek Arya  <inferno@chromium.org>
    214
  • releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium-mac-snowleopard/fast/css/bidi-override-in-anonymous-block-expected.txt

    r103884 r117758  
    226226              RenderTableCell (anonymous) at (0,0) size 24x18 [r=0 c=0 rs=1 cs=1]
    227227                RenderText {#text} at (2,0) size 22x18
    228                   text run at (2,0) width 22: "abc"
     228                  text run at (2,0) width 22 RTL override: "abc"
    229229            RenderTableRow (anonymous) at (0,18) size 24x18
    230230              RenderTableCell {DIV} at (0,18) size 24x18 [r=1 c=0 rs=1 cs=1]
     
    238238              RenderTableCell (anonymous) at (0,0) size 24x18 [r=0 c=0 rs=1 cs=1]
    239239                RenderText {#text} at (0,0) size 24x18
    240                   text run at (0,0) width 24: "opq"
     240                  text run at (0,0) width 24 RTL override: "opq"
  • releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium-win/fast/css/bidi-override-in-anonymous-block-expected.txt

    r103884 r117758  
    226226              RenderTableCell (anonymous) at (0,0) size 24x20 [r=0 c=0 rs=1 cs=1]
    227227                RenderText {#text} at (2,0) size 22x19
    228                   text run at (2,0) width 22: "abc"
     228                  text run at (2,0) width 22 RTL override: "abc"
    229229            RenderTableRow (anonymous) at (0,20) size 24x20
    230230              RenderTableCell {DIV} at (0,20) size 24x20 [r=1 c=0 rs=1 cs=1]
     
    238238              RenderTableCell (anonymous) at (0,0) size 24x20 [r=0 c=0 rs=1 cs=1]
    239239                RenderText {#text} at (0,0) size 24x19
    240                   text run at (0,0) width 24: "opq"
     240                  text run at (0,0) width 24 RTL override: "opq"
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog

    r117757 r117758  
     12012-04-04  Abhishek Arya  <inferno@chromium.org>
     2
     3        Add helpers to create anonymous table parts.
     4        https://bugs.webkit.org/show_bug.cgi?id=83116
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        The patch introduces helpers to create anonymous table parts by
     9        introducing a new static function createAnonymousWithParentRenderer.
     10        The function builds a new anonymous wrapper of the same type as the class,
     11        inheriting style properties from parent and sets a display based on
     12        argument/default values. Also we streamline the RenderBlock functions
     13        to match this naming convention.
     14
     15        * rendering/RenderBlock.cpp:
     16        (WebCore::RenderBlock::createAnonymousBlockWithSameTypeAs):
     17        (WebCore::RenderBlock::createAnonymousWithParentRendererAndDisplay):
     18        (WebCore):
     19        (WebCore::RenderBlock::createAnonymousColumnsWithParentRendererAndDisplay):
     20        (WebCore::RenderBlock::createAnonymousColumnSpanWithParentRendererAndDisplay):
     21        * rendering/RenderBlock.h:
     22        (RenderBlock):
     23        (WebCore::RenderBlock::createAnonymousBlock):
     24        (WebCore::RenderBlock::createAnonymousColumnsBlock):
     25        (WebCore::RenderBlock::createAnonymousColumnSpanBlock):
     26        * rendering/RenderButton.cpp:
     27        (WebCore::RenderButton::addChild):
     28        * rendering/RenderObject.cpp:
     29        (WebCore::RenderObject::addChild):
     30        * rendering/RenderTable.cpp:
     31        (WebCore::RenderTable::addChild):
     32        (WebCore::RenderTable::createAnonymousWithParentRendererAndDisplay):
     33        (WebCore):
     34        * rendering/RenderTable.h:
     35        (RenderTable):
     36        * rendering/RenderTableCell.cpp:
     37        (WebCore::RenderTableCell::createAnonymousWithParentRendererAndDisplay):
     38        (WebCore):
     39        * rendering/RenderTableCell.h:
     40        (RenderTableCell):
     41        * rendering/RenderTableRow.cpp:
     42        (WebCore::RenderTableRow::addChild):
     43        (WebCore::RenderTableRow::createAnonymousWithParentRendererAndDisplay):
     44        (WebCore):
     45        * rendering/RenderTableRow.h:
     46        (RenderTableRow):
     47        * rendering/RenderTableSection.cpp:
     48        (WebCore::RenderTableSection::addChild):
     49        (WebCore::RenderTableSection::createAnonymousWithParentRendererAndDisplay):
     50        (WebCore):
     51        * rendering/RenderTableSection.h:
     52        (RenderTableSection):
     53
    1542012-02-22  Abhishek Arya  <inferno@chromium.org>
    255
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderBlock.cpp

    r117757 r117758  
    671671            // Create an anonymous table container next to our table container.
    672672            RenderBlock* parentBlock = toRenderBlock(table->parent());
    673             RenderTable* postTable = parentBlock->createAnonymousTable();
     673            RenderTable* postTable = RenderTable::createAnonymousWithParentRenderer(parentBlock);
    674674            parentBlock->children()->insertChildNode(parentBlock, postTable, table->nextSibling());
    675675           
     
    64676467}
    64686468
    6469 RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const
    6470 {
    6471     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style());
    6472 
    6473     RenderBlock* newBox = 0;
    6474     if (isFlexibleBox) {
    6475         newStyle->setDisplay(BOX);
    6476         newBox = new (renderArena()) RenderDeprecatedFlexibleBox(document() /* anonymous box */);
    6477     } else {
    6478         newStyle->setDisplay(BLOCK);
    6479         newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
    6480     }
    6481 
    6482     newBox->setStyle(newStyle.release());
    6483     return newBox;
    6484 }
    6485 
    64866469RenderBlock* RenderBlock::createAnonymousBlockWithSameTypeAs(RenderBlock* otherAnonymousBlock) const
    64876470{
     
    64906473    if (otherAnonymousBlock->isAnonymousColumnSpanBlock())
    64916474        return createAnonymousColumnSpanBlock();
    6492     return createAnonymousBlock(otherAnonymousBlock->style()->display() == BOX);
    6493 }
    6494 
    6495 RenderBlock* RenderBlock::createAnonymousColumnsBlock() const
    6496 {
    6497     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style());
    6498     newStyle->inheritColumnPropertiesFrom(style());
    6499     newStyle->setDisplay(BLOCK);
    6500 
    6501     RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
    6502     newBox->setStyle(newStyle.release());
    6503     return newBox;
    6504 }
    6505 
    6506 RenderBlock* RenderBlock::createAnonymousColumnSpanBlock() const
    6507 {
    6508     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style());
    6509     newStyle->setColumnSpan(ColumnSpanAll);
    6510     newStyle->setDisplay(BLOCK);
    6511 
    6512     RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
    6513     newBox->setStyle(newStyle.release());
    6514     return newBox;
     6475    return createAnonymousBlock(otherAnonymousBlock->style()->display());
    65156476}
    65166477
     
    72417202}
    72427203
     7204RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const RenderObject* parent, EDisplay display)
     7205{
     7206    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->style());
     7207
     7208    // FIXME: Do we need to cover the new flex box here ?
     7209    // FIXME: Do we need to convert all our inline displays to block-type in the anonymous logic ?
     7210    RenderBlock* newBox = 0;
     7211    if (display == BOX || display == INLINE_BOX) {
     7212        newStyle->setDisplay(BOX);
     7213        newBox = new (parent->renderArena()) RenderDeprecatedFlexibleBox(parent->document() /* anonymous box */);
     7214    } else {
     7215        newStyle->setDisplay(BLOCK);
     7216        newBox = new (parent->renderArena()) RenderBlock(parent->document() /* anonymous box */);
     7217    }
     7218
     7219    newBox->setStyle(newStyle.release());
     7220    return newBox;
     7221}
     7222
     7223RenderBlock* RenderBlock::createAnonymousColumnsWithParentRenderer(const RenderObject* parent)
     7224{
     7225    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->style());
     7226    newStyle->inheritColumnPropertiesFrom(parent->style());
     7227    newStyle->setDisplay(BLOCK);
     7228
     7229    RenderBlock* newBox = new (parent->renderArena()) RenderBlock(parent->document() /* anonymous box */);
     7230    newBox->setStyle(newStyle.release());
     7231    return newBox;
     7232}
     7233
     7234RenderBlock* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const RenderObject* parent)
     7235{
     7236    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->style());
     7237    newStyle->setColumnSpan(ColumnSpanAll);
     7238    newStyle->setDisplay(BLOCK);
     7239
     7240    RenderBlock* newBox = new (parent->renderArena()) RenderBlock(parent->document() /* anonymous box */);
     7241    newBox->setStyle(newStyle.release());
     7242    return newBox;
     7243}
     7244
    72437245#ifndef NDEBUG
    72447246
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderBlock.h

    r117282 r117758  
    221221    using RenderBoxModelObject::setContinuation;
    222222
    223     // This function is a convenience helper for creating an anonymous block that inherits its
    224     // style from this RenderBlock.
    225     RenderBlock* createAnonymousBlock(bool isFlexibleBox = false) const;
    226     RenderBlock* createAnonymousColumnsBlock() const;
    227     RenderBlock* createAnonymousColumnSpanBlock() const;
     223    static RenderBlock* createAnonymousWithParentRendererAndDisplay(const RenderObject*, EDisplay = BLOCK);
     224    static RenderBlock* createAnonymousColumnsWithParentRenderer(const RenderObject*);
     225    static RenderBlock* createAnonymousColumnSpanWithParentRenderer(const RenderObject*);
     226    RenderBlock* createAnonymousBlock(EDisplay display = BLOCK) const { return createAnonymousWithParentRendererAndDisplay(this, display); }
     227    RenderBlock* createAnonymousColumnsBlock() const { return createAnonymousColumnsWithParentRenderer(this); }
     228    RenderBlock* createAnonymousColumnSpanBlock() const { return createAnonymousColumnSpanWithParentRenderer(this); }
     229
    228230    RenderBlock* createAnonymousBlockWithSameTypeAs(RenderBlock* otherAnonymousBlock) const;
    229231   
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderButton.cpp

    r98929 r117758  
    5050        // Create an anonymous block.
    5151        ASSERT(!firstChild());
    52         bool isFlexibleBox = style()->display() == BOX || style()->display() == INLINE_BOX;
    53         m_inner = createAnonymousBlock(isFlexibleBox);
     52        m_inner = createAnonymousBlock(style()->display());
    5453        setupInnerStyle(m_inner->style());
    5554        RenderDeprecatedFlexibleBox::addChild(m_inner);
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderObject.cpp

    r114613 r117758  
    267267}
    268268
    269 RenderTable* RenderObject::createAnonymousTable() const
    270 {
    271     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style());
    272     newStyle->setDisplay(TABLE);
    273 
    274     RenderTable* table = new (renderArena()) RenderTable(document() /* is anonymous */);
    275     table->setStyle(newStyle.release());
    276     return table;
    277 }
    278 
    279269void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild)
    280270{
     
    321311            table = toRenderTable(afterChild);
    322312        else {
    323             table = createAnonymousTable();
     313            table = RenderTable::createAnonymousWithParentRenderer(this);
    324314            addChild(table, beforeChild);
    325315        }
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderObject.h

    r117757 r117758  
    220220    // normal flow object.
    221221    void handleDynamicFloatPositionChange();
    222    
    223     RenderTable* createAnonymousTable() const;
    224222   
    225223    // RenderObject tree manipulation
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderTable.cpp

    r111970 r117758  
    193193    if (beforeChild && !beforeChild->isTableSection() && beforeChild->style()->display() != TABLE_CAPTION && beforeChild->style()->display() != TABLE_COLUMN_GROUP)
    194194        beforeChild = 0;
    195     RenderTableSection* section = new (renderArena()) RenderTableSection(document() /* anonymous */);
    196     RefPtr<RenderStyle> newStyle = RenderStyle::create();
    197     newStyle->inheritFrom(style());
    198     newStyle->setDisplay(TABLE_ROW_GROUP);
    199     section->setStyle(newStyle.release());
     195
     196    RenderTableSection* section = RenderTableSection::createAnonymousWithParentRenderer(this);
    200197    addChild(section, beforeChild);
    201198    section->addChild(child);
     
    12621259}
    12631260
    1264 }
     1261RenderTable* RenderTable::createAnonymousWithParentRenderer(const RenderObject* parent)
     1262{
     1263    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->style());
     1264    newStyle->setDisplay(TABLE);
     1265
     1266    RenderTable* newTable = new (parent->renderArena()) RenderTable(parent->document() /* is anonymous */);
     1267    newTable->setStyle(newStyle.release());
     1268    return newTable;
     1269}
     1270
     1271}
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderTable.h

    r107880 r117758  
    212212    }
    213213
     214    static RenderTable* createAnonymousWithParentRenderer(const RenderObject*);
     215
    214216protected:
    215217    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderTableCell.cpp

    r107874 r117758  
    10981098}
    10991099
     1100RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const RenderObject* parent)
     1101{
     1102    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->style());
     1103    newStyle->setDisplay(TABLE_CELL);
     1104
     1105    RenderTableCell* newCell = new (parent->renderArena()) RenderTableCell(parent->document() /* is anonymous */);
     1106    newCell->setStyle(newStyle.release());
     1107    return newCell;
     1108}
     1109
    11001110} // namespace WebCore
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderTableCell.h

    r107874 r117758  
    137137    void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; }
    138138
     139    static RenderTableCell* createAnonymousWithParentRenderer(const RenderObject*);
     140
    139141protected:
    140142    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderTableRow.cpp

    r105021 r117758  
    114114        }
    115115
    116         RenderTableCell* cell = new (renderArena()) RenderTableCell(document() /* anonymous object */);
    117         RefPtr<RenderStyle> newStyle = RenderStyle::create();
    118         newStyle->inheritFrom(style());
    119         newStyle->setDisplay(TABLE_CELL);
    120         cell->setStyle(newStyle.release());
     116        RenderTableCell* cell = RenderTableCell::createAnonymousWithParentRenderer(this);
    121117        addChild(cell, beforeChild);
    122118        cell->addChild(child);
     
    250246}
    251247
     248RenderTableRow* RenderTableRow::createAnonymousWithParentRenderer(const RenderObject* parent)
     249{
     250    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->style());
     251    newStyle->setDisplay(TABLE_ROW);
     252
     253    RenderTableRow* newRow = new (parent->renderArena()) RenderTableRow(parent->document() /* is anonymous */);
     254    newRow->setStyle(newStyle.release());
     255    return newRow;
     256}
     257
    252258} // namespace WebCore
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderTableRow.h

    r105021 r117758  
    4242    void updateBeforeAndAfterContent();
    4343    void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
     44
     45    static RenderTableRow* createAnonymousWithParentRenderer(const RenderObject*);
    4446
    4547private:
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderTableSection.cpp

    r107038 r117758  
    162162        }
    163163
    164         RenderObject* row = new (renderArena()) RenderTableRow(document() /* anonymous table row */);
    165         RefPtr<RenderStyle> newStyle = RenderStyle::create();
    166         newStyle->inheritFrom(style());
    167         newStyle->setDisplay(TABLE_ROW);
    168         row->setStyle(newStyle.release());
     164        RenderObject* row = RenderTableRow::createAnonymousWithParentRenderer(this);
    169165        addChild(row, beforeChild);
    170166        row->addChild(child);
     
    13761372}
    13771373
     1374RenderTableSection* RenderTableSection::createAnonymousWithParentRenderer(const RenderObject* parent)
     1375{
     1376    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->style());
     1377    newStyle->setDisplay(TABLE_ROW_GROUP);
     1378
     1379    RenderTableSection* newSection = new (parent->renderArena()) RenderTableSection(parent->document() /* is anonymous */);
     1380    newSection->setStyle(newStyle.release());
     1381    return newSection;
     1382}
     1383
    13781384} // namespace WebCore
  • releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderTableSection.h

    r107038 r117758  
    142142    CollapsedBorderValue& cachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide);
    143143
     144    static RenderTableSection* createAnonymousWithParentRenderer(const RenderObject*);
     145
    144146protected:
    145147    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
Note: See TracChangeset for help on using the changeset viewer.