Remove all uses of PassRefPtr in WebCore/svg
authorgyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Sep 2015 02:16:22 +0000 (02:16 +0000)
committergyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Sep 2015 02:16:22 +0000 (02:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148472

Reviewed by Darin Adler.

Clean up all uses of PassRefPtr in WebCore/svg.

* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::addEventListener):
* Modules/webaudio/AudioScheduledSourceNode.h:
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::addEventListener):
* Modules/webaudio/ScriptProcessorNode.h:
* dom/EventListenerMap.cpp:
(WebCore::copyListenersNotCreatedFromMarkupToTarget):
* dom/EventTarget.cpp:
(WebCore::EventTarget::addEventListener):
* dom/EventTarget.h:
* dom/MessagePort.cpp:
(WebCore::MessagePort::addEventListener):
* dom/MessagePort.h:
* dom/Node.cpp:
(WebCore::tryAddEventListener):
(WebCore::Node::addEventListener):
* dom/Node.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::addEventListener):
* html/HTMLMediaElement.h:
* html/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure):
* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::showClosedCaptionTrackList):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
* page/DOMWindow.h:
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives):
* svg/SVGElement.cpp:
(WebCore::SVGElement::addEventListener):
* svg/SVGElement.h:
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::pathSegListChanged):
* svg/SVGPathUtilities.cpp:
(WebCore::appendSVGPathByteStreamFromSVGPathSeg):
* svg/SVGPathUtilities.h:
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefTargetEventListener::attach):
(WebCore::SVGTRefElement::buildPendingResource):
* svg/graphics/filters/SVGFilterBuilder.cpp:
(WebCore::SVGFilterBuilder::appendEffectToEffectReferences):
* svg/graphics/filters/SVGFilterBuilder.h:

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

27 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp
Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h
Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp
Source/WebCore/Modules/webaudio/ScriptProcessorNode.h
Source/WebCore/dom/EventListenerMap.cpp
Source/WebCore/dom/EventTarget.cpp
Source/WebCore/dom/EventTarget.h
Source/WebCore/dom/MessagePort.cpp
Source/WebCore/dom/MessagePort.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/ImageDocument.cpp
Source/WebCore/html/shadow/MediaControlsApple.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGPathUtilities.cpp
Source/WebCore/svg/SVGPathUtilities.h
Source/WebCore/svg/SVGTRefElement.cpp
Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp
Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h

index 5760c16..99f9b40 100644 (file)
@@ -1,3 +1,57 @@
+2015-09-09  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
+        Remove all uses of PassRefPtr in WebCore/svg
+        https://bugs.webkit.org/show_bug.cgi?id=148472
+
+        Reviewed by Darin Adler.
+
+        Clean up all uses of PassRefPtr in WebCore/svg.
+
+        * Modules/webaudio/AudioScheduledSourceNode.cpp:
+        (WebCore::AudioScheduledSourceNode::addEventListener):
+        * Modules/webaudio/AudioScheduledSourceNode.h:
+        * Modules/webaudio/ScriptProcessorNode.cpp:
+        (WebCore::ScriptProcessorNode::addEventListener):
+        * Modules/webaudio/ScriptProcessorNode.h:
+        * dom/EventListenerMap.cpp:
+        (WebCore::copyListenersNotCreatedFromMarkupToTarget):
+        * dom/EventTarget.cpp:
+        (WebCore::EventTarget::addEventListener):
+        * dom/EventTarget.h:
+        * dom/MessagePort.cpp:
+        (WebCore::MessagePort::addEventListener):
+        * dom/MessagePort.h:
+        * dom/Node.cpp:
+        (WebCore::tryAddEventListener):
+        (WebCore::Node::addEventListener):
+        * dom/Node.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::addEventListener):
+        * html/HTMLMediaElement.h:
+        * html/ImageDocument.cpp:
+        (WebCore::ImageDocument::createDocumentStructure):
+        * html/shadow/MediaControlsApple.cpp:
+        (WebCore::MediaControlsApple::showClosedCaptionTrackList):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::addEventListener):
+        * page/DOMWindow.h:
+        * rendering/svg/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::buildPrimitives):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::addEventListener):
+        * svg/SVGElement.h:
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::pathSegListChanged):
+        * svg/SVGPathUtilities.cpp:
+        (WebCore::appendSVGPathByteStreamFromSVGPathSeg):
+        * svg/SVGPathUtilities.h:
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefTargetEventListener::attach):
+        (WebCore::SVGTRefElement::buildPendingResource):
+        * svg/graphics/filters/SVGFilterBuilder.cpp:
+        (WebCore::SVGFilterBuilder::appendEffectToEffectReferences):
+        * svg/graphics/filters/SVGFilterBuilder.h:
+
 2015-09-09  Dewei Zhu  <dewei_zhu@apple.com>
 
         Document.characterSet should return "UTF-8" instead of null by default.
