CTTE: RenderObject's createAnonymous() and setDocumentForAnonymous() should take...
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Sep 2013 19:56:13 +0000 (19:56 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Sep 2013 19:56:13 +0000 (19:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121400

Reviewed by Andreas Kling.

The Document used for anonymous renderers is never null.

* dom/Document.cpp:
* page/FrameView.cpp:
* rendering/FlowThreadController.cpp:
* rendering/RenderBlock.cpp:
* rendering/RenderBlock.h:
* rendering/RenderFlexibleBox.cpp:
* rendering/RenderFlexibleBox.h:
* rendering/RenderFullScreen.cpp:
* rendering/RenderFullScreen.h:
* rendering/RenderImage.cpp:
* rendering/RenderInline.cpp:
* rendering/RenderInline.h:
* rendering/RenderLayer.cpp:
* rendering/RenderListMarker.cpp:
* rendering/RenderMultiColumnBlock.cpp:
* rendering/RenderMultiColumnFlowThread.cpp:
* rendering/RenderMultiColumnFlowThread.h:
* rendering/RenderMultiColumnSet.cpp:
* rendering/RenderMultiColumnSet.h:
* rendering/RenderNamedFlowThread.cpp:
* rendering/RenderNamedFlowThread.h:
* rendering/RenderObject.h:
* rendering/RenderReplica.cpp:
* rendering/RenderReplica.h:
* rendering/RenderRuby.cpp:
* rendering/RenderRubyBase.cpp:
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
* rendering/RenderScrollbar.cpp:
* rendering/RenderScrollbarPart.cpp:
* rendering/RenderScrollbarPart.h:
* rendering/RenderTable.cpp:
* rendering/RenderTableCell.cpp:
* rendering/RenderTableCell.h:
* rendering/RenderTableRow.cpp:
* rendering/RenderTableRow.h:
* rendering/RenderTableSection.cpp:
* rendering/RenderText.cpp:
* rendering/RenderView.cpp:
* rendering/RenderView.h:
* rendering/mathml/RenderMathMLBlock.cpp:
* rendering/mathml/RenderMathMLRow.cpp:
* rendering/mathml/RenderMathMLScripts.cpp:

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

44 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/rendering/FlowThreadController.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.h
Source/WebCore/rendering/RenderFullScreen.cpp
Source/WebCore/rendering/RenderFullScreen.h
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/RenderMultiColumnBlock.cpp
Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
Source/WebCore/rendering/RenderMultiColumnFlowThread.h
Source/WebCore/rendering/RenderMultiColumnSet.cpp
Source/WebCore/rendering/RenderMultiColumnSet.h
Source/WebCore/rendering/RenderNamedFlowThread.cpp
Source/WebCore/rendering/RenderNamedFlowThread.h
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderReplica.cpp
Source/WebCore/rendering/RenderReplica.h
Source/WebCore/rendering/RenderRuby.cpp
Source/WebCore/rendering/RenderRubyBase.cpp
Source/WebCore/rendering/RenderRubyBase.h
Source/WebCore/rendering/RenderRubyRun.cpp
Source/WebCore/rendering/RenderScrollbar.cpp
Source/WebCore/rendering/RenderScrollbarPart.cpp
Source/WebCore/rendering/RenderScrollbarPart.h
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCell.h
Source/WebCore/rendering/RenderTableRow.cpp
Source/WebCore/rendering/RenderTableRow.h
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h
Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
Source/WebCore/rendering/mathml/RenderMathMLRow.cpp
Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp

index 1c44b2f..a254c14 100644 (file)
@@ -1,5 +1,58 @@
 2013-09-15  Sam Weinig  <sam@webkit.org>
 
+        CTTE: RenderObject's createAnonymous() and setDocumentForAnonymous() should take Document references
+        https://bugs.webkit.org/show_bug.cgi?id=121400
+
+        Reviewed by Andreas Kling.
+
+        The Document used for anonymous renderers is never null.
+
+        * dom/Document.cpp:
+        * page/FrameView.cpp:
+        * rendering/FlowThreadController.cpp:
+        * rendering/RenderBlock.cpp:
+        * rendering/RenderBlock.h:
+        * rendering/RenderFlexibleBox.cpp:
+        * rendering/RenderFlexibleBox.h:
+        * rendering/RenderFullScreen.cpp:
+        * rendering/RenderFullScreen.h:
+        * rendering/RenderImage.cpp:
+        * rendering/RenderInline.cpp:
+        * rendering/RenderInline.h:
+        * rendering/RenderLayer.cpp:
+        * rendering/RenderListMarker.cpp:
+        * rendering/RenderMultiColumnBlock.cpp:
+        * rendering/RenderMultiColumnFlowThread.cpp:
+        * rendering/RenderMultiColumnFlowThread.h:
+        * rendering/RenderMultiColumnSet.cpp:
+        * rendering/RenderMultiColumnSet.h:
+        * rendering/RenderNamedFlowThread.cpp:
+        * rendering/RenderNamedFlowThread.h:
+        * rendering/RenderObject.h:
+        * rendering/RenderReplica.cpp:
+        * rendering/RenderReplica.h:
+        * rendering/RenderRuby.cpp:
+        * rendering/RenderRubyBase.cpp:
+        * rendering/RenderRubyBase.h:
+        * rendering/RenderRubyRun.cpp:
+        * rendering/RenderScrollbar.cpp:
+        * rendering/RenderScrollbarPart.cpp:
+        * rendering/RenderScrollbarPart.h:
+        * rendering/RenderTable.cpp:
+        * rendering/RenderTableCell.cpp:
+        * rendering/RenderTableCell.h:
+        * rendering/RenderTableRow.cpp:
+        * rendering/RenderTableRow.h:
+        * rendering/RenderTableSection.cpp:
+        * rendering/RenderText.cpp:
+        * rendering/RenderView.cpp:
+        * rendering/RenderView.h:
+        * rendering/mathml/RenderMathMLBlock.cpp:
+        * rendering/mathml/RenderMathMLRow.cpp:
+        * rendering/mathml/RenderMathMLScripts.cpp:
+
+2013-09-15  Sam Weinig  <sam@webkit.org>
+
         CTTE: ContentData::createRenderer() should take references
         https://bugs.webkit.org/show_bug.cgi?id=121399
 
index 974af7a..1d3ed79 100644 (file)
@@ -2000,7 +2000,7 @@ void Document::createRenderTree()
     if (!m_renderArena)
         m_renderArena = createOwned<RenderArena>();
     
-    setRenderView(new (m_renderArena.get()) RenderView(this));
+    setRenderView(new (m_renderArena.get()) RenderView(*this));
 #if USE(ACCELERATED_COMPOSITING)
     renderView()->setIsInWindow(true);
 #endif
index 475dcb9..f817af1 100644 (file)
@@ -3287,7 +3287,7 @@ void FrameView::updateScrollCorner()
 
     if (cornerStyle) {
         if (!m_scrollCorner)
-            m_scrollCorner = RenderScrollbarPart::createAnonymous(&renderer->document());
+            m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer->document());
         m_scrollCorner->setStyle(cornerStyle.release());
         invalidateScrollCorner(cornerRect);
     } else if (m_scrollCorner) {
index 82273f7..66dd2dd 100644 (file)
@@ -75,7 +75,7 @@ RenderNamedFlowThread& FlowThreadController::ensureRenderFlowThreadWithName(cons
     // Sanity check for the absence of a named flow in the "CREATED" state with the same name.
     ASSERT(!namedFlows->flowByName(name));
 
-    RenderNamedFlowThread* flowRenderer = RenderNamedFlowThread::createAnonymous(&m_view->document(), namedFlows->ensureFlowWithName(name));
+    RenderNamedFlowThread* flowRenderer = RenderNamedFlowThread::createAnonymous(m_view->document(), namedFlows->ensureFlowWithName(name));
     flowRenderer->setStyle(RenderFlowThread::createFlowThreadStyle(m_view->style()));
     m_renderNamedFlowThreadList->add(flowRenderer);
 
index 71e2140..0091b43 100644 (file)
@@ -194,9 +194,9 @@ RenderBlock::~RenderBlock()
         removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMap, gPositionedContainerMap);
 }
 
-RenderBlock* RenderBlock::createAnonymous(Document* document)
+RenderBlock* RenderBlock::createAnonymous(Document& document)
 {
-    RenderBlock* renderer = new (document->renderArena()) RenderBlockFlow(0);
+    RenderBlock* renderer = new (document.renderArena()) RenderBlockFlow(0);
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
@@ -5842,9 +5842,9 @@ void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
         // The first-letter renderer needs to be replaced. Create a new renderer of the right type.
         RenderBoxModelObject* newFirstLetter;
         if (pseudoStyle->display() == INLINE)
-            newFirstLetter = RenderInline::createAnonymous(&document());
+            newFirstLetter = RenderInline::createAnonymous(document());
         else
-            newFirstLetter = RenderBlock::createAnonymous(&document());
+            newFirstLetter = RenderBlock::createAnonymous(document());
         newFirstLetter->setStyle(pseudoStyle);
 
         // Move the first letter into the new renderer.
@@ -5884,9 +5884,9 @@ void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, Rend
     RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetterContainer);
     RenderObject* firstLetter = 0;
     if (pseudoStyle->display() == INLINE)
-        firstLetter = RenderInline::createAnonymous(&document());
+        firstLetter = RenderInline::createAnonymous(document());
     else
-        firstLetter = RenderBlock::createAnonymous(&document());
+        firstLetter = RenderBlock::createAnonymous(document());
     firstLetter->setStyle(pseudoStyle);
     firstLetterContainer->addChild(firstLetter, currentChild);
 
@@ -6907,10 +6907,10 @@ RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
     EDisplay newDisplay;
     RenderBlock* newBox = 0;
     if (display == FLEX || display == INLINE_FLEX) {
-        newBox = RenderFlexibleBox::createAnonymous(&parent->document());
+        newBox = RenderFlexibleBox::createAnonymous(parent->document());
         newDisplay = FLEX;
     } else {
-        newBox = RenderBlock::createAnonymous(&parent->document());
+        newBox = RenderBlock::createAnonymous(parent->document());
         newDisplay = BLOCK;
     }
 
@@ -6924,7 +6924,7 @@ RenderBlock* RenderBlock::createAnonymousColumnsWithParentRenderer(const RenderO
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), BLOCK);
     newStyle->inheritColumnPropertiesFrom(parent->style());
 
