More PassRefPtr purging in WebCore.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 10:27:12 +0000 (10:27 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 10:27:12 +0000 (10:27 +0000)
<https://webkit.org/b/163895>

Reviewed by Antti Koivisto.

Source/WebCore:

Remove PassRefPtr usage in RenderStyle, RenderTheme and Scrollbar, then fix up all the fallout.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::contentToCSSValue):
(WebCore::shapePropertyValue):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertQuotes):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::usesMenuList):
(WebCore::HTMLSelectElement::platformHandleKeydownEvent):
(WebCore::HTMLSelectElement::menuListDefaultEventHandler):
* html/InputType.cpp:
(WebCore::InputType::themeSupportsDataListUI):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::shouldHaveSpinButton):
(WebCore::TextFieldInputType::shouldHaveCapsLockIndicator):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::loadPlugin):
* page/FrameView.cpp:
(WebCore::FrameView::createScrollbar):
* page/FrameView.h:
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::RefCountedPropertyWrapper::RefCountedPropertyWrapper):
(WebCore::PropertyWrapperClipPath::PropertyWrapperClipPath):
(WebCore::PropertyWrapperShape::PropertyWrapperShape):
(WebCore::StyleImagePropertyWrapper::StyleImagePropertyWrapper):
(WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper):
(WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper):
* platform/PopupMenuClient.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::createScrollbar):
* platform/ScrollView.h:
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::createNativeScrollbar):
* platform/Scrollbar.h:
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::buildReferenceFilter):
* rendering/FilterEffectRenderer.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::createScrollbar):
(WebCore::RenderLayer::createLocalTransformState):
(WebCore::RenderLayer::hitTestLayerByApplyingTransform):
* rendering/RenderLayer.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::createScrollbar):
* rendering/RenderListBox.h:
* rendering/RenderMenuList.cpp:
(RenderMenuList::createScrollbar):
* rendering/RenderMenuList.h:
* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::createCustomScrollbar):
* rendering/RenderScrollbar.h:
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::createScrollbar):
* rendering/RenderSearchField.h:
* rendering/RenderTheme.h:
(WebCore::RenderTheme::defaultTheme):
* rendering/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::create):
(WebCore::RenderTheme::themeForPage):
* rendering/RenderThemeEfl.h:
* rendering/RenderThemeGtk.cpp:
(WebCore::RenderTheme::themeForPage):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderTheme::themeForPage):
* rendering/RenderThemeMac.mm:
(WebCore::RenderTheme::themeForPage):
* rendering/RenderThemeWin.cpp:
(WebCore::RenderTheme::themeForPage):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::setWidget):
* rendering/RenderWidget.h:
* rendering/style/CursorData.h:
(WebCore::CursorData::CursorData):
(WebCore::CursorData::setImage):
* rendering/style/FillLayer.h:
(WebCore::FillLayer::setImage):
* rendering/style/QuotesData.cpp:
(WebCore::QuotesData::create):
* rendering/style/QuotesData.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::addCursor):
(WebCore::RenderStyle::setCursorList):
(WebCore::RenderStyle::setQuotes):
(WebCore::RenderStyle::setWillChange):
(WebCore::RenderStyle::setContent):
(WebCore::RenderStyle::setListStyleImage):
(WebCore::RenderStyle::setBorderImageSource):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setMaskImage):
(WebCore::RenderStyle::setMaskBoxImageSource):
(WebCore::RenderStyle::setBoxReflect):
(WebCore::RenderStyle::setShapeOutside):
(WebCore::RenderStyle::setClipPath):
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::cssValue):
* rendering/style/StyleCachedImage.h:
* rendering/style/StyleGeneratedImage.cpp:
(WebCore::StyleGeneratedImage::cssValue):
* rendering/style/StyleGeneratedImage.h:
* rendering/style/StyleImage.h:
* rendering/style/StyleMultiColData.h:
* rendering/style/StyleRareInheritedData.h:

Source/WebKit2:

* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.h:
* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
(WebKit::PDFPlugin::createScrollbar):

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

52 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/InputType.cpp
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/loader/SubframeLoader.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/platform/PopupMenuClient.h
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/Scrollbar.cpp
Source/WebCore/platform/Scrollbar.h
Source/WebCore/rendering/FilterEffectRenderer.cpp
Source/WebCore/rendering/FilterEffectRenderer.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderMenuList.h
Source/WebCore/rendering/RenderScrollbar.cpp
Source/WebCore/rendering/RenderScrollbar.h
Source/WebCore/rendering/RenderSearchField.cpp
Source/WebCore/rendering/RenderSearchField.h
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeEfl.cpp
Source/WebCore/rendering/RenderThemeEfl.h
Source/WebCore/rendering/RenderThemeGtk.cpp
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/RenderWidget.h
Source/WebCore/rendering/style/CursorData.h
Source/WebCore/rendering/style/FillLayer.h
Source/WebCore/rendering/style/QuotesData.cpp
Source/WebCore/rendering/style/QuotesData.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleCachedImage.cpp
Source/WebCore/rendering/style/StyleCachedImage.h
Source/WebCore/rendering/style/StyleGeneratedImage.cpp
Source/WebCore/rendering/style/StyleGeneratedImage.h
Source/WebCore/rendering/style/StyleImage.h
Source/WebCore/rendering/style/StyleMultiColData.h
Source/WebCore/rendering/style/StyleRareInheritedData.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.h
Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm

index 80fb00d..8834502 100644 (file)
@@ -1,3 +1,115 @@
+2016-10-25  Andreas Kling  <akling@apple.com>
+
+        More PassRefPtr purging in WebCore.
+        <https://webkit.org/b/163895>
+
+        Reviewed by Antti Koivisto.
+
+        Remove PassRefPtr usage in RenderStyle, RenderTheme and Scrollbar, then fix up all the fallout.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::contentToCSSValue):
+        (WebCore::shapePropertyValue):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertQuotes):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::usesMenuList):
+        (WebCore::HTMLSelectElement::platformHandleKeydownEvent):
+        (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
+        * html/InputType.cpp:
+        (WebCore::InputType::themeSupportsDataListUI):
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::shouldHaveSpinButton):
+        (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator):
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::loadPlugin):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::createScrollbar):
+        * page/FrameView.h:
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::RefCountedPropertyWrapper::RefCountedPropertyWrapper):
+        (WebCore::PropertyWrapperClipPath::PropertyWrapperClipPath):
+        (WebCore::PropertyWrapperShape::PropertyWrapperShape):
+        (WebCore::StyleImagePropertyWrapper::StyleImagePropertyWrapper):
+        (WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper):
+        (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper):
+        * platform/PopupMenuClient.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::createScrollbar):
+        * platform/ScrollView.h:
+        * platform/Scrollbar.cpp:
+        (WebCore::Scrollbar::createNativeScrollbar):
+        * platform/Scrollbar.h:
+        * rendering/FilterEffectRenderer.cpp:
+        (WebCore::FilterEffectRenderer::buildReferenceFilter):
+        * rendering/FilterEffectRenderer.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::createScrollbar):
+        (WebCore::RenderLayer::createLocalTransformState):
+        (WebCore::RenderLayer::hitTestLayerByApplyingTransform):
+        * rendering/RenderLayer.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::createScrollbar):
+        * rendering/RenderListBox.h:
+        * rendering/RenderMenuList.cpp:
+        (RenderMenuList::createScrollbar):
+        * rendering/RenderMenuList.h:
+        * rendering/RenderScrollbar.cpp:
+        (WebCore::RenderScrollbar::createCustomScrollbar):
+        * rendering/RenderScrollbar.h:
+        * rendering/RenderSearchField.cpp:
+        (WebCore::RenderSearchField::createScrollbar):
+        * rendering/RenderSearchField.h:
+        * rendering/RenderTheme.h:
+        (WebCore::RenderTheme::defaultTheme):
+        * rendering/RenderThemeEfl.cpp:
+        (WebCore::RenderThemeEfl::create):
+        (WebCore::RenderTheme::themeForPage):
+        * rendering/RenderThemeEfl.h:
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::RenderTheme::themeForPage):
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderTheme::themeForPage):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderTheme::themeForPage):
+        * rendering/RenderThemeWin.cpp:
+        (WebCore::RenderTheme::themeForPage):
+        * rendering/RenderWidget.cpp:
+        (WebCore::RenderWidget::setWidget):
+        * rendering/RenderWidget.h:
+        * rendering/style/CursorData.h:
+        (WebCore::CursorData::CursorData):
+        (WebCore::CursorData::setImage):
+        * rendering/style/FillLayer.h:
+        (WebCore::FillLayer::setImage):
+        * rendering/style/QuotesData.cpp:
+        (WebCore::QuotesData::create):
+        * rendering/style/QuotesData.h:
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::addCursor):
+        (WebCore::RenderStyle::setCursorList):
+        (WebCore::RenderStyle::setQuotes):
+        (WebCore::RenderStyle::setWillChange):
+        (WebCore::RenderStyle::setContent):
+        (WebCore::RenderStyle::setListStyleImage):
+        (WebCore::RenderStyle::setBorderImageSource):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setMaskImage):
+        (WebCore::RenderStyle::setMaskBoxImageSource):
+        (WebCore::RenderStyle::setBoxReflect):
+        (WebCore::RenderStyle::setShapeOutside):
+        (WebCore::RenderStyle::setClipPath):
+        * rendering/style/StyleCachedImage.cpp:
+        (WebCore::StyleCachedImage::cssValue):
+        * rendering/style/StyleCachedImage.h:
+        * rendering/style/StyleGeneratedImage.cpp:
+        (WebCore::StyleGeneratedImage::cssValue):
+        * rendering/style/StyleGeneratedImage.h:
+        * rendering/style/StyleImage.h:
+        * rendering/style/StyleMultiColData.h:
+        * rendering/style/StyleRareInheritedData.h:
+
 2016-10-24  Ryosuke Niwa  <rniwa@webkit.org>
 
         Custom elements reactions should have a queue per element