index 723b988..c78e761 100644 (file)
@@ -211,9 +211,9 @@ void AudioScheduledSourceNode::finish()
     }
 }
 
-bool AudioScheduledSourceNode::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+bool AudioScheduledSourceNode::addEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
 {
-    bool success = AudioNode::addEventListener(eventType, listener, useCapture);
+    bool success = AudioNode::addEventListener(eventType, WTF::move(listener), useCapture);
     if (success && eventType == eventNames().endedEvent)
         m_hasEndedListener = hasEventListeners(eventNames().endedEvent);
     return success;
index 680af46..09930a0 100644 (file)
@@ -103,7 +103,7 @@ protected:
     static const double UnknownTime;
 
 private:
-    bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override;
+    bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture) override;
     bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) override;
     void removeAllEventListeners() override;
 };
index fefd6c6..9298aed 100644 (file)
@@ -273,9 +273,9 @@ double ScriptProcessorNode::latencyTime() const
     return std::numeric_limits<double>::infinity();
 }
 
-bool ScriptProcessorNode::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+bool ScriptProcessorNode::addEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
 {
-    bool success = AudioNode::addEventListener(eventType, listener, useCapture);
+    bool success = AudioNode::addEventListener(eventType, WTF::move(listener), useCapture);
     if (success && eventType == eventNames().audioprocessEvent)
         m_hasAudioProcessListener = hasEventListeners(eventNames().audioprocessEvent);
     return success;
index 961f121..4412069 100644 (file)
@@ -73,7 +73,7 @@ private:
 
     void fireProcessEvent();
 
-    bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override;
+    bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture) override;
     bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) override;
     void removeAllEventListeners() override;
 
index f09abbe..6af7b50 100644 (file)
@@ -187,7 +187,7 @@ static void copyListenersNotCreatedFromMarkupToTarget(const AtomicString& eventT
         // Event listeners created from markup have already been transfered to the shadow tree during cloning.
         if ((*listenerVector)[i].listener->wasCreatedFromMarkup())
             continue;
-        target->addEventListener(eventType, (*listenerVector)[i].listener, (*listenerVector)[i].useCapture);
+        target->addEventListener(eventType, (*listenerVector)[i].listener.copyRef(), (*listenerVector)[i].useCapture);
     }
 }
 
index d62fe67..8b9cd41 100644 (file)
@@ -74,9 +74,9 @@ bool EventTarget::isMessagePort() const
     return false;
 }
 
-bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+bool EventTarget::addEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
 {
-    return ensureEventTargetData().eventListenerMap.add(eventType, listener, useCapture);
+    return ensureEventTargetData().eventListenerMap.add(eventType, WTF::move(listener), useCapture);
 }
 
 bool EventTarget::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture)
index 86fe3bc..688e6ff 100644 (file)
@@ -120,7 +120,7 @@ public:
     virtual DOMWindow* toDOMWindow();
     virtual bool isMessagePort() const;
 
-    virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+    virtual bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture);
     virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
     virtual void removeAllEventListeners();
     virtual bool dispatchEvent(PassRefPtr<Event>);
index 2dbabe5..1163a08 100644 (file)
@@ -224,11 +224,11 @@ std::unique_ptr<MessagePortArray> MessagePort::entanglePorts(ScriptExecutionCont
     return portArray;
 }
 
-bool MessagePort::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+bool MessagePort::addEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
 {
     if (listener && listener->isAttribute() && eventType == eventNames().messageEvent)
         start();
-    return EventTargetWithInlineData::addEventListener(eventType, listener, useCapture);
+    return EventTargetWithInlineData::addEventListener(eventType, WTF::move(listener), useCapture);
 }
 
 } // namespace WebCore
index 11fcf57..743de0f 100644 (file)
@@ -93,7 +93,7 @@ namespace WebCore {
         // A port gets neutered when it is transferred to a new owner via postMessage().
         bool isNeutered() { return !m_entangledChannel; }
 
-        bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override;
+        bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture) override;
 
     private:
         explicit MessagePort(ScriptExecutionContext&);