-    RenderBlock* newBox = RenderBlock::createAnonymous(&parent->document());
+    RenderBlock* newBox = RenderBlock::createAnonymous(parent->document());
     newBox->setStyle(newStyle.release());
     return newBox;
 }
@@ -6934,7 +6934,7 @@ RenderBlock* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const Rend
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), BLOCK);
     newStyle->setColumnSpan(ColumnSpanAll);
 
-    RenderBlock* newBox = RenderBlock::createAnonymous(&parent->document());
+    RenderBlock* newBox = RenderBlock::createAnonymous(parent->document());
     newBox->setStyle(newStyle.release());
     return newBox;
 }
index 243a7f7..97b9672 100644 (file)
@@ -101,7 +101,7 @@ protected:
     virtual ~RenderBlock();
 
 public:
-    static RenderBlock* createAnonymous(Document*);
+    static RenderBlock* createAnonymous(Document&);
 
     RenderObject* firstChild() const { return m_children.firstChild(); }
     RenderObject* lastChild() const { return m_children.lastChild(); }
index b91a7d1..849cba3 100644 (file)
@@ -135,9 +135,9 @@ RenderFlexibleBox::~RenderFlexibleBox()
 {
 }
 
-RenderFlexibleBox* RenderFlexibleBox::createAnonymous(Document* document)
+RenderFlexibleBox* RenderFlexibleBox::createAnonymous(Document& document)
 {
-    RenderFlexibleBox* renderer = new (document->renderArena()) RenderFlexibleBox(0);
+    RenderFlexibleBox* renderer = new (document.renderArena()) RenderFlexibleBox(0);
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
index 2193647..203f697 100644 (file)
@@ -40,7 +40,7 @@ public:
     RenderFlexibleBox(Element*);
     virtual ~RenderFlexibleBox();
 
-    static RenderFlexibleBox* createAnonymous(Document*);
+    static RenderFlexibleBox* createAnonymous(Document&);
 
     virtual const char* renderName() const OVERRIDE;
 
index 92a8218..4fd98c2 100644 (file)
@@ -43,7 +43,7 @@ public:
         : RenderBlockFlow(0)
         , m_owner(owner) 
     {
-        setDocumentForAnonymous(&owner->document());
+        setDocumentForAnonymous(owner->document());
     }
 private:
     virtual bool isRenderFullScreenPlaceholder() const { return true; }
@@ -64,9 +64,9 @@ RenderFullScreen::RenderFullScreen()
     setReplaced(false); 
 }
 