index 47d37c0..c24ea5b 100644 (file)
@@ -1861,7 +1861,7 @@ static Ref<CSSValueList> contentToCSSValue(const RenderStyle* style)
         if (is<CounterContentData>(*contentData))
             list.get().append(cssValuePool.createValue(downcast<CounterContentData>(*contentData).counter().identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
         else if (is<ImageContentData>(*contentData))
-            list.get().append(*downcast<ImageContentData>(*contentData).image().cssValue());
+            list.get().append(downcast<ImageContentData>(*contentData).image().cssValue());
         else if (is<TextContentData>(*contentData))
             list.get().append(cssValuePool.createValue(downcast<TextContentData>(*contentData).text(), CSSPrimitiveValue::CSS_STRING));
     }
@@ -2437,7 +2437,7 @@ static Ref<CSSValue> shapePropertyValue(const RenderStyle& style, const ShapeVal
 
     if (shapeValue->type() == ShapeValue::Type::Image) {
         if (shapeValue->image())
-            return *shapeValue->image()->cssValue();
+            return shapeValue->image()->cssValue();
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
     }
 
@@ -2584,7 +2584,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
                 if (currLayer->image())
-                    list->append(*currLayer->image()->cssValue());
+                    list->append(currLayer->image()->cssValue());
                 else
                     list->append(cssValuePool.createIdentifierValue(CSSValueNone));
             }
@@ -2837,7 +2837,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 list = CSSValueList::createCommaSeparated();
                 for (unsigned i = 0; i < cursors->size(); ++i)
                     if (StyleImage* image = cursors->at(i).image())
-                        list->append(*image->cssValue());
+                        list->append(image->cssValue());
             }
             auto value = cssValuePool.createValue(style->cursor());
             if (list) {
index 0727ee1..a2e021e 100644 (file)
@@ -86,7 +86,7 @@ public:
     static EResize convertResize(StyleResolver&, CSSValue&);
     static int convertMarqueeRepetition(StyleResolver&, CSSValue&);
     static int convertMarqueeSpeed(StyleResolver&, CSSValue&);
-    static PassRefPtr<QuotesData> convertQuotes(StyleResolver&, CSSValue&);
+    static Ref<QuotesData> convertQuotes(StyleResolver&, CSSValue&);
     static TextUnderlinePosition convertTextUnderlinePosition(StyleResolver&, CSSValue&);
     static RefPtr<StyleReflection> convertReflection(StyleResolver&, CSSValue&);
     static IntSize convertInitialLetter(StyleResolver&, CSSValue&);
@@ -585,7 +585,7 @@ inline int StyleBuilderConverter::convertMarqueeSpeed(StyleResolver&, CSSValue&
     return speed;
 }
 
-inline PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolver&, CSSValue& value)
+inline Ref<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolver&, CSSValue& value)
 {
     if (is<CSSPrimitiveValue>(value)) {
         ASSERT(downcast<CSSPrimitiveValue>(value).valueID() == CSSValueNone);
index 75ed1fd..4cab9e5 100644 (file)
@@ -196,9 +196,7 @@ void HTMLSelectElement::listBoxSelectItem(int listIndex, bool allowMultiplySelec
 bool HTMLSelectElement::usesMenuList() const
 {
 #if !PLATFORM(IOS)
-    const Page* page = document().page();
-    RefPtr<RenderTheme> renderTheme = page ? &page->theme() : RenderTheme::defaultTheme();
-    if (renderTheme->delegatesMenuListRendering())
+    if (RenderTheme::themeForPage(document().page())->delegatesMenuListRendering())
         return true;
 
     return !m_multiple && m_size <= 1;
@@ -1092,10 +1090,7 @@ void HTMLSelectElement::reset()
 
 bool HTMLSelectElement::platformHandleKeydownEvent(KeyboardEvent* event)
 {
-    const Page* page = document().page();
-    RefPtr<RenderTheme> renderTheme = page ? &page->theme() : RenderTheme::defaultTheme();
-
-    if (!renderTheme->popsMenuByArrowKeys())
+    if (!RenderTheme::themeForPage(document().page())->popsMenuByArrowKeys())
         return false;
 
     if (!isSpatialNavigationEnabled(document().frame())) {
@@ -1129,8 +1124,7 @@ void HTMLSelectElement::menuListDefaultEventHandler(Event& event)
     ASSERT(renderer());
     ASSERT(renderer()->isMenuList());
 
-    const Page* page = document().page();
-    RefPtr<RenderTheme> renderTheme = page ? &page->theme() : RenderTheme::defaultTheme();
+    RefPtr<RenderTheme> renderTheme = RenderTheme::themeForPage(document().page());
 
     if (event.type() == eventNames().keydownEvent) {
         if (!is<KeyboardEvent>(event))
index 583ad38..a730504 100644 (file)
@@ -173,8 +173,7 @@ InputType::~InputType()
 bool InputType::themeSupportsDataListUI(InputType* type)
 {
     Document& document = type->element().document();
-    RefPtr<RenderTheme> theme = document.page() ? &document.page()->theme() : RenderTheme::defaultTheme();
-    return theme->supportsDataListUI(type->formControlType());
+    return RenderTheme::themeForPage(document.page())->supportsDataListUI(type->formControlType());
 }
 
 bool InputType::isTextField() const
index 016f3e8..664cf2d 100644 (file)
@@ -244,16 +244,12 @@ bool TextFieldInputType::needsContainer() const
 
 bool TextFieldInputType::shouldHaveSpinButton() const
 {
-    Document& document = element().document();
-    RefPtr<RenderTheme> theme = document.page() ? &document.page()->theme() : RenderTheme::defaultTheme();
-    return theme->shouldHaveSpinButton(element());
+    return RenderTheme::themeForPage(element().document().page())->shouldHaveSpinButton(element());
 }
 
 bool TextFieldInputType::shouldHaveCapsLockIndicator() const
 {
-    Document& document = element().document();
-    RefPtr<RenderTheme> theme = document.page() ? &document.page()->theme() : RenderTheme::defaultTheme();
-    return theme->shouldHaveCapsLockIndicator(element());
+    return RenderTheme::themeForPage(element().document().page())->shouldHaveCapsLockIndicator(element());
 }
 
 void TextFieldInputType::createShadowSubtree()
index c086080..8c11c9f 100644 (file)
@@ -421,7 +421,7 @@ bool SubframeLoader::loadPlugin(HTMLPlugInImageElement& pluginElement, const URL
     }
 
     pluginElement.subframeLoaderDidCreatePlugIn(*widget);
-    renderer->setWidget(widget);
+    renderer->setWidget(WTFMove(widget));
     m_containsPlugins = true;
     return true;
 }
index 96cd11c..d1fb9be 100644 (file)
@@ -609,7 +609,7 @@ void FrameView::updateCanHaveScrollbars()
         setCanHaveScrollbars(true);
 }
 
-PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
+Ref<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
 {
     if (!frame().settings().allowCustomScrollbarInMainFrame() && frame().isMainFrame())
         return ScrollView::createScrollbar(orientation);
index 1561655..958b282 100644 (file)
@@ -98,7 +98,7 @@ public:
     WEBCORE_EXPORT void setCanHaveScrollbars(bool) override;
     WEBCORE_EXPORT void updateCanHaveScrollbars();
 
-    PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation) override;
+    Ref<Scrollbar> createScrollbar(ScrollbarOrientation) override;
 
     bool avoidScrollbarCreation() const override;
 
index 1aa7624..7e1d834 100644 (file)
@@ -474,7 +474,7 @@ template <typename T>
 class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<T>))
+    RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<T>&&))
         : PropertyWrapperGetter<T*>(prop, getter)
         , m_setter(setter)
     {
@@ -486,7 +486,7 @@ public:
     }
 
 protected:
-    void (RenderStyle::*m_setter)(PassRefPtr<T>);
+    void (RenderStyle::*m_setter)(RefPtr<T>&&);
 };
 
 template <typename T>
@@ -511,7 +511,7 @@ protected:
 class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperation> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PropertyWrapperClipPath(CSSPropertyID prop, ClipPathOperation* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ClipPathOperation>))
+    PropertyWrapperClipPath(CSSPropertyID prop, ClipPathOperation* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<ClipPathOperation>&&))
         : RefCountedPropertyWrapper<ClipPathOperation>(prop, getter, setter)
     {
     }
@@ -563,7 +563,7 @@ public:
 class PropertyWrapperShape : public RefCountedPropertyWrapper<ShapeValue> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PropertyWrapperShape(CSSPropertyID prop, ShapeValue* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ShapeValue>))
+    PropertyWrapperShape(CSSPropertyID prop, ShapeValue* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<ShapeValue>&&))
         : RefCountedPropertyWrapper<ShapeValue>(prop, getter, setter)
     {
     }
@@ -590,7 +590,7 @@ public:
 class StyleImagePropertyWrapper : public RefCountedPropertyWrapper<StyleImage> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<StyleImage>))
+    StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<StyleImage>&&))
         : RefCountedPropertyWrapper<StyleImage>(prop, getter, setter)
     {
     }
@@ -1014,7 +1014,7 @@ template <typename T>
 class FillLayerRefCountedPropertyWrapper : public FillLayerPropertyWrapperGetter<T*> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    FillLayerRefCountedPropertyWrapper(T* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<T>))
+    FillLayerRefCountedPropertyWrapper(T* (FillLayer::*getter)() const, void (FillLayer::*setter)(RefPtr<T>&&))
         : FillLayerPropertyWrapperGetter<T*>(getter)
         , m_setter(setter)
     {
@@ -1026,13 +1026,13 @@ public:
     }
 
 protected:
-    void (FillLayer::*m_setter)(PassRefPtr<T>);
+    void (FillLayer::*m_setter)(RefPtr<T>&&);
 };
 
 class FillLayerStyleImagePropertyWrapper : public FillLayerRefCountedPropertyWrapper<StyleImage> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<StyleImage>))
+    FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(RefPtr<StyleImage>&&))
         : FillLayerRefCountedPropertyWrapper<StyleImage>(getter, setter)
     {
     }
