Purge PassRefPtr in WebCore/rendering
authorgyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 May 2015 02:06:54 +0000 (02:06 +0000)
committergyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 May 2015 02:06:54 +0000 (02:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144872

Patch by Gyuyoung Kim <gyuyoung.kim@webkit.org> on 2015-05-11
Reviewed by Darin Adler.

As a step to remove PassRefPtr, this patch replaces PassRefPtr with Ref in WebCore/rendering.

No new tests, no behavior changes.

* rendering/HitTestingTransformState.h:
(WebCore::HitTestingTransformState::create):
* rendering/RenderLayer.cpp:
(WebCore::ClipRects::create):
* rendering/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::create):
(WebCore::RenderTheme::themeForPage):
* rendering/RenderThemeGtk.h:
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderTheme::themeForPage):
(WebCore::RenderThemeIOS::create):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderTheme::themeForPage):
(WebCore::RenderThemeMac::create):
* rendering/RenderThemeSafari.cpp:
(WebCore::RenderThemeSafari::create):
(WebCore::RenderTheme::themeForPage):
* rendering/RenderThemeSafari.h:
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::create):
(WebCore::RenderTheme::themeForPage):
* rendering/RenderThemeWin.h:
* rendering/TextAutoSizing.h:
(WebCore::TextAutoSizingValue::create):
* rendering/style/ShapeValue.h:
(WebCore::ShapeValue::createShapeValue):
(WebCore::ShapeValue::createBoxShapeValue):
(WebCore::ShapeValue::createImageValue):
* rendering/style/StyleCachedImage.h:
* rendering/style/StyleCachedImageSet.h:
* rendering/style/StyleGeneratedImage.h:
* rendering/style/StylePendingImage.h:
* rendering/style/StyleReflection.h:
(WebCore::StyleReflection::create):

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

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/rendering/HitTestingTransformState.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderThemeGtk.cpp
Source/WebCore/rendering/RenderThemeGtk.h
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderThemeSafari.cpp
Source/WebCore/rendering/RenderThemeSafari.h
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebCore/rendering/RenderThemeWin.h
Source/WebCore/rendering/TextAutoSizing.h
Source/WebCore/rendering/style/ShapeValue.h
Source/WebCore/rendering/style/StyleCachedImage.h
Source/WebCore/rendering/style/StyleCachedImageSet.h
Source/WebCore/rendering/style/StyleGeneratedImage.h
Source/WebCore/rendering/style/StylePendingImage.h
Source/WebCore/rendering/style/StyleReflection.h

index 0f40047..3bc8768 100644 (file)
@@ -1,3 +1,51 @@
+2015-05-11  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
+        Purge PassRefPtr in WebCore/rendering
+        https://bugs.webkit.org/show_bug.cgi?id=144872
+
+        Reviewed by Darin Adler.
+
+        As a step to remove PassRefPtr, this patch replaces PassRefPtr with Ref in WebCore/rendering.
+
+        No new tests, no behavior changes.
+
+        * rendering/HitTestingTransformState.h:
+        (WebCore::HitTestingTransformState::create):
+        * rendering/RenderLayer.cpp:
+        (WebCore::ClipRects::create):
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::create):
+        (WebCore::RenderTheme::themeForPage):
+        * rendering/RenderThemeGtk.h:
+        * rendering/RenderThemeIOS.h:
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderTheme::themeForPage):
+        (WebCore::RenderThemeIOS::create):
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderTheme::themeForPage):
+        (WebCore::RenderThemeMac::create):
+        * rendering/RenderThemeSafari.cpp:
+        (WebCore::RenderThemeSafari::create):
+        (WebCore::RenderTheme::themeForPage):
+        * rendering/RenderThemeSafari.h:
+        * rendering/RenderThemeWin.cpp:
+        (WebCore::RenderThemeWin::create):
+        (WebCore::RenderTheme::themeForPage):
+        * rendering/RenderThemeWin.h:
+        * rendering/TextAutoSizing.h:
+        (WebCore::TextAutoSizingValue::create):
+        * rendering/style/ShapeValue.h:
+        (WebCore::ShapeValue::createShapeValue):
+        (WebCore::ShapeValue::createBoxShapeValue):
+        (WebCore::ShapeValue::createImageValue):
+        * rendering/style/StyleCachedImage.h:
+        * rendering/style/StyleCachedImageSet.h:
+        * rendering/style/StyleGeneratedImage.h:
+        * rendering/style/StylePendingImage.h:
+        * rendering/style/StyleReflection.h:
+        (WebCore::StyleReflection::create):
+
 2015-05-11  Eric Carlson  <eric.carlson@apple.com>
 
         [Mac] Update device picker icon when video tracks change
