Title: [113497] trunk/Source/WebCore
Revision
113497
Author
[email protected]
Date
2012-04-06 14:32:55 -0700 (Fri, 06 Apr 2012)

Log Message

Virtualize createAnonymousBoxWithSameTypeAs.
https://bugs.webkit.org/show_bug.cgi?id=83229

Reviewed by Julien Chaffraix.

This helps to use the same function to create anonymous
table parts and in the future extend to more classes
derived from RenderBox.

The current switch case situation was going to be messy as
we will need to mix cases that were very dependent on the
class, so it made sense to add a virtual function.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::splitAnonymousBlocksAroundChild):
(WebCore::RenderBlock::createAnonymousBoxWithSameTypeAs):
* rendering/RenderBlock.h:
(RenderBlock):
* rendering/RenderBox.h:
(WebCore::RenderBox::createAnonymousBoxWithSameTypeAs):
(RenderBox):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::splitFlow):
* rendering/RenderTable.h:
(WebCore::RenderTable::createAnonymousBoxWithSameTypeAs):
* rendering/RenderTableCell.h:
(WebCore::RenderTableCell::createAnonymousBoxWithSameTypeAs):
* rendering/RenderTableRow.h:
(WebCore::RenderTableRow::createAnonymousBoxWithSameTypeAs):
* rendering/RenderTableSection.h:
(WebCore::RenderTableSection::createAnonymousBoxWithSameTypeAs):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113496 => 113497)


--- trunk/Source/WebCore/ChangeLog	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/ChangeLog	2012-04-06 21:32:55 UTC (rev 113497)
@@ -1,3 +1,37 @@
+2012-04-06  Abhishek Arya  <[email protected]>
+
+        Virtualize createAnonymousBoxWithSameTypeAs.
+        https://bugs.webkit.org/show_bug.cgi?id=83229
+
+        Reviewed by Julien Chaffraix.
+
+        This helps to use the same function to create anonymous
+        table parts and in the future extend to more classes
+        derived from RenderBox.
+
+        The current switch case situation was going to be messy as
+        we will need to mix cases that were very dependent on the
+        class, so it made sense to add a virtual function.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::splitAnonymousBlocksAroundChild):
+        (WebCore::RenderBlock::createAnonymousBoxWithSameTypeAs):
+        * rendering/RenderBlock.h:
+        (RenderBlock):
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::createAnonymousBoxWithSameTypeAs):
+        (RenderBox):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::splitFlow):
+        * rendering/RenderTable.h:
+        (WebCore::RenderTable::createAnonymousBoxWithSameTypeAs):
+        * rendering/RenderTableCell.h:
+        (WebCore::RenderTableCell::createAnonymousBoxWithSameTypeAs):
+        * rendering/RenderTableRow.h:
+        (WebCore::RenderTableRow::createAnonymousBoxWithSameTypeAs):
+        * rendering/RenderTableSection.h:
+        (WebCore::RenderTableSection::createAnonymousBoxWithSameTypeAs):
+
 2012-04-06  Tim Horton  <[email protected]>
 
         [cg] REGRESSION (r101517): Animating the transform of a <rect> with shape-rendering: crispEdges leaves behind garbage

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (113496 => 113497)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-04-06 21:32:55 UTC (rev 113497)
@@ -715,7 +715,7 @@
         RenderBlock* blockToSplit = toRenderBlock(beforeChild->parent());
         if (blockToSplit->firstChild() != beforeChild) {
             // We have to split the parentBlock into two blocks.
-            RenderBlock* post = createAnonymousBlockWithSameTypeAs(blockToSplit);
+            RenderBlock* post = toRenderBlock(blockToSplit->createAnonymousBoxWithSameTypeAs(this));
             post->setChildrenInline(blockToSplit->childrenInline());
             RenderBlock* parentBlock = toRenderBlock(blockToSplit->parent());
             parentBlock->children()->insertChildNode(parentBlock, post, blockToSplit->nextSibling());
@@ -6675,13 +6675,13 @@
         inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + inlineElementContinuation()->containingBlock()->location() - location()));
 }
 