index 1eb48ff..84aebb6 100644 (file)
@@ -74,7 +74,7 @@ public:
     virtual FontSelector* fontSelector() const = 0;
     virtual HostWindow* hostWindow() const = 0;
 
-    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) = 0;
+    virtual Ref<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) = 0;
 };
 
 }
index c1ab2ce..83104e3 100644 (file)
@@ -118,7 +118,7 @@ bool ScrollView::setHasScrollbarInternal(RefPtr<Scrollbar>& scrollbar, Scrollbar
     return false;
 }
 
-PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientation)
+Ref<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientation)
 {
     return Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
 }
index 5be773f..e26504f 100644 (file)
@@ -140,7 +140,7 @@ public:
     WEBCORE_EXPORT void setDelegatesScrolling(bool);
 
     // Overridden by FrameView to create custom CSS scrollbars if applicable.
-    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
+    virtual Ref<Scrollbar> createScrollbar(ScrollbarOrientation);
 
     void styleDidChange();
 
index 81854fe..88181d3 100644 (file)
@@ -43,9 +43,9 @@
 
 namespace WebCore {
 
-PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
+Ref<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
 {
-    return adoptRef(new Scrollbar(scrollableArea, orientation, size));
+    return adoptRef(*new Scrollbar(scrollableArea, orientation, size));
 }
 
 int Scrollbar::maxOverlapBetweenPages()
index 1b84112..f86a962 100644 (file)
@@ -29,7 +29,6 @@
 #include "ScrollTypes.h"
 #include "Timer.h"
 #include "Widget.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/WeakPtr.h>
 
 namespace WebCore {
@@ -43,7 +42,7 @@ class ScrollbarTheme;
 class Scrollbar : public Widget {
 public:
     // Must be implemented by platforms that can't simply use the Scrollbar base class.  Right now the only platform that is not using the base class is GTK.
-    WEBCORE_EXPORT static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize);
+    WEBCORE_EXPORT static Ref<Scrollbar> createNativeScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize);
 
     virtual ~Scrollbar();
 
index 8c67554..c0ad66e 100644 (file)
@@ -85,7 +85,7 @@ GraphicsContext* FilterEffectRenderer::inputContext()
     return sourceImage() ? &sourceImage()->context() : nullptr;
 }
 
-PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderElement* renderer, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* filterOperation)
+RefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderElement* renderer, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* filterOperation)
 {
     if (!renderer)
         return nullptr;
index 2ed8870..2a96fc3 100644 (file)
@@ -36,7 +36,6 @@
 #include "LayoutRect.h"
 #include "SVGFilterBuilder.h"
 #include "SourceGraphic.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
@@ -108,7 +107,7 @@ public:
     ImageBuffer* output() const { return lastEffect()->asImageBuffer(); }
 
     bool build(RenderElement*, const FilterOperations&, FilterConsumer);
-    PassRefPtr<FilterEffect> buildReferenceFilter(RenderElement*, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation*);
+    RefPtr<FilterEffect> buildReferenceFilter(RenderElement*, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation*);
     bool updateBackingStoreRect(const FloatRect& filterRect);
     void allocateBackingStoreIfNeeded(const GraphicsContext&);
     void clearIntermediateResults();
index 13b8c93..2c077a9 100644 (file)
@@ -3105,7 +3105,7 @@ static inline RenderElement* rendererForScrollbar(RenderLayerModelObject& render
     return &renderer;
 }
 
-PassRefPtr<Scrollbar> RenderLayer::createScrollbar(ScrollbarOrientation orientation)
+Ref<Scrollbar> RenderLayer::createScrollbar(ScrollbarOrientation orientation)
 {
     RefPtr<Scrollbar> widget;
     RenderElement* actualRenderer = rendererForScrollbar(renderer());
@@ -3121,7 +3121,7 @@ PassRefPtr<Scrollbar> RenderLayer::createScrollbar(ScrollbarOrientation orientat
         }
     }
     renderer().view().frameView().addChild(widget.get());
-    return WTFMove(widget);
+    return widget.releaseNonNull();
 }
 
 void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation)
@@ -4926,7 +4926,7 @@ static double computeZOffset(const HitTestingTransformState& transformState)
     return backmappedPoint.z();
 }
 
-PassRefPtr<HitTestingTransformState> RenderLayer::createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
+Ref<HitTestingTransformState> RenderLayer::createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
                                         const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation,
                                         const HitTestingTransformState* containerTransformState,
                                         const LayoutSize& translationOffset) const
@@ -4954,7 +4954,7 @@ PassRefPtr<HitTestingTransformState> RenderLayer::createLocalTransformState(Rend
         transformState->translate(offset.width(), offset.height(), HitTestingTransformState::AccumulateTransform);
     }
     
-    return transformState;
+    return transformState.releaseNonNull();
 }
 
 
@@ -5308,7 +5308,7 @@ RenderLayer* RenderLayer::hitTestLayerByApplyingTransform(RenderLayer* rootLayer
     const LayoutSize& translationOffset)
 {
     // Create a transform state to accumulate this transform.
-    RefPtr<HitTestingTransformState> newTransformState = createLocalTransformState(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState, translationOffset);
+    Ref<HitTestingTransformState> newTransformState = createLocalTransformState(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState, translationOffset);
 
     // If the transform can't be inverted, then don't hit test this layer at all.
     if (!newTransformState->m_accumulatedTransform.isInvertible())
@@ -5330,7 +5330,7 @@ RenderLayer* RenderLayer::hitTestLayerByApplyingTransform(RenderLayer* rootLayer
         newHitTestLocation = HitTestLocation(localPoint);
 
     // Now do a hit test with the root layer shifted to be us.
-    return hitTestLayer(this, containerLayer, request, result, localHitTestRect, newHitTestLocation, true, newTransformState.get(), zOffset);
+    return hitTestLayer(this, containerLayer, request, result, localHitTestRect, newHitTestLocation, true, newTransformState.ptr(), zOffset);
 }
 
 bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& result, const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation, HitTestFilter hitTestFilter) const
index a951fba..5087d6b 100644 (file)
@@ -213,7 +213,7 @@ public:
     void setHasHorizontalScrollbar(bool);
     void setHasVerticalScrollbar(bool);
 
-    PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
+    Ref<Scrollbar> createScrollbar(ScrollbarOrientation);
     void destroyScrollbar(ScrollbarOrientation);
 
     bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
@@ -830,7 +830,7 @@ private:
         const HitTestingTransformState* unflattenedTransformState,
         bool depthSortDescendants);
 
-    PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
+    Ref<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
         const LayoutRect& hitTestRect, const HitTestLocation&,
         const HitTestingTransformState* containerTransformState,
         const LayoutSize& translationOffset = LayoutSize()) const;