index fdc7fb5..8aa4a1f 100644 (file)
@@ -1867,11 +1867,9 @@ void Node::didMoveToNewDocument(Document* oldDocument)
     }
 }
 
-static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eventType, PassRefPtr<EventListener> prpListener, bool useCapture)
+static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
 {
-    RefPtr<EventListener> listener = prpListener;
-
-    if (!targetNode->EventTarget::addEventListener(eventType, listener, useCapture))
+    if (!targetNode->EventTarget::addEventListener(eventType, listener.copyRef(), useCapture))
         return false;
 
     targetNode->document().addListenerTypeIfNeeded(eventType);
@@ -1889,7 +1887,7 @@ static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
     // This code was added to address <rdar://problem/5846492> Onorientationchange event not working for document.body.
     // Forward this call to addEventListener() to the window since these are window-only events.
     if (eventType == eventNames().orientationchangeEvent || eventType == eventNames().resizeEvent)
-        targetNode->document().domWindow()->addEventListener(eventType, listener, useCapture);
+        targetNode->document().domWindow()->addEventListener(eventType, WTF::move(listener), useCapture);
 
 #if ENABLE(TOUCH_EVENTS)
     if (eventNames().isTouchEventType(eventType))
@@ -1905,9 +1903,9 @@ static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
     return true;
 }
 
-bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+bool Node::addEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
 {
-    return tryAddEventListener(this, eventType, listener, useCapture);
+    return tryAddEventListener(this, eventType, WTF::move(listener), useCapture);
 }
 
 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& eventType, EventListener* listener, bool useCapture)
index 929ece4..18487a6 100644 (file)
@@ -521,7 +521,7 @@ public:
     virtual EventTargetInterface eventTargetInterface() const override;
     virtual ScriptExecutionContext* scriptExecutionContext() const override final; // Implemented in Document.h
 
-    virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override;
+    virtual bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture) override;
     virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) override;
 
     using EventTarget::dispatchEvent;
index 7409a51..b868177 100644 (file)
@@ -5046,13 +5046,13 @@ bool HTMLMediaElement::dispatchEvent(PassRefPtr<Event> prpEvent)
     return HTMLElement::dispatchEvent(event);
 }
 
-bool HTMLMediaElement::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+bool HTMLMediaElement::addEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
 {
     if (eventType != eventNames().webkitplaybacktargetavailabilitychangedEvent)
-        return Node::addEventListener(eventType, listener, useCapture);
+        return Node::addEventListener(eventType, WTF::move(listener), useCapture);
 
     bool isFirstAvailabilityChangedListener = !hasEventListeners(eventNames().webkitplaybacktargetavailabilitychangedEvent);
-    if (!Node::addEventListener(eventType, listener, useCapture))
+    if (!Node::addEventListener(eventType, WTF::move(listener), useCapture))
         return false;
 
     if (isFirstAvailabilityChangedListener) {
index 564a60d..0d8b4ef 100644 (file)
@@ -335,7 +335,7 @@ public:
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     void webkitShowPlaybackTargetPicker();
-    virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override;
+    virtual bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture) override;
     virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) override;
 
     virtual void wirelessRoutesAvailableDidChange() override;
index 81b5eee..980ea4e 100644 (file)
@@ -239,8 +239,8 @@ void ImageDocument::createDocumentStructure()
 #else
         RefPtr<EventListener> listener = ImageEventListener::create(*this);
         if (DOMWindow* window = this->domWindow())
-            window->addEventListener("resize", listener, false);
-        imageElement->addEventListener("click", listener.release(), false);
+            window->addEventListener("resize", listener.copyRef(), false);
+        imageElement->addEventListener("click", WTF::move(listener), false);
 #endif
     }
 
index 8fdba0d..3f42aba 100644 (file)
@@ -509,15 +509,15 @@ void MediaControlsApple::showClosedCaptionTrackList()
     m_panel->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNone);
 
     RefPtr<EventListener> listener = eventListener();
-    m_closedCaptionsContainer->addEventListener(eventNames().wheelEvent, listener, true);
+    m_closedCaptionsContainer->addEventListener(eventNames().wheelEvent, listener.copyRef(), true);
 
     // Track click events in the capture phase at two levels, first at the document level
     // such that a click outside of the <video> may dismiss the track list, second at the
     // media controls level such that a click anywhere outside of the track list hides the
     // track list. These two levels are necessary since it would not be possible to get a
     // reference to the track list when handling the event outside of the shadow tree.
