CTTE: ContentData::createRenderer() should take references
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Sep 2013 19:19:32 +0000 (19:19 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Sep 2013 19:19:32 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121399

Reviewed by Andreas Kling.

- Convert createRenderer(Document*, RenderStyle*) to createRenderer(Document&, RenderStyle&)
- Do a drive by final-ing of ContentData derived classes.

* dom/PseudoElement.cpp:
(WebCore::PseudoElement::didAttachRenderers):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::createAnonymous):
* rendering/RenderImage.h:
* rendering/style/ContentData.cpp:
(WebCore::ImageContentData::createRenderer):
(WebCore::TextContentData::createRenderer):
(WebCore::CounterContentData::createRenderer):
(WebCore::QuoteContentData::createRenderer):
* rendering/style/ContentData.h:

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

Source/WebCore/ChangeLog
Source/WebCore/dom/PseudoElement.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderImage.h
Source/WebCore/rendering/style/ContentData.cpp
Source/WebCore/rendering/style/ContentData.h

index 8a4689c..1c44b2f 100644 (file)
@@ -1,3 +1,25 @@
+2013-09-15  Sam Weinig  <sam@webkit.org>
+
+        CTTE: ContentData::createRenderer() should take references
+        https://bugs.webkit.org/show_bug.cgi?id=121399
+
+        Reviewed by Andreas Kling.
+
+        - Convert createRenderer(Document*, RenderStyle*) to createRenderer(Document&, RenderStyle&)
+        - Do a drive by final-ing of ContentData derived classes.
+
+        * dom/PseudoElement.cpp:
+        (WebCore::PseudoElement::didAttachRenderers):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::createAnonymous):
+        * rendering/RenderImage.h:
+        * rendering/style/ContentData.cpp:
+        (WebCore::ImageContentData::createRenderer):
+        (WebCore::TextContentData::createRenderer):
+        (WebCore::CounterContentData::createRenderer):
+        (WebCore::QuoteContentData::createRenderer):
+        * rendering/style/ContentData.h:
+
 2013-09-15  Andreas Kling  <akling@apple.com>
 
         CTTE: RenderFrameSet is never anonymous.
index e8f3c59..4d65dbf 100644 (file)
@@ -86,7 +86,7 @@ void PseudoElement::didAttachRenderers()
     ASSERT(style->contentData());
 
     for (const ContentData* content = style->contentData(); content; content = content->next()) {
-        RenderObject* child = content->createRenderer(&document(), style);
+        RenderObject* child = content->createRenderer(document(), *style);
         if (renderer->isChildAllowed(child, style)) {
             renderer->addChild(child);
             if (child->isQuote())
index e454069..2e9824f 100644 (file)
@@ -62,10 +62,10 @@ RenderImage::RenderImage(Element* element)
     updateAltText();
 }
 
-RenderImage* RenderImage::createAnonymous(Document* document)
+RenderImage* RenderImage::createAnonymous(Document& document)
 {
-    RenderImage* image = new (document->renderArena()) RenderImage(0);
-    image->setDocumentForAnonymous(document);
+    RenderImage* image = new (document.renderArena()) RenderImage(0);
+    image->setDocumentForAnonymous(&document);
     return image;
 }
 
index ef9c4f9..5137826 100644 (file)
@@ -38,7 +38,7 @@ public:
     RenderImage(Element*);
     virtual ~RenderImage();
 
-    static RenderImage* createAnonymous(Document*);
+    static RenderImage* createAnonymous(Document&);
 
     void setImageResource(PassOwnPtr<RenderImageResource>);
 
index 7a115b9..caba86e 100644 (file)
@@ -67,10 +67,10 @@ PassOwnPtr<ContentData> ContentData::clone() const
     return result.release();
 }
 