index 5daa6f9..b7163e6 100644 (file)
@@ -896,7 +896,7 @@ void RenderListBox::logMockScrollAnimatorMessage(const String& message) const
     document().addConsoleMessage(MessageSource::Other, MessageLevel::Debug, "RenderListBox: " + message);
 }
 
-PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
+Ref<Scrollbar> RenderListBox::createScrollbar()
 {
     RefPtr<Scrollbar> widget;
     bool hasCustomScrollbarStyle = style().hasPseudoStyle(SCROLLBAR);
@@ -911,7 +911,7 @@ PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
         }
     }
     view().frameView().addChild(widget.get());
-    return WTFMove(widget);
+    return widget.releaseNonNull();
 }
 
 void RenderListBox::destroyScrollbar()
index b03ff32..5ef3ed3 100644 (file)
@@ -147,7 +147,7 @@ private:
     void paintItem(PaintInfo&, const LayoutPoint&, PaintFunction);
 
     void setHasVerticalScrollbar(bool hasScrollbar);
-    PassRefPtr<Scrollbar> createScrollbar();
+    Ref<Scrollbar> createScrollbar();
     void destroyScrollbar();
     
     int maximumNumberOfItemsThatFitInPaddingBottomArea() const;
index 89caec4..30cb51d 100644 (file)
@@ -570,15 +570,12 @@ HostWindow* RenderMenuList::hostWindow() const
     return view().frameView().hostWindow();
 }
 
-PassRefPtr<Scrollbar> RenderMenuList::createScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
+Ref<Scrollbar> RenderMenuList::createScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
 {
-    RefPtr<Scrollbar> widget;
     bool hasCustomScrollbarStyle = style().hasPseudoStyle(SCROLLBAR);
     if (hasCustomScrollbarStyle)
-        widget = RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, &selectElement());
-    else
-        widget = Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize);
-    return WTFMove(widget);
+        return RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, &selectElement());
+    return Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize);
 }
 
 int RenderMenuList::clientInsetLeft() const
index 3cacf74..faac555 100644 (file)
@@ -113,7 +113,7 @@ private:
     bool multiple() const override;
     FontSelector* fontSelector() const override;
     HostWindow* hostWindow() const override;
-    PassRefPtr<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) override;
+    Ref<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) override;
 
     bool hasLineIfEmpty() const override { return true; }
 
index f5108d4..c52a4ce 100644 (file)
@@ -36,9 +36,9 @@
 
 namespace WebCore {
 
-RefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
+Ref<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
 {
-    return adoptRef(new RenderScrollbar(scrollableArea, orientation, ownerElement, owningFrame));
+    return adoptRef(*new RenderScrollbar(scrollableArea, orientation, ownerElement, owningFrame));
 }
 
 RenderScrollbar::RenderScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
index d1410bb..77bed6a 100644 (file)
@@ -42,7 +42,7 @@ class RenderStyle;
 class RenderScrollbar final : public Scrollbar {
 public:
     friend class Scrollbar;
-    static RefPtr<Scrollbar> createCustomScrollbar(ScrollableArea&, ScrollbarOrientation, Element*, Frame* owningFrame = nullptr);
+    static Ref<Scrollbar> createCustomScrollbar(ScrollableArea&, ScrollbarOrientation, Element*, Frame* owningFrame = nullptr);
     virtual ~RenderScrollbar();
 
     RenderBox* owningRenderer() const;
index 497f252..5be3722 100644 (file)
@@ -346,15 +346,12 @@ HostWindow* RenderSearchField::hostWindow() const
     return view().frameView().hostWindow();
 }
 
-PassRefPtr<Scrollbar> RenderSearchField::createScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
+Ref<Scrollbar> RenderSearchField::createScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
 {
-    RefPtr<Scrollbar> widget;
     bool hasCustomScrollbarStyle = style().hasPseudoStyle(SCROLLBAR);
     if (hasCustomScrollbarStyle)
-        widget = RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, &inputElement());
-    else
-        widget = Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize);
-    return WTFMove(widget);
+        return RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, &inputElement());
+    return Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize);
 }
 
 LayoutUnit RenderSearchField::computeLogicalHeightLimit() const
index d229819..31ca396 100644 (file)
@@ -80,7 +80,7 @@ private:
     void setTextFromItem(unsigned listIndex) override;
     FontSelector* fontSelector() const override;
     HostWindow* hostWindow() const override;
-    PassRefPtr<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) override;
+    Ref<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) override;
 
     HTMLElement* resultsButtonElement() const;
     HTMLElement* cancelButtonElement() const;
index 7c6f544..25886a5 100644 (file)
@@ -34,7 +34,7 @@
 #include "PaintInfo.h"
 #include "PopupMenuStyle.h"
 #include "ScrollTypes.h"
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
@@ -67,12 +67,12 @@ public:
     // This function is to be implemented in your platform-specific theme implementation to hand back the
     // appropriate platform theme. When the theme is needed in non-page dependent code, a default theme is
     // used as fallback, which is returned for a nulled page, so the platform code needs to account for this.
-    static PassRefPtr<RenderTheme> themeForPage(Page* page);
+    static Ref<RenderTheme> themeForPage(Page*);
 
     // When the theme is needed in non-page dependent code, the defaultTheme() is used as fallback.
-    static inline PassRefPtr<RenderTheme> defaultTheme()
+    static inline Ref<RenderTheme> defaultTheme()
     {
-        return themeForPage(0);
+        return themeForPage(nullptr);
     };
 
     // This method is called whenever style has been computed for an element and the appearance
index ad066b2..d986ca8 100644 (file)
@@ -410,17 +410,17 @@ bool RenderThemeEfl::paintThemePart(const GraphicsContext& context, FormType typ
     return false;
 }
 
-PassRefPtr<RenderTheme> RenderThemeEfl::create(Page* page)
+Ref<RenderTheme> RenderThemeEfl::create(Page* page)
 {
-    return adoptRef(new RenderThemeEfl(page));
+    return adoptRef(*new RenderThemeEfl(page));
 }
 
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
+Ref<RenderTheme> RenderTheme::themeForPage(Page* page)
 {
     if (page)
         return RenderThemeEfl::create(page);
 
-    static RenderTheme* fallback = RenderThemeEfl::create(0).leakRef();
+    static RenderTheme& fallback = RenderThemeEfl::create(0).leakRef();
     return fallback;
 }
 
index 093087c..e94d884 100644 (file)
@@ -67,7 +67,7 @@ private:
     virtual ~RenderThemeEfl();
 
 public:
-    static PassRefPtr<RenderTheme> create(Page*);
+    static Ref<RenderTheme> create(Page*);
 
     // A method asking if the theme's controls actually care about redrawing when hovered.
     bool supportsHover(const RenderStyle&) const override { return true; }
index f1f019d..4b86a32 100644 (file)
@@ -67,10 +67,10 @@ Ref<RenderTheme> RenderThemeGtk::create()
     return adoptRef(*new RenderThemeGtk());
 }
 
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*)
+Ref<RenderTheme> RenderTheme::themeForPage(Page*)
 {
     static RenderTheme& rt = RenderThemeGtk::create().leakRef();
-    return &rt;
+    return rt;
 }
 
 static double getScreenDPI()
index 8a394ad..f140810 100644 (file)
@@ -294,10 +294,10 @@ RenderThemeIOS::RenderThemeIOS()
     CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, contentSizeCategoryDidChange, UIContentSizeCategoryDidChangeNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
 }
 
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*)
+Ref<RenderTheme> RenderTheme::themeForPage(Page*)
 {
     static RenderTheme& renderTheme = RenderThemeIOS::create().leakRef();
-    return &renderTheme;
+    return renderTheme;
 }
 
 Ref<RenderTheme> RenderThemeIOS::create()
index 107e835..51a4481 100644 (file)
@@ -197,10 +197,10 @@ enum {
     leftPadding
 };
 
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*)
+Ref<RenderTheme> RenderTheme::themeForPage(Page*)
 {
     static RenderTheme& rt = RenderThemeMac::create().leakRef();
-    return &rt;
+    return rt;
 }
 
 Ref<RenderTheme> RenderThemeMac::create()
index 6237a33..2eeeea6 100644 (file)
@@ -188,10 +188,10 @@ Ref<RenderTheme> RenderThemeWin::create()
     return adoptRef(*new RenderThemeWin);
 }
 
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
+Ref<RenderTheme> RenderTheme::themeForPage(Page* page)
 {
     static RenderTheme& winTheme = RenderThemeWin::create().leakRef();
-    return &winTheme;
+    return winTheme;
 }
 
 RenderThemeWin::RenderThemeWin()
index 368319a..37395e4 100644 (file)
@@ -161,7 +161,7 @@ bool RenderWidget::updateWidgetGeometry()
     return setWidgetGeometry(absoluteContentBox);
 }
 
-void RenderWidget::setWidget(PassRefPtr<Widget> widget)
+void RenderWidget::setWidget(RefPtr<Widget>&& widget)
 {
     if (widget == m_widget)
         return;
index e40d34a..e830014 100644 (file)
@@ -63,7 +63,7 @@ public:
     HTMLFrameOwnerElement& frameOwnerElement() const { return downcast<HTMLFrameOwnerElement>(nodeForNonAnonymous()); }
 
     Widget* widget() const { return m_widget.get(); }
-    WEBCORE_EXPORT void setWidget(PassRefPtr<Widget>);
+    WEBCORE_EXPORT void setWidget(RefPtr<Widget>&&);
 
     static RenderWidget* find(const Widget*);
 
index f8f779a..f26376d 100644 (file)
@@ -32,8 +32,8 @@ namespace WebCore {
 
 class CursorData {
 public:
-    CursorData(PassRefPtr<StyleImage> image, const IntPoint& hotSpot)
-        : m_image(image)
+    CursorData(RefPtr<StyleImage>&& image, const IntPoint& hotSpot)
+        : m_image(WTFMove(image))
         , m_hotSpot(hotSpot)
     {
     }
@@ -49,7 +49,7 @@ public:
     }
 
     StyleImage* image() const { return m_image.get(); }    
-    void setImage(PassRefPtr<StyleImage> image) { m_image = image; }    
+    void setImage(RefPtr<StyleImage>&& image) { m_image = WTFMove(image); }
 
     // Hot spot in the image in logical pixels.
     const IntPoint& hotSpot() const { return m_hotSpot; }
index 2358b4d..6864340 100644 (file)
@@ -101,7 +101,7 @@ public:
     bool isSizeSet() const { return m_sizeType != SizeNone; }
     bool isMaskSourceTypeSet() const { return m_maskSourceTypeSet; }
 
-    void setImage(PassRefPtr<StyleImage> image) { m_image = image; m_imageSet = true; }
+    void setImage(RefPtr<StyleImage>&& image) { m_image = WTFMove(image); m_imageSet = true; }
     void setXPosition(Length length) { m_xPosition = WTFMove(length); m_xPosSet = true; }
     void setYPosition(Length length) { m_yPosition = WTFMove(length); m_yPosSet = true; }
     void setBackgroundXOrigin(Edge o) { m_backgroundXOrigin = static_cast<unsigned>(o); m_backgroundOriginSet = true; }
index 43b0df2..2c1aceb 100644 (file)
@@ -29,10 +29,10 @@ static size_t sizeForQuotesDataWithQuoteCount(unsigned count)
     return sizeof(QuotesData) + sizeof(std::pair<String, String>) * count;
 }
 
-PassRefPtr<QuotesData> QuotesData::create(const Vector<std::pair<String, String>>& quotes)
+Ref<QuotesData> QuotesData::create(const Vector<std::pair<String, String>>& quotes)
 {
     void* slot = fastMalloc(sizeForQuotesDataWithQuoteCount(quotes.size()));
-    return adoptRef(new (NotNull, slot) QuotesData(quotes));
+    return adoptRef(*new (NotNull, slot) QuotesData(quotes));
 }
 
 QuotesData::QuotesData(const Vector<std::pair<String, String>>& quotes)
index 07e9253..912be33 100644 (file)
@@ -22,7 +22,6 @@
 #ifndef QuotesData_h
 #define QuotesData_h
 
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
@@ -36,7 +35,7 @@ namespace WebCore {
 
 class QuotesData : public RefCounted<QuotesData> {
 public:
-    static PassRefPtr<QuotesData> create(const Vector<std::pair<String, String>>& quotes);
+    static Ref<QuotesData> create(const Vector<std::pair<String, String>>& quotes);
     ~QuotesData();
 
     friend bool operator==(const QuotesData&, const QuotesData&);
index 5dd9b91..4e32402 100644 (file)
@@ -945,27 +945,27 @@ void RenderStyle::setClip(Length top, Length right, Length bottom, Length left)
     data->clip.left() = left;
 }
 
-void RenderStyle::addCursor(PassRefPtr<StyleImage> image, const IntPoint& hotSpot)
+void RenderStyle::addCursor(RefPtr<StyleImage>&& image, const IntPoint& hotSpot)
 {
     if (!rareInheritedData.access()->cursorData)
         rareInheritedData.access()->cursorData = CursorList::create();
-    rareInheritedData.access()->cursorData->append(CursorData(image, hotSpot));
+    rareInheritedData.access()->cursorData->append(CursorData(WTFMove(image), hotSpot));
 }
 
-void RenderStyle::setCursorList(PassRefPtr<CursorList> other)
+void RenderStyle::setCursorList(RefPtr<CursorList>&& list)
 {
-    rareInheritedData.access()->cursorData = other;
+    rareInheritedData.access()->cursorData = WTFMove(list);
 }
 
-void RenderStyle::setQuotes(PassRefPtr<QuotesData> q)
+void RenderStyle::setQuotes(RefPtr<QuotesData>&& q)
 {
     if (rareInheritedData->quotes == q || (rareInheritedData->quotes && q && *rareInheritedData->quotes == *q))
         return;
 
-    rareInheritedData.access()->quotes = q;
+    rareInheritedData.access()->quotes = WTFMove(q);
 }
 
-void RenderStyle::setWillChange(PassRefPtr<WillChangeData> willChangeData)
+void RenderStyle::setWillChange(RefPtr<WillChangeData>&& willChangeData)
 {
     if (arePointingToEqualData(rareNonInheritedData->m_willChange.get(), willChangeData.get()))
         return;
@@ -998,7 +998,7 @@ void RenderStyle::appendContent(std::unique_ptr<ContentData> contentData)
         content = WTFMove(contentData);
 }
 
-void RenderStyle::setContent(PassRefPtr<StyleImage> image, bool add)
+void RenderStyle::setContent(RefPtr<StyleImage>&& image, bool add)
 {
     if (!image)
         return;
@@ -1008,7 +1008,7 @@ void RenderStyle::setContent(PassRefPtr<StyleImage> image, bool add)
         return;
     }
 
-    rareNonInheritedData.access()->m_content = std::make_unique<ImageContentData>(image);
+    rareNonInheritedData.access()->m_content = std::make_unique<ImageContentData>(WTFMove(image));
     if (!rareNonInheritedData.access()->m_altText.isNull())
         rareNonInheritedData.access()->m_content->setAltText(rareNonInheritedData.access()->m_altText);
 }
@@ -1179,10 +1179,10 @@ static RoundedRect::Radii calcRadiiFor(const BorderData& border, const LayoutSiz
 }
 
 StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->listStyleImage.get(); }