index 679ba22..a720c69 100644 (file)
@@ -31,7 +31,7 @@
 #include "FloatQuad.h"
 #include "IntSize.h"
 #include "TransformationMatrix.h"
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
@@ -42,14 +42,14 @@ namespace WebCore {
 // differently than move()) so care has to be taken when this is done.
 class HitTestingTransformState : public RefCounted<HitTestingTransformState> {
 public:
-    static PassRefPtr<HitTestingTransformState> create(const FloatPoint& p, const FloatQuad& quad, const FloatQuad& area)
+    static Ref<HitTestingTransformState> create(const FloatPoint& p, const FloatQuad& quad, const FloatQuad& area)
     {
-        return adoptRef(new HitTestingTransformState(p, quad, area));
+        return adoptRef(*new HitTestingTransformState(p, quad, area));
     }
 
-    static PassRefPtr<HitTestingTransformState> create(const HitTestingTransformState& other)
+    static Ref<HitTestingTransformState> create(const HitTestingTransformState& other)
     {
-        return adoptRef(new HitTestingTransformState(other));
+        return adoptRef(*new HitTestingTransformState(other));
     }
 
     enum TransformAccumulation { FlattenTransform, AccumulateTransform };
index d8beffb..54740cc 100644 (file)
@@ -137,14 +137,14 @@ using namespace HTMLNames;
 class ClipRects {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<ClipRects> create()
+    static Ref<ClipRects> create()
     {
-        return adoptRef(new ClipRects);
+        return adoptRef(*new ClipRects);
     }
 
-    static PassRefPtr<ClipRects> create(const ClipRects& other)
+    static Ref<ClipRects> create(const ClipRects& other)
     {
-        return adoptRef(new ClipRects(other));
+        return adoptRef(*new ClipRects(other));
     }
 
     ClipRects() = default;
index 72d4684..b7f0b4b 100644 (file)
 
 namespace WebCore {
 
-PassRefPtr<RenderTheme> RenderThemeGtk::create()
+Ref<RenderTheme> RenderThemeGtk::create()
 {
-    return adoptRef(new RenderThemeGtk());
+    return adoptRef(*new RenderThemeGtk());
 }
 
 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*)
 {
-    static RenderTheme* rt = RenderThemeGtk::create().leakRef();
-    return rt;
+    static RenderTheme& rt = RenderThemeGtk::create().leakRef();
+    return &rt;
 }
 
 static double getScreenDPI()
index 9858dd5..24e68df 100644 (file)
@@ -34,7 +34,7 @@ namespace WebCore {
 
 class RenderThemeGtk final : public RenderTheme {
 public:
-    static PassRefPtr<RenderTheme> create();
+    static Ref<RenderTheme> create();
 
 #if ENABLE(DATALIST_ELEMENT)
     // Returns size of one slider tick mark for a horizontal track.
index ee32d76..a44b750 100644 (file)
@@ -37,7 +37,7 @@ class GraphicsContext;
     
 class RenderThemeIOS final : public RenderTheme {
 public:
-    static PassRefPtr<RenderTheme> create();
+    static Ref<RenderTheme> create();
 
     virtual int popupInternalPaddingRight(RenderStyle&) const override;
 
index 01f2473..c5e789c 100644 (file)
@@ -291,13 +291,13 @@ RenderThemeIOS::RenderThemeIOS()
 
 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*)
 {
-    static RenderTheme* renderTheme = RenderThemeIOS::create().leakRef();
-    return renderTheme;
+    static RenderTheme& renderTheme = RenderThemeIOS::create().leakRef();
+    return &renderTheme;
 }
 
-PassRefPtr<RenderTheme> RenderThemeIOS::create()
+Ref<RenderTheme> RenderThemeIOS::create()
 {
-    return adoptRef(new RenderThemeIOS);
+    return adoptRef(*new RenderThemeIOS);
 }
 
 static String& _contentSizeCategory()
index 0aa4007..e05b87a 100644 (file)
@@ -42,7 +42,7 @@ struct AttachmentLayout;
 
 class RenderThemeMac final : public RenderTheme {
 public:
-    static PassRefPtr<RenderTheme> create();
+    static Ref<RenderTheme> create();
 
     // A method asking if the control changes its tint when the window has focus or not.
     virtual bool controlSupportsTints(const RenderObject&) const override;
index f02ddbe..8be3656 100644 (file)
@@ -201,13 +201,13 @@ enum {
 
 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*)
 {
-    static RenderTheme* rt = RenderThemeMac::create().leakRef();
-    return rt;
+    static RenderTheme& rt = RenderThemeMac::create().leakRef();
+    return &rt;
 }
 
-PassRefPtr<RenderTheme> RenderThemeMac::create()
+Ref<RenderTheme> RenderThemeMac::create()
 {
-    return adoptRef(new RenderThemeMac);
+    return adoptRef(*new RenderThemeMac);
 }
 
 RenderThemeMac::RenderThemeMac()
index a56eb43..8362998 100644 (file)
@@ -73,24 +73,24 @@ enum {
     leftPadding
 };
 
-PassRefPtr<RenderTheme> RenderThemeSafari::create()
+Ref<RenderTheme> RenderThemeSafari::create()
 {
-    return adoptRef(new RenderThemeSafari);
+    return adoptRef(*new RenderThemeSafari);
 }
 
 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
 {
-    static RenderTheme* safariTheme = RenderThemeSafari::create().leakRef();
-    static RenderTheme* windowsTheme = RenderThemeWin::create().leakRef();
+    static RenderTheme& safariTheme = RenderThemeSafari::create().leakRef();
+    static RenderTheme& windowsTheme = RenderThemeWin::create().leakRef();
 
     // FIXME: This is called before Settings has been initialized by WebKit, so will return a
     // potentially wrong answer the very first time it's called (see
     // <https://bugs.webkit.org/show_bug.cgi?id=26493>).
     if (Settings::shouldPaintNativeControls()) {
         RenderTheme::setCustomFocusRingColor(safariTheme->platformFocusRingColor());
-        return windowsTheme; // keep the reference of one.
+        return &windowsTheme;
     }
-    return safariTheme; // keep the reference of one.
+    return &safariTheme;
 }
 
 #ifdef DEBUG_ALL
index efd39be..b2800b8 100644 (file)
@@ -47,7 +47,7 @@ class RenderStyle;
 
 class RenderThemeSafari : public RenderTheme {
 public:
-    static PassRefPtr<RenderTheme> create();
+    static Ref<RenderTheme> create();
 
     // A method to obtain the baseline position for a "leaf" control.  This will only be used if a baseline
     // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
index 2bee8e5..b8e250b 100644 (file)
@@ -182,15 +182,15 @@ void RenderThemeWin::setWebKitIsBeingUnloaded()
     gWebKitIsBeingUnloaded = true;
 }
 
-PassRefPtr<RenderTheme> RenderThemeWin::create()
+Ref<RenderTheme> RenderThemeWin::create()
 {
-    return adoptRef(new RenderThemeWin);
+    return adoptRef(*new RenderThemeWin);
 }
 
 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
 {
-    static RenderTheme* winTheme = RenderThemeWin::create().leakRef();
-    return winTheme;
+    static RenderTheme& winTheme = RenderThemeWin::create().leakRef();
+    return &winTheme;
 }
 
 RenderThemeWin::RenderThemeWin()
index 4e19498..d162d82 100644 (file)
@@ -49,7 +49,7 @@ struct ThemeData {
 
 class RenderThemeWin final: public RenderTheme {
 public:
-    static PassRefPtr<RenderTheme> create();
+    static Ref<RenderTheme> create();
 
     virtual String extraDefaultStyleSheet() override;
     virtual String extraQuirksStyleSheet() override;
index 33e30e7..f5fa909 100644 (file)
@@ -73,9 +73,9 @@ struct TextAutoSizingHash {
 
 class TextAutoSizingValue : public RefCounted<TextAutoSizingValue> {
 public:
-    static PassRefPtr<TextAutoSizingValue> create()
+    static Ref<TextAutoSizingValue> create()
     {
-        return adoptRef(new TextAutoSizingValue);
+        return adoptRef(*new TextAutoSizingValue);
     }
 
     void addNode(Node*, float size);
index 7fa9629..8b1cc88 100644 (file)
@@ -46,19 +46,19 @@ public:
         Image
     };
 
-    static PassRefPtr<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox)
+    static Ref<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox)
     {
-        return adoptRef(new ShapeValue(shape, cssBox));
+        return adoptRef(*new ShapeValue(shape, cssBox));
     }
 
-    static PassRefPtr<ShapeValue> createBoxShapeValue(CSSBoxType boxShape)
+    static Ref<ShapeValue> createBoxShapeValue(CSSBoxType boxShape)
     {
-        return adoptRef(new ShapeValue(boxShape));
+        return adoptRef(*new ShapeValue(boxShape));
     }
 
-    static PassRefPtr<ShapeValue> createImageValue(PassRefPtr<StyleImage> image)
+    static Ref<ShapeValue> createImageValue(PassRefPtr<StyleImage> image)
     {
-        return adoptRef(new ShapeValue(image));
+        return adoptRef(*new ShapeValue(image));
     }
 
     Type type() const { return m_type; }
index e9acd78..54c2b90 100644 (file)
@@ -35,7 +35,7 @@ class CachedImage;
 class StyleCachedImage final : public StyleImage, private CachedImageClient {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<StyleCachedImage> create(CachedImage* image) { return adoptRef(new StyleCachedImage(image)); }
+    static Ref<StyleCachedImage> create(CachedImage* image) { return adoptRef(*new StyleCachedImage(image)); }
     virtual ~StyleCachedImage();
 
     virtual CachedImage* cachedImage() const override { return m_image.get(); }
index 0ec0f80..407e403 100644 (file)
@@ -43,9 +43,9 @@ class CSSImageSetValue;
 class StyleCachedImageSet final : public StyleImage, private CachedImageClient {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<StyleCachedImageSet> create(CachedImage* image, float imageScaleFactor, CSSImageSetValue* value)
+    static Ref<StyleCachedImageSet> create(CachedImage* image, float imageScaleFactor, CSSImageSetValue* value)
     {
-        return adoptRef(new StyleCachedImageSet(image, imageScaleFactor, value));
+        return adoptRef(*new StyleCachedImageSet(image, imageScaleFactor, value));
     }
     virtual ~StyleCachedImageSet();
 
index 975bbf7..6b255f3 100644 (file)
@@ -33,9 +33,9 @@ class CSSImageGeneratorValue;
 
 class StyleGeneratedImage final : public StyleImage {
 public:
-    static PassRefPtr<StyleGeneratedImage> create(Ref<CSSImageGeneratorValue>&& value)
+    static Ref<StyleGeneratedImage> create(Ref<CSSImageGeneratorValue>&& value)
     {
-        return adoptRef(new StyleGeneratedImage(WTF::move(value)));
+        return adoptRef(*new StyleGeneratedImage(WTF::move(value)));
     }
 
     CSSImageGeneratorValue& imageValue() { return m_imageGeneratorValue; }
index b4d1910..c23def4 100644 (file)
@@ -43,7 +43,7 @@ namespace WebCore {
 
 class StylePendingImage final : public StyleImage {
 public:
-    static PassRefPtr<StylePendingImage> create(CSSValue* value) { return adoptRef(new StylePendingImage(value)); }
+    static Ref<StylePendingImage> create(CSSValue* value) { return adoptRef(*new StylePendingImage(value)); }
 
     CSSImageValue* cssImageValue() const { return is<CSSImageValue>(m_value) ? downcast<CSSImageValue>(m_value) : nullptr; }
     CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value && m_value->isImageGeneratorValue() ? static_cast<CSSImageGeneratorValue*>(m_value) : nullptr; }
index 31cdbb5..343913c 100644 (file)
@@ -34,9 +34,9 @@ namespace WebCore {
 
 class StyleReflection : public RefCounted<StyleReflection> {
 public:
-    static PassRefPtr<StyleReflection> create()
+    static Ref<StyleReflection> create()
     {
-        return adoptRef(new StyleReflection);
+        return adoptRef(*new StyleReflection);
     }
 
     bool operator==(const StyleReflection& o) const