-RenderObject* ImageContentData::createRenderer(Document* doc, RenderStyle* pseudoStyle) const
+RenderObject* ImageContentData::createRenderer(Document& document, RenderStyle& pseudoStyle) const
 {
-    RenderImage* image = RenderImage::createAnonymous(doc);
-    image->setPseudoStyle(pseudoStyle);
+    RenderImage* image = RenderImage::createAnonymous(document);
+    image->setPseudoStyle(&pseudoStyle);
     if (m_image)
         image->setImageResource(RenderImageResourceStyleImage::create(m_image.get()));
     else
@@ -78,24 +78,24 @@ RenderObject* ImageContentData::createRenderer(Document* doc, RenderStyle* pseud
     return image;
 }
 
-RenderObject* TextContentData::createRenderer(Document* doc, RenderStyle* pseudoStyle) const
+RenderObject* TextContentData::createRenderer(Document& document, RenderStyle& pseudoStyle) const
 {
-    RenderObject* renderer = new (doc->renderArena()) RenderTextFragment(doc, m_text.impl());
-    renderer->setPseudoStyle(pseudoStyle);
+    RenderObject* renderer = new (document.renderArena()) RenderTextFragment(&document, m_text.impl());
+    renderer->setPseudoStyle(&pseudoStyle);
     return renderer;
 }
 
-RenderObject* CounterContentData::createRenderer(Document* doc, RenderStyle* pseudoStyle) const
+RenderObject* CounterContentData::createRenderer(Document& document, RenderStyle& pseudoStyle) const
 {
-    RenderObject* renderer = new (doc->renderArena()) RenderCounter(doc, *m_counter);
-    renderer->setPseudoStyle(pseudoStyle);
+    RenderObject* renderer = new (document.renderArena()) RenderCounter(&document, *m_counter);
+    renderer->setPseudoStyle(&pseudoStyle);
     return renderer;
 }
 
-RenderObject* QuoteContentData::createRenderer(Document* doc, RenderStyle* pseudoStyle) const
+RenderObject* QuoteContentData::createRenderer(Document& document, RenderStyle& pseudoStyle) const
 {
-    RenderObject* renderer = new (doc->renderArena()) RenderQuote(doc, m_quote);
-    renderer->setPseudoStyle(pseudoStyle);
+    RenderObject* renderer = new (document.renderArena()) RenderQuote(&document, m_quote);
+    renderer->setPseudoStyle(&pseudoStyle);
     return renderer;
 }
 
index 3346a65..a601a8c 100644 (file)
@@ -51,7 +51,7 @@ public:
     virtual bool isQuote() const { return false; }
     virtual bool isText() const { return false; }
 
-    virtual RenderObject* createRenderer(Document*, RenderStyle*) const = 0;
+    virtual RenderObject* createRenderer(Document&, RenderStyle&) const = 0;
 
     virtual PassOwnPtr<ContentData> clone() const;
 
@@ -66,7 +66,7 @@ private:
     OwnPtr<ContentData> m_next;
 };
 
-class ImageContentData : public ContentData {
+class ImageContentData FINAL : public ContentData {
     friend class ContentData;
 public:
     const StyleImage* image() const { return m_image.get(); }
@@ -74,7 +74,7 @@ public:
     void setImage(PassRefPtr<StyleImage> image) { m_image = image; }
 
     virtual bool isImage() const OVERRIDE { return true; }
-    virtual RenderObject* createRenderer(Document*, RenderStyle*) const OVERRIDE;
+    virtual RenderObject* createRenderer(Document&, RenderStyle&) const OVERRIDE;
 
     virtual bool equals(const ContentData& data) const OVERRIDE
     {
@@ -98,14 +98,14 @@ private:
     RefPtr<StyleImage> m_image;
 };
 
-class TextContentData : public ContentData {
+class TextContentData FINAL : public ContentData {
     friend class ContentData;
 public:
     const String& text() const { return m_text; }
     void setText(const String& text) { m_text = text; }
 
     virtual bool isText() const OVERRIDE { return true; }
-    virtual RenderObject* createRenderer(Document*, RenderStyle*) const OVERRIDE;
+    virtual RenderObject* createRenderer(Document&, RenderStyle&) const OVERRIDE;
 
     virtual bool equals(const ContentData& data) const OVERRIDE
     {
@@ -125,14 +125,14 @@ private:
     String m_text;
 };
 
-class CounterContentData : public ContentData {
+class CounterContentData FINAL : public ContentData {
     friend class ContentData;
 public:
     const CounterContent* counter() const { return m_counter.get(); }
     void setCounter(PassOwnPtr<CounterContent> counter) { m_counter = counter; }
 
     virtual bool isCounter() const OVERRIDE { return true; }
-    virtual RenderObject* createRenderer(Document*, RenderStyle*) const OVERRIDE;
+    virtual RenderObject* createRenderer(Document&, RenderStyle&) const OVERRIDE;
 
 private:
     CounterContentData(PassOwnPtr<CounterContent> counter)
@@ -156,14 +156,14 @@ private:
     OwnPtr<CounterContent> m_counter;
 };
 
-class QuoteContentData : public ContentData {
+class QuoteContentData FINAL : public ContentData {
     friend class ContentData;
 public:
     QuoteType quote() const { return m_quote; }
     void setQuote(QuoteType quote) { m_quote = quote; }
 
     virtual bool isQuote() const OVERRIDE { return true; }
-    virtual RenderObject* createRenderer(Document*, RenderStyle*) const OVERRIDE;
+    virtual RenderObject* createRenderer(Document&, RenderStyle&) const OVERRIDE;
 
     virtual bool equals(const ContentData& data) const OVERRIDE
     {