-void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v)
+void RenderStyle::setListStyleImage(RefPtr<StyleImage>&& v)
 {
     if (rareInheritedData->listStyleImage != v)
-        rareInheritedData.access()->listStyleImage = v;
+        rareInheritedData.access()->listStyleImage = WTFMove(v);
 }
 
 const Color& RenderStyle::color() const
@@ -1879,11 +1879,11 @@ std::pair<FontOrientation, NonCJKGlyphOrientation> RenderStyle::fontAndGlyphOrie
     }
 }
 
-void RenderStyle::setBorderImageSource(PassRefPtr<StyleImage> image)
+void RenderStyle::setBorderImageSource(RefPtr<StyleImage>&& image)
 {
     if (surround->border.m_image.image() == image.get())
         return;
-    surround.access()->border.m_image.setImage(image);
+    surround.access()->border.m_image.setImage(WTFMove(image));
 }
 
 void RenderStyle::setBorderImageSlices(LengthBox slices)
index 7dd087a..dd44b16 100644 (file)
@@ -1303,7 +1303,7 @@ public:
     void setBackgroundSizeLength(LengthSize size) { SET_VAR(m_background, m_background.m_sizeLength, WTFMove(size)); }
     
     void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b); }
-    void setBorderImageSource(PassRefPtr<StyleImage>);
+    void setBorderImageSource(RefPtr<StyleImage>&&);
     void setBorderImageSlices(LengthBox);
     void setBorderImageWidth(LengthBox);
     void setBorderImageOutset(LengthBox);
@@ -1443,10 +1443,10 @@ public:
         }
     }
 
-    void setMaskImage(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_mask.setImage(v); }
+    void setMaskImage(RefPtr<StyleImage>&& v) { rareNonInheritedData.access()->m_mask.setImage(WTFMove(v)); }
 
     void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); }
-    void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
+    void setMaskBoxImageSource(RefPtr<StyleImage>&& v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(WTFMove(v)); }
     void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, WTFMove(length)); }
     void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, WTFMove(length)); }
     void setMaskSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, WTFMove(size)); }
@@ -1462,7 +1462,7 @@ public:
     void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); }
 
     void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
-    void setListStyleImage(PassRefPtr<StyleImage>);
+    void setListStyleImage(RefPtr<StyleImage>&&);
     void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
 
     void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)); }
@@ -1481,8 +1481,8 @@ public:
     void setPaddingRight(Length length) { SET_VAR(surround, padding.right(), WTFMove(length)); }
 
     void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
-    void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
-    void setCursorList(PassRefPtr<CursorList>);
+    void addCursor(RefPtr<StyleImage>&&, const IntPoint& hotSpot = IntPoint());
+    void setCursorList(RefPtr<CursorList>&&);
     void clearCursorList();
 
 #if ENABLE(CURSOR_VISIBILITY)
@@ -1529,7 +1529,7 @@ public:
     void setBoxOrient(EBoxOrient o) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, orient, o); }
     void setBoxPack(EBoxPack p) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, pack, p); }
     void setBoxShadow(std::unique_ptr<ShadowData>, bool add = false);
-    void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
+    void setBoxReflect(RefPtr<StyleReflection>&& reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = WTFMove(reflect); }
     void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
     void setFlexGrow(float f) { SET_NESTED_VAR(rareNonInheritedData, m_flexibleBox, m_flexGrow, f); }
     void setFlexShrink(float f) { SET_NESTED_VAR(rareNonInheritedData, m_flexibleBox, m_flexShrink, f); }
@@ -1793,11 +1793,11 @@ public:
     SVGLength kerning() const { return svgStyle().kerning(); }
     void setKerning(SVGLength k) { accessSVGStyle().setKerning(k); }
 
-    void setShapeOutside(PassRefPtr<ShapeValue> value)
+    void setShapeOutside(RefPtr<ShapeValue>&& value)
     {
         if (rareNonInheritedData->m_shapeOutside == value)
             return;
-        rareNonInheritedData.access()->m_shapeOutside = value;
+        rareNonInheritedData.access()->m_shapeOutside = WTFMove(value);
     }
     ShapeValue* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); }
 
@@ -1815,10 +1815,10 @@ public:
     }
     static float initialShapeImageThreshold() { return 0; }
 
-    void setClipPath(PassRefPtr<ClipPathOperation> operation)
+    void setClipPath(RefPtr<ClipPathOperation>&& operation)
     {
         if (rareNonInheritedData->m_clipPath != operation)
-            rareNonInheritedData.access()->m_clipPath = operation;
+            rareNonInheritedData.access()->m_clipPath = WTFMove(operation);
     }
     ClipPathOperation* clipPath() const { return rareNonInheritedData->m_clipPath.get(); }
 