-RenderFullScreen* RenderFullScreen::createAnonymous(Document* document)
+RenderFullScreen* RenderFullScreen::createAnonymous(Document& document)
 {
-    RenderFullScreen* renderer = new (document->renderArena()) RenderFullScreen();
+    RenderFullScreen* renderer = new (document.renderArena()) RenderFullScreen();
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
@@ -116,7 +116,7 @@ static PassRefPtr<RenderStyle> createFullScreenStyle()
 
 RenderObject* RenderFullScreen::wrapRenderer(RenderObject* object, RenderObject* parent, Document* document)
 {
-    RenderFullScreen* fullscreenRenderer = RenderFullScreen::createAnonymous(document);
+    RenderFullScreen* fullscreenRenderer = RenderFullScreen::createAnonymous(*document);
     fullscreenRenderer->setStyle(createFullScreenStyle());
     if (parent && !parent->isChildAllowed(fullscreenRenderer, fullscreenRenderer->style())) {
         fullscreenRenderer->destroy();
index 8bf61c9..582f71c 100644 (file)
@@ -34,7 +34,7 @@ namespace WebCore {
 
 class RenderFullScreen FINAL : public RenderFlexibleBox {
 public:
-    static RenderFullScreen* createAnonymous(Document*);
+    static RenderFullScreen* createAnonymous(Document&);
 
     virtual bool isRenderFullScreen() const { return true; }
     virtual const char* renderName() const { return "RenderFullScreen"; }
index 2e9824f..1fed901 100644 (file)
@@ -65,7 +65,7 @@ RenderImage::RenderImage(Element* element)
 RenderImage* RenderImage::createAnonymous(Document& document)
 {
     RenderImage* image = new (document.renderArena()) RenderImage(0);
-    image->setDocumentForAnonymous(&document);
+    image->setDocumentForAnonymous(document);
     return image;
 }
 
index fdcb4b9..c9cd6c1 100644 (file)
@@ -56,9 +56,9 @@ RenderInline::RenderInline(Element* element)
     setChildrenInline(true);
 }
 
-RenderInline* RenderInline::createAnonymous(Document* document)
+RenderInline* RenderInline::createAnonymous(Document& document)
 {
-    RenderInline* renderer = new (document->renderArena()) RenderInline(0);
+    RenderInline* renderer = new (document.renderArena()) RenderInline(0);
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
@@ -318,7 +318,7 @@ void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb
         if (RenderObject* positionedAncestor = inFlowPositionedInlineAncestor(this))
             newStyle->setPosition(positionedAncestor->style()->position());
 
-        RenderBlock* newBox = RenderBlock::createAnonymous(&document());
+        RenderBlock* newBox = RenderBlock::createAnonymous(document());
         newBox->setStyle(newStyle.release());
         RenderBoxModelObject* oldContinuation = continuation();
         setContinuation(newBox);
index 148a057..487b03e 100644 (file)
@@ -35,7 +35,7 @@ class RenderInline : public RenderBoxModelObject {
 public:
     explicit RenderInline(Element*);
 
-    static RenderInline* createAnonymous(Document*);
+    static RenderInline* createAnonymous(Document&);
 
     RenderObject* firstChild() const { return m_children.firstChild(); }
     RenderObject* lastChild() const { return m_children.lastChild(); }
index e8b47d0..35e0d00 100644 (file)
@@ -6304,7 +6304,7 @@ void RenderLayer::updateScrollCornerStyle()
     RefPtr<RenderStyle> corner = renderer().hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
     if (corner) {
         if (!m_scrollCorner) {
-            m_scrollCorner = RenderScrollbarPart::createAnonymous(&renderer().document());
+            m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer().document());
             m_scrollCorner->setParent(&renderer());
         }
         m_scrollCorner->setStyle(corner.release());
@@ -6320,7 +6320,7 @@ void RenderLayer::updateResizerStyle()
     RefPtr<RenderStyle> resizer = renderer().hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(RESIZER), actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
     if (resizer) {
         if (!m_resizer) {
-            m_resizer = RenderScrollbarPart::createAnonymous(&renderer().document());
+            m_resizer = RenderScrollbarPart::createAnonymous(renderer().document());
             m_resizer->setParent(&renderer());
         }
         m_resizer->setStyle(resizer.release());
@@ -6338,7 +6338,7 @@ RenderLayer* RenderLayer::reflectionLayer() const
 void RenderLayer::createReflection()
 {
     ASSERT(!m_reflection);
-    m_reflection = RenderReplica::createAnonymous(&renderer().document());
+    m_reflection = RenderReplica::createAnonymous(renderer().document());
     m_reflection->setParent(&renderer()); // We create a 1-way connection.
 }
 
index bc96be6..b0befa3 100644 (file)
@@ -1136,7 +1136,7 @@ RenderListMarker* RenderListMarker::createAnonymous(RenderListItem& listItem)
 {
     Document& document = listItem.document();
     RenderListMarker* renderer = new (document.renderArena()) RenderListMarker(listItem);
-    renderer->setDocumentForAnonymous(&document);
+    renderer->setDocumentForAnonymous(document);
     return renderer;
 }
 
index 9a088fe..e3da22f 100644 (file)
@@ -139,7 +139,7 @@ bool RenderMultiColumnBlock::relayoutForPagination(bool, LayoutUnit, LayoutState
 void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* beforeChild)
 {
     if (!m_flowThread) {
-        m_flowThread = RenderMultiColumnFlowThread::createAnonymous(&document());
+        m_flowThread = RenderMultiColumnFlowThread::createAnonymous(document());
         m_flowThread->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK));
         RenderBlock::addChild(m_flowThread);
     }
index a88ae60..0de4d42 100644 (file)
@@ -40,9 +40,9 @@ RenderMultiColumnFlowThread::~RenderMultiColumnFlowThread()
 {
 }
 
-RenderMultiColumnFlowThread* RenderMultiColumnFlowThread::createAnonymous(Document* document)
+RenderMultiColumnFlowThread* RenderMultiColumnFlowThread::createAnonymous(Document& document)
 {
-    RenderMultiColumnFlowThread* renderer = new (document->renderArena()) RenderMultiColumnFlowThread();
+    RenderMultiColumnFlowThread* renderer = new (document.renderArena()) RenderMultiColumnFlowThread();
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
@@ -92,7 +92,7 @@ void RenderMultiColumnFlowThread::autoGenerateRegionsToBlockOffset(LayoutUnit /*
     invalidateRegions();
 
     RenderMultiColumnBlock* parentBlock = toRenderMultiColumnBlock(parent());
-    firstSet = RenderMultiColumnSet::createAnonymous(this);
+    firstSet = RenderMultiColumnSet::createAnonymous(*this);
     firstSet->setStyle(RenderStyle::createAnonymousStyleWithDisplay(parentBlock->style(), BLOCK));
     parentBlock->RenderBlock::addChild(firstSet);
 
index 5bdc5f2..471683f 100644 (file)
@@ -35,7 +35,7 @@ class RenderMultiColumnFlowThread FINAL : public RenderFlowThread {
 public:
     ~RenderMultiColumnFlowThread();
 
-    static RenderMultiColumnFlowThread* createAnonymous(Document*);
+    static RenderMultiColumnFlowThread* createAnonymous(Document&);
 
 private:
     RenderMultiColumnFlowThread();
index 34b4d12..2806c77 100644 (file)
@@ -49,11 +49,11 @@ RenderMultiColumnSet::RenderMultiColumnSet(RenderFlowThread* flowThread)
 {
 }
 
-RenderMultiColumnSet* RenderMultiColumnSet::createAnonymous(RenderFlowThread* flowThread)
+RenderMultiColumnSet* RenderMultiColumnSet::createAnonymous(RenderFlowThread& flowThread)
 {
-    Document& document = flowThread->document();
-    RenderMultiColumnSet* renderer = new (document.renderArena()) RenderMultiColumnSet(flowThread);
-    renderer->setDocumentForAnonymous(&document);
+    Document& document = flowThread.document();
+    RenderMultiColumnSet* renderer = new (document.renderArena()) RenderMultiColumnSet(&flowThread);
+    renderer->setDocumentForAnonymous(document);
     return renderer;
 }
 
index 055cdad..d8a9f69 100644 (file)
@@ -43,7 +43,7 @@ namespace WebCore {
 // come before and after the span.
 class RenderMultiColumnSet FINAL : public RenderRegionSet {
 public:
-    static RenderMultiColumnSet* createAnonymous(RenderFlowThread*);
+    static RenderMultiColumnSet* createAnonymous(RenderFlowThread&);
 
     virtual bool isRenderMultiColumnSet() const OVERRIDE { return true; }
 
index d4f6744..8eaab4a 100644 (file)
 
 namespace WebCore {
 
-RenderNamedFlowThread* RenderNamedFlowThread::createAnonymous(Document* document, PassRefPtr<WebKitNamedFlow> namedFlow)
+RenderNamedFlowThread* RenderNamedFlowThread::createAnonymous(Document& document, PassRefPtr<WebKitNamedFlow> namedFlow)
 {
-    ASSERT(document->cssRegionsEnabled());
-    RenderNamedFlowThread* renderer = new (document->renderArena()) RenderNamedFlowThread(namedFlow);
+    ASSERT(document.cssRegionsEnabled());
+    RenderNamedFlowThread* renderer = new (document.renderArena()) RenderNamedFlowThread(namedFlow);
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
index 81172b1..91b49ac 100644 (file)
@@ -47,7 +47,7 @@ class RenderNamedFlowThread FINAL : public RenderFlowThread {
 public:
     virtual ~RenderNamedFlowThread();
 
-    static RenderNamedFlowThread* createAnonymous(Document*, PassRefPtr<WebKitNamedFlow>);
+    static RenderNamedFlowThread* createAnonymous(Document&, PassRefPtr<WebKitNamedFlow>);
 
     const AtomicString& flowThreadName() const;
 
index dc46e23..1642990 100644 (file)
@@ -1030,7 +1030,7 @@ protected:
     virtual void insertedIntoTree();
     virtual void willBeRemovedFromTree();
 
-    void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_node = document; }
+    void setDocumentForAnonymous(Document& document) { ASSERT(isAnonymous()); m_node = &document; }
 
 private:
     RenderFlowThread* locateFlowThreadContainingBlock() const;
index e0f4ad2..6cc8d67 100644 (file)
@@ -44,9 +44,9 @@ RenderReplica::RenderReplica()
     setReplaced(true);
 }
 
-RenderReplica* RenderReplica::createAnonymous(Document* document)
+RenderReplica* RenderReplica::createAnonymous(Document& document)
 {
-    RenderReplica* renderer = new (document->renderArena()) RenderReplica();
+    RenderReplica* renderer = new (document.renderArena()) RenderReplica();
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
index 2ff2924..217a8cb 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 
 class RenderReplica FINAL : public RenderBox {
 public:
-    static RenderReplica* createAnonymous(Document*);
+    static RenderReplica* createAnonymous(Document&);
 
     virtual ~RenderReplica();
 
index ca7790b..3588d97 100644 (file)
@@ -83,10 +83,10 @@ static inline RenderBlock* rubyAfterBlock(const RenderObject* ruby)
     return isRubyAfterBlock(child) ? toRenderBlock(child) : 0;
 }
 
-static RenderBlock* createAnonymousRubyInlineBlock(RenderObject* ruby)
+static RenderBlock* createAnonymousRubyInlineBlock(RenderObject& ruby)
 {
-    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(ruby->style(), INLINE_BLOCK);
-    RenderBlock* newBlock = RenderBlock::createAnonymous(&ruby->document());
+    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(ruby.style(), INLINE_BLOCK);
+    RenderBlock* newBlock = RenderBlock::createAnonymous(ruby.document());
     newBlock->setStyle(newStyle.release());
     return newBlock;
 }
@@ -135,7 +135,7 @@ void RenderRubyAsInline::addChild(RenderObject* child, RenderObject* beforeChild
             // Wrap non-inline content with an anonymous inline-block.
             RenderBlock* beforeBlock = rubyBeforeBlock(this);
             if (!beforeBlock) {
-                beforeBlock = createAnonymousRubyInlineBlock(this);
+                beforeBlock = createAnonymousRubyInlineBlock(*this);
                 RenderInline::addChild(beforeBlock, firstChild());
             }
             beforeBlock->addChild(child);
@@ -150,7 +150,7 @@ void RenderRubyAsInline::addChild(RenderObject* child, RenderObject* beforeChild
             // Wrap non-inline content with an anonymous inline-block.
             RenderBlock* afterBlock = rubyAfterBlock(this);
             if (!afterBlock) {
-                afterBlock = createAnonymousRubyInlineBlock(this);
+                afterBlock = createAnonymousRubyInlineBlock(*this);
                 RenderInline::addChild(afterBlock);
             }
             afterBlock->addChild(child);
@@ -241,7 +241,7 @@ void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild)
             // Wrap non-inline content with an anonymous inline-block.
             RenderBlock* beforeBlock = rubyBeforeBlock(this);
             if (!beforeBlock) {
-                beforeBlock = createAnonymousRubyInlineBlock(this);
+                beforeBlock = createAnonymousRubyInlineBlock(*this);
                 RenderBlock::addChild(beforeBlock, firstChild());
             }
             beforeBlock->addChild(child);
@@ -256,7 +256,7 @@ void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild)
             // Wrap non-inline content with an anonymous inline-block.
             RenderBlock* afterBlock = rubyAfterBlock(this);
             if (!afterBlock) {
-                afterBlock = createAnonymousRubyInlineBlock(this);
+                afterBlock = createAnonymousRubyInlineBlock(*this);
                 RenderBlock::addChild(afterBlock);
             }
             afterBlock->addChild(child);
index 5fa023c..c55d79e 100644 (file)
@@ -48,9 +48,9 @@ RenderRubyBase::~RenderRubyBase()
 {
 }
 
-RenderRubyBase* RenderRubyBase::createAnonymous(Document* document)
+RenderRubyBase* RenderRubyBase::createAnonymous(Document& document)
 {
-    RenderRubyBase* renderer = new (document->renderArena()) RenderRubyBase();
+    RenderRubyBase* renderer = new (document.renderArena()) RenderRubyBase();
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
index 11824e0..1cc90c6 100644 (file)
@@ -41,7 +41,7 @@ class RenderRubyBase FINAL : public RenderBlockFlow {
 public:
     virtual ~RenderRubyBase();
     
-    static RenderRubyBase* createAnonymous(Document*);
+    static RenderRubyBase* createAnonymous(Document&);
 
     virtual const char* renderName() const { return "RenderRubyBase (anonymous)"; }
 
index c25879e..65f44dd 100644 (file)
@@ -200,7 +200,7 @@ void RenderRubyRun::removeChild(RenderObject* child)
 
 RenderRubyBase* RenderRubyRun::createRubyBase() const
 {
-    RenderRubyBase* renderer = RenderRubyBase::createAnonymous(&document());
+    RenderRubyBase* renderer = RenderRubyBase::createAnonymous(document());
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK);
     newStyle->setTextAlign(CENTER); // FIXME: use WEBKIT_CENTER?
     renderer->setStyle(newStyle.release());
@@ -211,7 +211,7 @@ RenderRubyRun* RenderRubyRun::staticCreateRubyRun(const RenderObject* parentRuby
 {
     ASSERT(parentRuby && parentRuby->isRuby());
     RenderRubyRun* rr = new (parentRuby->renderArena()) RenderRubyRun();
-    rr->setDocumentForAnonymous(&parentRuby->document());
+    rr->setDocumentForAnonymous(parentRuby->document());
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parentRuby->style(), INLINE_BLOCK);
     rr->setStyle(newStyle.release());
     return rr;
index c151414..f614cc7 100644 (file)
@@ -253,7 +253,7 @@ void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy)
     
     RenderScrollbarPart* partRenderer = m_parts.get(partType);
     if (!partRenderer && needRenderer) {
-        partRenderer = RenderScrollbarPart::createAnonymous(&owningRenderer()->document(), this, partType);
+        partRenderer = RenderScrollbarPart::createAnonymous(owningRenderer()->document(), this, partType);
         m_parts.set(partType, partRenderer);
     } else if (partRenderer && !needRenderer) {
         m_parts.remove(partType);
index bb3f714..edb0e15 100644 (file)
@@ -47,9 +47,9 @@ RenderScrollbarPart::~RenderScrollbarPart()
 {
 }
 
-RenderScrollbarPart* RenderScrollbarPart::createAnonymous(Document* document, RenderScrollbar* scrollbar, ScrollbarPart part)
+RenderScrollbarPart* RenderScrollbarPart::createAnonymous(Document& document, RenderScrollbar* scrollbar, ScrollbarPart part)
 {
-    RenderScrollbarPart* renderer = new (document->renderArena()) RenderScrollbarPart(scrollbar, part);
+    RenderScrollbarPart* renderer = new (document.renderArena()) RenderScrollbarPart(scrollbar, part);
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
index 79eb947..01f6f47 100644 (file)
@@ -35,7 +35,7 @@ class RenderScrollbar;
 
 class RenderScrollbarPart FINAL : public RenderBlock {
 public:
-    static RenderScrollbarPart* createAnonymous(Document*, RenderScrollbar* = 0, ScrollbarPart = NoPart);
+    static RenderScrollbarPart* createAnonymous(Document&, RenderScrollbar* = 0, ScrollbarPart = NoPart);
     
     virtual ~RenderScrollbarPart();
 
index 1c14a8e..78f022f 100644 (file)
@@ -1415,7 +1415,7 @@ RenderTable* RenderTable::createAnonymousWithParentRenderer(const RenderObject*
 {
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), TABLE);
     RenderTable* newTable = new (parent->renderArena()) RenderTable(0);
-    newTable->setDocumentForAnonymous(&parent->document());
+    newTable->setDocumentForAnonymous(parent->document());
     newTable->setStyle(newStyle.release());
     return newTable;
 }
index 4154d56..3960fe8 100644 (file)
@@ -1364,16 +1364,16 @@ void RenderTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool ve
         setIntrinsicPaddingAfter(intrinsicPaddingAfter() - scrollbarHeight);
 }
 
-RenderTableCell* RenderTableCell::createAnonymous(Document* document)
+RenderTableCell* RenderTableCell::createAnonymous(Document& document)
 {
-    RenderTableCell* renderer = new (document->renderArena()) RenderTableCell(0);
+    RenderTableCell* renderer = new (document.renderArena()) RenderTableCell(0);
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
 
 RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const RenderObject* parent)
 {
-    RenderTableCell* newCell = RenderTableCell::createAnonymous(&parent->document());
+    RenderTableCell* newCell = RenderTableCell::createAnonymous(parent->document());
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), TABLE_CELL);
     newCell->setStyle(newStyle.release());
     return newCell;
index 2f0fd23..658c9ff 100644 (file)
@@ -158,7 +158,7 @@ public:
     bool cellWidthChanged() const { return m_cellWidthChanged; }
     void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; }
 
-    static RenderTableCell* createAnonymous(Document*);
+    static RenderTableCell* createAnonymous(Document&);
     static RenderTableCell* createAnonymousWithParentRenderer(const RenderObject*);
     virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
     {
index b12e029..23fa13d 100644 (file)
@@ -264,16 +264,16 @@ void RenderTableRow::imageChanged(WrappedImagePtr, const IntRect*)
     repaint();
 }
 
-RenderTableRow* RenderTableRow::createAnonymous(Document* document)
+RenderTableRow* RenderTableRow::createAnonymous(Document& document)
 {
-    RenderTableRow* renderer = new (document->renderArena()) RenderTableRow(0);
+    RenderTableRow* renderer = new (document.renderArena()) RenderTableRow(0);
     renderer->setDocumentForAnonymous(document);
     return renderer;
 }
 
 RenderTableRow* RenderTableRow::createAnonymousWithParentRenderer(const RenderObject* parent)
 {
-    RenderTableRow* newRow = RenderTableRow::createAnonymous(&parent->document());
+    RenderTableRow* newRow = RenderTableRow::createAnonymous(parent->document());
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), TABLE_ROW);
     newRow->setStyle(newStyle.release());
     return newRow;
index c1e0b70..705eb32 100644 (file)
@@ -47,7 +47,7 @@ public:
 
     void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
 
-    static RenderTableRow* createAnonymous(Document*);
+    static RenderTableRow* createAnonymous(Document&);
     static RenderTableRow* createAnonymousWithParentRenderer(const RenderObject*);
     virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
     {
index bf3b6ca..24769e1 100644 (file)
@@ -1438,7 +1438,7 @@ RenderTableSection* RenderTableSection::createAnonymousWithParentRenderer(const
 {
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), TABLE_ROW_GROUP);
     RenderTableSection* newSection = new (parent->renderArena()) RenderTableSection(0);
-    newSection->setDocumentForAnonymous(&parent->document());
+    newSection->setDocumentForAnonymous(parent->document());
     newSection->setStyle(newStyle.release());
     return newSection;
 }
index d8c1e1c..e684a86 100644 (file)
@@ -160,7 +160,7 @@ RenderText::RenderText(Node* node, PassRefPtr<StringImpl> str)
     // FIXME: Some clients of RenderText (and subclasses) pass Document as node to create anonymous renderer.
     // They should be switched to passing null and using setDocumentForAnonymous.
     if (node && node->isDocumentNode())
-        setDocumentForAnonymous(toDocument(node));
+        setDocumentForAnonymous(*toDocument(node));
 
     m_isAllASCII = m_text.containsOnlyASCII();
     m_canUseSimpleFontCodePath = computeCanUseSimpleFontCodePath();
index ba3c736..c447deb 100644 (file)
@@ -56,9 +56,9 @@
 
 namespace WebCore {
 
-RenderView::RenderView(Document* document)
+RenderView::RenderView(Document& document)
     : RenderBlockFlow(0)
-    , m_frameView(*document->view())
+    , m_frameView(*document.view())
     , m_selectionStart(0)
     , m_selectionEnd(0)
     , m_selectionStartPos(-1)
@@ -79,7 +79,7 @@ RenderView::RenderView(Document* document)
     setDocumentForAnonymous(document);
 
     // FIXME: We should find a way to enforce this at compile time.
-    ASSERT(document->view());
+    ASSERT(document.view());
 
     // init RenderObject attributes
     setInline(false);
index f5bac32..597e5a6 100644 (file)
@@ -44,7 +44,7 @@ class CustomFilterGlobalContext;
 
 class RenderView FINAL : public RenderBlockFlow {
 public:
-    explicit RenderView(Document*);
+    explicit RenderView(Document&);
     virtual ~RenderView();
 
     bool hitTest(const HitTestRequest&, HitTestResult&);
index 78ba9d6..3c56c3d 100644 (file)
@@ -66,7 +66,7 @@ RenderMathMLBlock* RenderMathMLBlock::createAnonymousMathMLBlock(EDisplay displa
 {
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), display);
     RenderMathMLBlock* newBlock = new (renderArena()) RenderMathMLBlock(0);
-    newBlock->setDocumentForAnonymous(&document());
+    newBlock->setDocumentForAnonymous(document());
     newBlock->setStyle(newStyle.release());
     return newBlock;
 }
index aaa96f2..25fb75b 100644 (file)
@@ -46,7 +46,7 @@ RenderMathMLRow* RenderMathMLRow::createAnonymousWithParentRenderer(const Render
 {
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), FLEX);
     RenderMathMLRow* newMRow = new (parent->renderArena()) RenderMathMLRow(0);
-    newMRow->setDocumentForAnonymous(&parent->document());
+    newMRow->setDocumentForAnonymous(parent->document());
     newMRow->setStyle(newStyle.release());
     return newMRow;
 }
index fa5cf31..2084fe9 100644 (file)
@@ -364,7 +364,7 @@ RenderMathMLScriptsWrapper* RenderMathMLScriptsWrapper::createAnonymousWrapper(R
 {
     RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(renderObject->style(), FLEX);
     RenderMathMLScriptsWrapper* newBlock = new (renderObject->renderArena()) RenderMathMLScriptsWrapper(0, type);
-    newBlock->setDocumentForAnonymous(&renderObject->document());
+    newBlock->setDocumentForAnonymous(renderObject->document());
     newBlock->setStyle(newStyle.release());
     return newBlock;
 }