-    document().addEventListener(eventNames().clickEvent, listener, true);
-    addEventListener(eventNames().clickEvent, listener, true);
+    document().addEventListener(eventNames().clickEvent, listener.copyRef(), true);
+    addEventListener(eventNames().clickEvent, WTF::move(listener), true);
 }
 
 void MediaControlsApple::hideClosedCaptionTrackList()
index fe4b9af..c10b719 100644 (file)
@@ -1692,9 +1692,9 @@ static void didAddStorageEventListener(DOMWindow* window)
     window->sessionStorage(IGNORE_EXCEPTION);
 }
 
-bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+bool DOMWindow::addEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
 {
-    if (!EventTarget::addEventListener(eventType, listener, useCapture))
+    if (!EventTarget::addEventListener(eventType, WTF::move(listener), useCapture))
         return false;
 
     if (Document* document = this->document()) {
index f6d285c..7e6b58f 100644 (file)
@@ -273,7 +273,7 @@ namespace WebCore {
 
         // Events
         // EventTarget API
-        virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override;
+        virtual bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture) override;
         virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) override;
         virtual void removeAllEventListeners() override;
 
index 04ead1a..c3eda29 100644 (file)
@@ -87,11 +87,11 @@ std::unique_ptr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(SVGFi
             builder->clearEffects();
             return nullptr;
         }
-        builder->appendEffectToEffectReferences(effect, element.renderer());
+        builder->appendEffectToEffectReferences(effect.copyRef(), element.renderer());
         element.setStandardAttributes(effect.get());
         effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(&element, filterElement().primitiveUnits(), targetBoundingBox));
         effect->setOperatingColorSpace(element.renderer()->style().svgStyle().colorInterpolationFilters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB);
-        builder->add(element.result(), effect.release());
+        builder->add(element.result(), WTF::move(effect));
     }
     return builder;
 }
index cac76d6..5fcd15e 100644 (file)
@@ -571,12 +571,10 @@ bool SVGElement::haveLoadedRequiredResources()
     return true;
 }
 
-bool SVGElement::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> prpListener, bool useCapture)
-{
-    RefPtr<EventListener> listener = prpListener;
-    
+bool SVGElement::addEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener, bool useCapture)
+{   
     // Add event listener to regular DOM element
-    if (!Node::addEventListener(eventType, listener, useCapture))
+    if (!Node::addEventListener(eventType, listener.copyRef(), useCapture))
         return false;
 
     if (containingShadowRoot())
@@ -586,7 +584,7 @@ bool SVGElement::addEventListener(const AtomicString& eventType, PassRefPtr<Even
     ASSERT(!instanceUpdatesBlocked());
     for (auto* instance : instances()) {
         ASSERT(instance->correspondingElement() == this);
-        bool result = instance->Node::addEventListener(eventType, listener, useCapture);
+        bool result = instance->Node::addEventListener(eventType, listener.copyRef(), useCapture);
         ASSERT_UNUSED(result, result);
     }
 
index 1ebf8cc..3c6b5e2 100644 (file)
@@ -34,7 +34,6 @@
 #include "Timer.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
 
 namespace WebCore {
 
@@ -141,7 +140,7 @@ public:
 
     virtual bool haveLoadedRequiredResources();
 
-    virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override;
+    virtual bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture) override;
     virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) override;
     bool hasFocusEventListeners() const;
 
index 5482561..6e8405d 100644 (file)
@@ -359,7 +359,7 @@ void SVGPathElement::pathSegListChanged(SVGPathSegRole role, ListModification li
     case PathSegUnalteredRole:
         if (listModification == ListModificationAppend) {
             ASSERT(!m_pathSegList.value.isEmpty());
-            appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last(), m_pathByteStream.get(), UnalteredParsing);
+            appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last().copyRef(), m_pathByteStream.get(), UnalteredParsing);
         } else
             buildSVGPathByteStreamFromSVGPathSegList(m_pathSegList.value, m_pathByteStream.get(), UnalteredParsing);
         break;
index 8fa6280..aea5f51 100644 (file)
@@ -139,14 +139,14 @@ bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList& list, SVGPat
     return ok;
 }
 