@@ -1829,7 +1829,7 @@ public:
     bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
     void clearContent();
     void setContent(const String&, bool add = false);
-    void setContent(PassRefPtr<StyleImage>, bool add = false);
+    void setContent(RefPtr<StyleImage>&&, bool add = false);
     void setContent(std::unique_ptr<CounterContent>, bool add = false);
     void setContent(QuoteType, bool add = false);
     void setContentAltText(const String&);
@@ -1842,10 +1842,10 @@ public:
     const CounterDirectives getCounterDirectives(const AtomicString& identifier) const;
 
     QuotesData* quotes() const { return rareInheritedData->quotes.get(); }
-    void setQuotes(PassRefPtr<QuotesData>);
+    void setQuotes(RefPtr<QuotesData>&&);
 
     WillChangeData* willChange() const { return rareNonInheritedData->m_willChange.get(); }
-    void setWillChange(PassRefPtr<WillChangeData>);
+    void setWillChange(RefPtr<WillChangeData>&&);
 
     bool willChangeCreatesStackingContext() const
     {
index aa993e1..f70691b 100644 (file)
@@ -96,9 +96,9 @@ CachedImage* StyleCachedImage::cachedImage() const
     return m_cachedImage.get();
 }
 
-PassRefPtr<CSSValue> StyleCachedImage::cssValue() const
+Ref<CSSValue> StyleCachedImage::cssValue() const
 {
-    return const_cast<CSSValue*>(m_cssValue.ptr());
+    return const_cast<CSSValue&>(m_cssValue.get());
 }
 
 bool StyleCachedImage::canRender(const RenderElement* renderer, float multiplier) const
index d69e84f..4f79c46 100644 (file)
@@ -46,7 +46,7 @@ public:
 
     WrappedImagePtr data() const override { return m_cachedImage.get(); }
 
-    PassRefPtr<CSSValue> cssValue() const override;
+    Ref<CSSValue> cssValue() const override;
     
     bool canRender(const RenderElement*, float multiplier) const override;
     bool isPending() const override;
index 66c8cba..b071f8f 100644 (file)
@@ -37,9 +37,9 @@ StyleGeneratedImage::StyleGeneratedImage(Ref<CSSImageGeneratorValue>&& value)
     m_isGeneratedImage = true;
 }
 
-PassRefPtr<CSSValue> StyleGeneratedImage::cssValue() const
+Ref<CSSValue> StyleGeneratedImage::cssValue() const
 {
-    return const_cast<CSSImageGeneratorValue*>(m_imageGeneratorValue.ptr());
+    return const_cast<CSSImageGeneratorValue&>(m_imageGeneratorValue.get());
 }
 
 bool StyleGeneratedImage::isPending() const
index 0bf4cc4..25905fa 100644 (file)
@@ -45,7 +45,7 @@ private:
 
     WrappedImagePtr data() const override { return m_imageGeneratorValue.ptr(); }
 
-    PassRefPtr<CSSValue> cssValue() const override;
+    Ref<CSSValue> cssValue() const override;
 
     bool isPending() const override;
     void load(CachedResourceLoader&, const ResourceLoaderOptions&) override;
index e6d3a07..534f627 100644 (file)
@@ -27,7 +27,6 @@
 #include "CSSValue.h"
 #include "FloatSize.h"
 #include "Image.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 #include <wtf/TypeCasts.h>
@@ -49,7 +48,7 @@ public:
 
     virtual bool operator==(const StyleImage& other) const = 0;
 
-    virtual PassRefPtr<CSSValue> cssValue() const = 0;
+    virtual Ref<CSSValue> cssValue() const = 0;
 
     virtual bool canRender(const RenderElement*, float /*multiplier*/) const { return true; }
     virtual bool isPending() const = 0;
index f16ea5f..5965d32 100644 (file)
@@ -28,7 +28,6 @@
 #include "BorderValue.h"
 #include "Length.h"
 #include "RenderStyleConstants.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
index a776c3c..31ae045 100644 (file)
@@ -30,7 +30,6 @@
 #include "Length.h"
 #include "StyleCustomPropertyData.h"
 #include <wtf/RefCounted.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/AtomicString.h>
 
 #if ENABLE(TEXT_AUTOSIZING)
index 0673bf2..1eb5aeb 100644 (file)
@@ -1,3 +1,14 @@
+2016-10-25  Andreas Kling  <akling@apple.com>
+
+        More PassRefPtr purging in WebCore.
+        <https://webkit.org/b/163895>
+
+        Reviewed by Antti Koivisto.
+
+        * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.h:
+        * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
+        (WebKit::PDFPlugin::createScrollbar):
+
 2016-10-25  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         NetworkSession: switch to use subclasses for NetworkSession and NetworkDataTask implementations
index 7bfa46a..1456a51 100644 (file)
@@ -218,7 +218,7 @@ private:
 
     // PDFPlugin functions.
     void updateScrollbars();
-    PassRefPtr<WebCore::Scrollbar> createScrollbar(WebCore::ScrollbarOrientation);
+    Ref<WebCore::Scrollbar> createScrollbar(WebCore::ScrollbarOrientation);
     void destroyScrollbar(WebCore::ScrollbarOrientation);
     void pdfDocumentDidLoad();
     void addArchiveResource();
index 8bb3e3f..5ede56e 100644 (file)
@@ -649,7 +649,7 @@ const PluginView* PDFPlugin::pluginView() const
     return static_cast<const PluginView*>(controller());
 }
 
-PassRefPtr<Scrollbar> PDFPlugin::createScrollbar(ScrollbarOrientation orientation)
+Ref<Scrollbar> PDFPlugin::createScrollbar(ScrollbarOrientation orientation)
 {
     auto widget = Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
     if (orientation == HorizontalScrollbar) {
@@ -659,14 +659,14 @@ PassRefPtr<Scrollbar> PDFPlugin::createScrollbar(ScrollbarOrientation orientatio
         m_verticalScrollbarLayer = adoptNS([[WKPDFPluginScrollbarLayer alloc] initWithPDFPlugin:this]);
         [m_containerLayer addSublayer:m_verticalScrollbarLayer.get()];
     }
-    didAddScrollbar(widget.get(), orientation);
+    didAddScrollbar(widget.ptr(), orientation);
     if (Frame* frame = webFrame()->coreFrame()) {
         if (Page* page = frame->page()) {
             if (page->expectsWheelEventTriggers())
                 scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
         }
     }
-    pluginView()->frame()->view()->addChild(widget.get());
+    pluginView()->frame()->view()->addChild(widget.ptr());
     return widget;
 }