-RenderBlock* RenderBlock::createAnonymousBlockWithSameTypeAs(RenderBlock* otherAnonymousBlock) const
+RenderBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const
 {
-    if (otherAnonymousBlock->isAnonymousColumnsBlock())
-        return createAnonymousColumnsBlock();
-    if (otherAnonymousBlock->isAnonymousColumnSpanBlock())
-        return createAnonymousColumnSpanBlock();
-    return createAnonymousBlock(otherAnonymousBlock->style()->display());
+    if (isAnonymousColumnsBlock())
+        return createAnonymousColumnsWithParentRenderer(parent);
+    if (isAnonymousColumnSpanBlock())
+        return createAnonymousColumnSpanWithParentRenderer(parent);
+    return createAnonymousWithParentRendererAndDisplay(parent, style()->display());
 }
 
 bool RenderBlock::hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule pageBoundaryRule) const

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (113496 => 113497)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2012-04-06 21:32:55 UTC (rev 113497)
@@ -240,7 +240,7 @@
     RenderBlock* createAnonymousColumnsBlock() const { return createAnonymousColumnsWithParentRenderer(this); }
     RenderBlock* createAnonymousColumnSpanBlock() const { return createAnonymousColumnSpanWithParentRenderer(this); }
 
-    RenderBlock* createAnonymousBlockWithSameTypeAs(RenderBlock* otherAnonymousBlock) const;
+    virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE;
     
     static void appendRunsForObject(BidiRunList<BidiRun>&, int start, int end, RenderObject*, InlineBidiResolver&);
 

Modified: trunk/Source/WebCore/rendering/RenderBox.h (113496 => 113497)


--- trunk/Source/WebCore/rendering/RenderBox.h	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2012-04-06 21:32:55 UTC (rev 113497)
@@ -484,6 +484,12 @@
         return false;
     }
 
+    virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject*) const
+    {
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+
 protected:
     virtual void willBeDestroyed();
 

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (113496 => 113497)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2012-04-06 21:32:55 UTC (rev 113497)
@@ -426,7 +426,7 @@
         madeNewBeforeBlock = true;
     }
 
-    RenderBlock* post = block->createAnonymousBlockWithSameTypeAs(pre);
+    RenderBlock* post = toRenderBlock(pre->createAnonymousBoxWithSameTypeAs(block));
 
     RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nextSibling();
     if (madeNewBeforeBlock)

Modified: trunk/Source/WebCore/rendering/RenderTable.h (113496 => 113497)


--- trunk/Source/WebCore/rendering/RenderTable.h	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/rendering/RenderTable.h	2012-04-06 21:32:55 UTC (rev 113497)
@@ -212,6 +212,10 @@
     }
 
     static RenderTable* createAnonymousWithParentRenderer(const RenderObject*);
+    virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
+    {
+        return createAnonymousWithParentRenderer(parent);
+    }
 
 protected:
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);

Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (113496 => 113497)


--- trunk/Source/WebCore/rendering/RenderTableCell.h	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h	2012-04-06 21:32:55 UTC (rev 113497)
@@ -139,6 +139,10 @@
     void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; }
 
     static RenderTableCell* createAnonymousWithParentRenderer(const RenderObject*);
+    virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
+    {
+        return createAnonymousWithParentRenderer(parent);
+    }
 
 protected:
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);

Modified: trunk/Source/WebCore/rendering/RenderTableRow.h (113496 => 113497)


--- trunk/Source/WebCore/rendering/RenderTableRow.h	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/rendering/RenderTableRow.h	2012-04-06 21:32:55 UTC (rev 113497)
@@ -43,6 +43,10 @@
     void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
 
     static RenderTableRow* createAnonymousWithParentRenderer(const RenderObject*);
+    virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
+    {
+        return createAnonymousWithParentRenderer(parent);
+    }
 
 private:
     virtual RenderObjectChildList* virtualChildren() { return children(); }

Modified: trunk/Source/WebCore/rendering/RenderTableSection.h (113496 => 113497)


--- trunk/Source/WebCore/rendering/RenderTableSection.h	2012-04-06 21:31:02 UTC (rev 113496)
+++ trunk/Source/WebCore/rendering/RenderTableSection.h	2012-04-06 21:32:55 UTC (rev 113497)
@@ -163,6 +163,10 @@
     int distributeExtraLogicalHeightToRows(int extraLogicalHeight);
 
     static RenderTableSection* createAnonymousWithParentRenderer(const RenderObject*);
+    virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
+    {
+        return createAnonymousWithParentRenderer(parent);
+    }
 
 protected:
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to