-bool appendSVGPathByteStreamFromSVGPathSeg(PassRefPtr<SVGPathSeg> pathSeg, SVGPathByteStream* result, PathParsingMode parsingMode)
+bool appendSVGPathByteStreamFromSVGPathSeg(RefPtr<SVGPathSeg>&& pathSeg, SVGPathByteStream* result, PathParsingMode parsingMode)
 {
     ASSERT(result);
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists!
     ASSERT(parsingMode == UnalteredParsing);
 
     SVGPathSegList appendedItemList(PathSegUnalteredRole);
-    appendedItemList.append(pathSeg);
+    appendedItemList.append(WTF::move(pathSeg));
     auto appendedByteStream = std::make_unique<SVGPathByteStream>();
 
     SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(appendedByteStream.get());
index b078a5e..c2d1f14 100644 (file)
@@ -38,7 +38,7 @@ bool buildPathFromByteStream(SVGPathByteStream*, Path&);
 
 // SVGPathSegList/String -> SVGPathByteStream
 bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList&, SVGPathByteStream*, PathParsingMode);
-bool appendSVGPathByteStreamFromSVGPathSeg(PassRefPtr<SVGPathSeg>, SVGPathByteStream*, PathParsingMode);
+bool appendSVGPathByteStreamFromSVGPathSeg(RefPtr<SVGPathSeg>&&, SVGPathByteStream*, PathParsingMode);
 bool buildSVGPathByteStreamFromString(const String&, SVGPathByteStream*, PathParsingMode);
 
 // SVGPathByteStream/SVGPathSegList -> String
index e3fad8d..3b5878e 100644 (file)
@@ -65,7 +65,7 @@ public:
         return listener->type() == SVGTRefTargetEventListenerType ? static_cast<const SVGTRefTargetEventListener*>(listener) : nullptr;
     }
 
-    void attach(PassRefPtr<Element> target);
+    void attach(RefPtr<Element>&& target);
     void detach();
     bool isAttached() const { return m_target.get(); }
 
@@ -86,7 +86,7 @@ SVGTRefTargetEventListener::SVGTRefTargetEventListener(SVGTRefElement& trefEleme
 {
 }
 
-void SVGTRefTargetEventListener::attach(PassRefPtr<Element> target)
+void SVGTRefTargetEventListener::attach(RefPtr<Element>&& target)
 {
     ASSERT(!isAttached());
     ASSERT(target.get());
@@ -94,7 +94,7 @@ void SVGTRefTargetEventListener::attach(PassRefPtr<Element> target)
 
     target->addEventListener(eventNames().DOMSubtreeModifiedEvent, this, false);
     target->addEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, false);
-    m_target = target;
+    m_target = WTF::move(target);
 }
 
 void SVGTRefTargetEventListener::detach()
@@ -249,7 +249,7 @@ void SVGTRefElement::buildPendingResource()
     // expects every element instance to have an associated shadow tree element - which is not the
     // case when we land here from SVGUseElement::buildShadowTree().
     if (!isInShadowTree())
-        m_targetListener->attach(target);
+        m_targetListener->attach(target.copyRef());
 
     updateReferencedText(target.get());
 }
index 1931321..968fbf7 100644 (file)
@@ -62,10 +62,8 @@ FilterEffect* SVGFilterBuilder::getEffectById(const AtomicString& id) const
     return m_namedEffects.get(id);
 }
 
-void SVGFilterBuilder::appendEffectToEffectReferences(PassRefPtr<FilterEffect> prpEffect, RenderObject* object)
+void SVGFilterBuilder::appendEffectToEffectReferences(RefPtr<FilterEffect>&& effect, RenderObject* object)
 {
-    RefPtr<FilterEffect> effect = prpEffect;
-
     // The effect must be a newly created filter effect.
     ASSERT(!m_effectReferences.contains(effect));
     ASSERT(object && !m_effectRenderer.contains(object));
index 0867d28..804086b 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/AtomicStringHash.h>
 #include <wtf/text/WTFString.h>
 
@@ -44,7 +43,7 @@ public:
     FilterEffect* getEffectById(const AtomicString& id) const;
     FilterEffect* lastEffect() const { return m_lastEffect.get(); }
 
-    void appendEffectToEffectReferences(PassRefPtr<FilterEffect>, RenderObject*);
+    void appendEffectToEffectReferences(RefPtr<FilterEffect>&&, RenderObject*);
 
     inline FilterEffectSet& effectReferences(FilterEffect* effect)
     {