Reduce PassRefPtr uses in dom - 5
authorgyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 31 Jan 2016 12:08:32 +0000 (12:08 +0000)
committergyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 31 Jan 2016 12:08:32 +0000 (12:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153470

Reviewed by Darin Adler.

As a step to remove PassRefPtr, this patch reduces uses of PassRefPtr in WebCore/dom.

* dom/Document.cpp:
(WebCore::Document::adoptNode):
(WebCore::Document::implicitClose):
(WebCore::Document::enqueuePopstateEvent):
(WebCore::Document::setInputCursor):
* dom/Document.h:
* dom/DocumentMarker.cpp:
(WebCore::DocumentMarkerTextMatch::instanceFor):
* dom/Event.cpp:
(WebCore::Event::setUnderlyingEvent):
* dom/Event.h:
* dom/EventDispatcher.h:
* dom/GenericEventQueue.cpp:
(WebCore::GenericEventQueue::enqueueEvent):
* dom/GenericEventQueue.h:
* dom/MouseEvent.cpp:
(WebCore::SimulatedMouseEvent::SimulatedMouseEvent):
* dom/Node.cpp:
(WebCore::Node::dispatchDOMActivateEvent):
* dom/NodeIterator.h:
* dom/PendingScript.h:
* dom/PopStateEvent.cpp:
(WebCore::PopStateEvent::create):
* dom/PopStateEvent.h:
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::setCSSStyleSheet): Deleted. Nobody calls this function.
* dom/ProcessingInstruction.h:
* dom/RangeBoundaryPoint.h:
(WebCore::RangeBoundaryPoint::RangeBoundaryPoint):
* dom/TextEvent.cpp:
(WebCore::TextEvent::createForFragmentPaste):
(WebCore::TextEvent::TextEvent):
* dom/TextEvent.h:
* editing/Editor.cpp:
(WebCore::Editor::pasteAsFragment):
* editing/Editor.h:
* editing/mac/EditorMac.mm:
(WebCore::Editor::replaceNodeFromPasteboard):

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

27 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/DocumentMarker.cpp
Source/WebCore/dom/Event.cpp
Source/WebCore/dom/Event.h
Source/WebCore/dom/EventDispatcher.h
Source/WebCore/dom/GenericEventQueue.cpp
Source/WebCore/dom/GenericEventQueue.h
Source/WebCore/dom/MouseEvent.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/NodeIterator.h
Source/WebCore/dom/PendingScript.h
Source/WebCore/dom/PopStateEvent.cpp
Source/WebCore/dom/PopStateEvent.h
Source/WebCore/dom/ProcessingInstruction.cpp
Source/WebCore/dom/ProcessingInstruction.h
Source/WebCore/dom/RangeBoundaryPoint.h
Source/WebCore/dom/TextEvent.cpp
Source/WebCore/dom/TextEvent.h
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/gtk/EditorGtk.cpp
Source/WebCore/editing/ios/EditorIOS.mm
Source/WebCore/editing/mac/EditorMac.mm
Source/WebCore/editing/win/EditorWin.cpp
Source/WebKit/mac/WebView/WebHTMLView.mm

index c276c53..d096d19 100644 (file)
@@ -1,5 +1,53 @@
 2016-01-31  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
+        Reduce PassRefPtr uses in dom - 5
+        https://bugs.webkit.org/show_bug.cgi?id=153470
+
+        Reviewed by Darin Adler.
+
+        As a step to remove PassRefPtr, this patch reduces uses of PassRefPtr in WebCore/dom. 
+
+        * dom/Document.cpp:
+        (WebCore::Document::adoptNode):
+        (WebCore::Document::implicitClose):
+        (WebCore::Document::enqueuePopstateEvent):
+        (WebCore::Document::setInputCursor):
+        * dom/Document.h:
+        * dom/DocumentMarker.cpp:
+        (WebCore::DocumentMarkerTextMatch::instanceFor):
+        * dom/Event.cpp:
+        (WebCore::Event::setUnderlyingEvent):
+        * dom/Event.h:
+        * dom/EventDispatcher.h:
+        * dom/GenericEventQueue.cpp:
+        (WebCore::GenericEventQueue::enqueueEvent):
+        * dom/GenericEventQueue.h:
+        * dom/MouseEvent.cpp:
+        (WebCore::SimulatedMouseEvent::SimulatedMouseEvent):
+        * dom/Node.cpp:
+        (WebCore::Node::dispatchDOMActivateEvent):
+        * dom/NodeIterator.h:
+        * dom/PendingScript.h:
+        * dom/PopStateEvent.cpp:
+        (WebCore::PopStateEvent::create):
+        * dom/PopStateEvent.h:
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::setCSSStyleSheet): Deleted. Nobody calls this function.
+        * dom/ProcessingInstruction.h:
+        * dom/RangeBoundaryPoint.h:
+        (WebCore::RangeBoundaryPoint::RangeBoundaryPoint):
+        * dom/TextEvent.cpp:
+        (WebCore::TextEvent::createForFragmentPaste):
+        (WebCore::TextEvent::TextEvent):
+        * dom/TextEvent.h:
+        * editing/Editor.cpp:
+        (WebCore::Editor::pasteAsFragment):
+        * editing/Editor.h:
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::replaceNodeFromPasteboard):
+
+2016-01-31  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
         Use std::make_unique<> when creating an unique_ptr object.
         https://bugs.webkit.org/show_bug.cgi?id=153705
 
index 05e7752..a00932f 100644 (file)
@@ -1005,7 +1005,7 @@ RefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCode&
 }
 
 
-RefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
+RefPtr<Node> Document::adoptNode(Node* source, ExceptionCode& ec)
 {
     if (!source) {
         ec = NOT_SUPPORTED_ERR;
@@ -1044,7 +1044,7 @@ RefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
         }
     }
 
-    adoptIfNeeded(source.get());
+    adoptIfNeeded(source);
 
     return source;
 }
@@ -2731,8 +2731,8 @@ void Document::implicitClose()
     dispatchWindowLoadEvent();
     enqueuePageshowEvent(PageshowEventNotPersisted);
     if (m_pendingStateObject)
-        enqueuePopstateEvent(m_pendingStateObject.release());
-    
+        enqueuePopstateEvent(WTFMove(m_pendingStateObject));
+
     if (f)
         f->loader().dispatchOnloadEvents();
 #ifdef INSTRUMENT_LAYOUT_SCHEDULING
@@ -5550,9 +5550,9 @@ void Document::enqueueHashchangeEvent(const String& oldURL, const String& newURL
     enqueueWindowEvent(HashChangeEvent::create(oldURL, newURL));
 }
 
-void Document::enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject)
+void Document::enqueuePopstateEvent(RefPtr<SerializedScriptValue>&& stateObject)
 {
-    enqueueWindowEvent(PopStateEvent::create(stateObject, m_domWindow ? m_domWindow->history() : nullptr));
+    enqueueWindowEvent(PopStateEvent::create(WTFMove(stateObject), m_domWindow ? m_domWindow->history() : nullptr));
 }
 
 void Document::addMediaCanStartListener(MediaCanStartListener* listener)
@@ -6830,7 +6830,7 @@ bool Document::hasFocus() const
 #if ENABLE(WEB_REPLAY)
 void Document::setInputCursor(PassRefPtr<InputCursor> cursor)
 {
-    m_inputCursor = cursor;
+    m_inputCursor = WTFMove(cursor);
 }
 #endif
 
index 8943db7..4d68701 100644 (file)
@@ -466,7 +466,7 @@ public:
     DOMSecurityPolicy& securityPolicy();
 #endif
 
-    RefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
+    RefPtr<Node> adoptNode(Node* source, ExceptionCode&);
 
     Ref<HTMLCollection> images();
     Ref<HTMLCollection> embeds();
@@ -1100,7 +1100,7 @@ public:
     void enqueueOverflowEvent(Ref<Event>&&);
     void enqueuePageshowEvent(PageshowEventPersistence);
     void enqueueHashchangeEvent(const String& oldURL, const String& newURL);
-    void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject);
+    void enqueuePopstateEvent(RefPtr<SerializedScriptValue>&& stateObject);
     virtual DocumentEventQueue& eventQueue() const override final { return m_eventQueue; }
 
     WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener*);
index 05f080d..bf8d49e 100644 (file)
@@ -37,7 +37,7 @@ DocumentMarkerDetails::~DocumentMarkerDetails()
 {
 }
 
-class DocumentMarkerDescription : public DocumentMarkerDetails {
+class DocumentMarkerDescription final : public DocumentMarkerDetails {
 public:
     static Ref<DocumentMarkerDescription> create(const String&);
 
index 149b04e..cd916d9 100644 (file)
@@ -176,13 +176,14 @@ void Event::receivedTarget()
 {
 }
 
-void Event::setUnderlyingEvent(PassRefPtr<Event> ue)
+void Event::setUnderlyingEvent(Event* underlyingEvent)
 {
     // Prohibit creation of a cycle -- just do nothing in that case.
-    for (Event* e = ue.get(); e; e = e->underlyingEvent())
-        if (e == this)
+    for (Event* event = underlyingEvent; event; event = event->underlyingEvent()) {
+        if (event == this)
             return;
-    m_underlyingEvent = ue;
+    }
+    m_underlyingEvent = underlyingEvent;
 }
 
 } // namespace WebCore
index a139871..a53a88f 100644 (file)
@@ -173,7 +173,7 @@ public:
     void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }
 
     Event* underlyingEvent() const { return m_underlyingEvent.get(); }
-    void setUnderlyingEvent(PassRefPtr<Event>);
+    void setUnderlyingEvent(Event*);
 
     virtual DataTransfer* internalDataTransfer() const { return 0; }
 
index f189d7a..ba43eed 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "SimulatedClickOptions.h"
 #include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
 
 namespace WebCore {
 
index dba8527..cd201a3 100644 (file)
@@ -45,7 +45,7 @@ GenericEventQueue::~GenericEventQueue()
 {
 }
 
-void GenericEventQueue::enqueueEvent(PassRefPtr<Event> event)
+void GenericEventQueue::enqueueEvent(RefPtr<Event>&& event)
 {
     if (m_isClosed)
         return;
@@ -53,7 +53,7 @@ void GenericEventQueue::enqueueEvent(PassRefPtr<Event> event)
     if (event->target() == &m_owner)
         event->setTarget(nullptr);
 
-    m_pendingEvents.append(event);
+    m_pendingEvents.append(WTFMove(event));
 
     if (m_isSuspended)
         return;
index 2b5e48a..d3a038a 100644 (file)
@@ -42,7 +42,7 @@ public:
     explicit GenericEventQueue(EventTarget&);
     ~GenericEventQueue();
 
-    void enqueueEvent(PassRefPtr<Event>);
+    void enqueueEvent(RefPtr<Event>&&);
     void close();
 
     void cancelAllEvents();
index 950a4b3..6e45613 100644 (file)
@@ -278,7 +278,7 @@ SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, Abstract
         m_shiftKey = keyStateEvent->shiftKey();
         m_metaKey = keyStateEvent->metaKey();
     }
-    setUnderlyingEvent(underlyingEvent);
+    setUnderlyingEvent(underlyingEvent.get());
 
     if (is<MouseEvent>(this->underlyingEvent())) {
         MouseEvent& mouseEvent = downcast<MouseEvent>(*this->underlyingEvent());
index 4ab52fb..fe61981 100644 (file)
@@ -2128,7 +2128,7 @@ bool Node::dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEven
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!NoEventDispatchAssertion::isEventDispatchForbidden());
     Ref<UIEvent> event = UIEvent::create(eventNames().DOMActivateEvent, true, true, document().defaultView(), detail);
-    event->setUnderlyingEvent(underlyingEvent);
+    event->setUnderlyingEvent(underlyingEvent.get());
     dispatchScopedEvent(event);
     return event->defaultHandled();
 }
index 8bfdf6b..f85d757 100644 (file)
@@ -28,7 +28,6 @@
 #include "NodeFilter.h"
 #include "ScriptWrappable.h"
 #include "Traversal.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
index 0236fe9..04d1b23 100644 (file)
@@ -29,7 +29,6 @@
 #include "CachedResourceClient.h"
 #include "CachedResourceHandle.h"
 #include <wtf/text/TextPosition.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
index 1bd5be8..7bdcfcd 100644 (file)
@@ -64,9 +64,9 @@ Ref<PopStateEvent> PopStateEvent::create()
     return adoptRef(*new PopStateEvent);
 }
 
-Ref<PopStateEvent> PopStateEvent::create(PassRefPtr<SerializedScriptValue> serializedState, PassRefPtr<History> history)
+Ref<PopStateEvent> PopStateEvent::create(RefPtr<SerializedScriptValue>&& serializedState, PassRefPtr<History> history)
 {
-    return adoptRef(*new PopStateEvent(serializedState, history));
+    return adoptRef(*new PopStateEvent(WTFMove(serializedState), history));
 }
 
 Ref<PopStateEvent> PopStateEvent::create(const AtomicString& type, const PopStateEventInit& initializer)
index c63b34a..6d47418 100644 (file)
@@ -46,7 +46,7 @@ class PopStateEvent final : public Event {
 public:
     virtual ~PopStateEvent();
     static Ref<PopStateEvent> create();
-    static Ref<PopStateEvent> create(PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);
+    static Ref<PopStateEvent> create(RefPtr<SerializedScriptValue>&&, PassRefPtr<History>);
     static Ref<PopStateEvent> create(const AtomicString&, const PopStateEventInit&);
 
     PassRefPtr<SerializedScriptValue> serializedState() const { ASSERT(m_serializedState); return m_serializedState; }
index d310c80..2803315 100644 (file)
@@ -236,15 +236,6 @@ void ProcessingInstruction::parseStyleSheet(const String& sheet)
 #endif
 }
 
-void ProcessingInstruction::setCSSStyleSheet(PassRefPtr<CSSStyleSheet> sheet)
-{
-    ASSERT(!m_cachedSheet);
-    ASSERT(!m_loading);
-    m_sheet = sheet;
-    sheet->setTitle(m_title);
-    sheet->setDisabled(m_alternate);
-}
-
 void ProcessingInstruction::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
 {
     if (!sheet())
index d429a87..c3c5a9d 100644 (file)
@@ -45,7 +45,6 @@ public:
 
     const String& localHref() const { return m_localHref; }
     StyleSheet* sheet() const { return m_sheet.get(); }
-    void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>);
 
     bool isCSS() const { return m_isCSS; }
 #if ENABLE(XSLT)
index 1907102..28e88c3 100644 (file)
@@ -33,7 +33,7 @@ namespace WebCore {
 
 class RangeBoundaryPoint {
 public:
-    explicit RangeBoundaryPoint(PassRefPtr<Node> container);
+    explicit RangeBoundaryPoint(Node* container);
 
     explicit RangeBoundaryPoint(const RangeBoundaryPoint&);
 
@@ -65,7 +65,7 @@ private:
     RefPtr<Node> m_childBeforeBoundary;
 };
 
-inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtr<Node> container)
+inline RangeBoundaryPoint::RangeBoundaryPoint(Node* container)
     : m_containerNode(container)
 {
     ASSERT(m_containerNode);
index 829a8c5..854cb99 100644 (file)
@@ -47,9 +47,9 @@ Ref<TextEvent> TextEvent::createForPlainTextPaste(AbstractView* view, const Stri
     return adoptRef(*new TextEvent(view, data, 0, shouldSmartReplace, false, MailBlockquoteHandling::RespectBlockquote));
 }
 
-Ref<TextEvent> TextEvent::createForFragmentPaste(AbstractView* view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)
+Ref<TextEvent> TextEvent::createForFragmentPaste(AbstractView* view, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)
 {
-    return adoptRef(*new TextEvent(view, "", data, shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling));
+    return adoptRef(*new TextEvent(view, emptyString(), WTFMove(data), shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling));
 }
 
 Ref<TextEvent> TextEvent::createForDrop(AbstractView* view, const String& data)
@@ -80,11 +80,11 @@ TextEvent::TextEvent(AbstractView* view, const String& data, TextEventInputType
 {
 }
 
-TextEvent::TextEvent(AbstractView* view, const String& data, PassRefPtr<DocumentFragment> pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)
+TextEvent::TextEvent(AbstractView* view, const String& data, RefPtr<DocumentFragment>&& pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)
     : UIEvent(eventNames().textInputEvent, true, true, view, 0)
     , m_inputType(TextEventInputPaste)
     , m_data(data)
-    , m_pastingFragment(pastingFragment)
+    , m_pastingFragment(WTFMove(pastingFragment))
     , m_shouldSmartReplace(shouldSmartReplace)
     , m_shouldMatchStyle(shouldMatchStyle)
     , m_mailBlockquoteHandling(mailBlockquoteHandling)
index 1a2af58..ac56a32 100644 (file)
@@ -43,7 +43,7 @@ namespace WebCore {
         static Ref<TextEvent> create();
         static Ref<TextEvent> create(AbstractView*, const String& data, TextEventInputType = TextEventInputKeyboard);
         static Ref<TextEvent> createForPlainTextPaste(AbstractView*, const String& data, bool shouldSmartReplace);
-        static Ref<TextEvent> createForFragmentPaste(AbstractView*, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);
+        static Ref<TextEvent> createForFragmentPaste(AbstractView*, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);
         static Ref<TextEvent> createForDrop(AbstractView*, const String& data);
         static Ref<TextEvent> createForDictation(AbstractView*, const String& data, const Vector<DictationAlternative>& dictationAlternatives);
 
@@ -72,7 +72,7 @@ namespace WebCore {
         TextEvent();
 
         TextEvent(AbstractView*, const String& data, TextEventInputType = TextEventInputKeyboard);
-        TextEvent(AbstractView*, const String& data, PassRefPtr<DocumentFragment>, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);
+        TextEvent(AbstractView*, const String& data, RefPtr<DocumentFragment>&&, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);
         TextEvent(AbstractView*, const String& data, const Vector<DictationAlternative>& dictationAlternatives);
 
         virtual bool isTextEvent() const override;
index 33a1022..554d770 100644 (file)
@@ -464,12 +464,12 @@ void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
     target->dispatchEvent(TextEvent::createForPlainTextPaste(document().domWindow(), pastingText, smartReplace));
 }
 
-void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle, MailBlockquoteHandling respectsMailBlockquote)
+void Editor::pasteAsFragment(Ref<DocumentFragment>&& pastingFragment, bool smartReplace, bool matchStyle, MailBlockquoteHandling respectsMailBlockquote)
 {
     Node* target = findEventTargetFromSelection();
     if (!target)
         return;
-    target->dispatchEvent(TextEvent::createForFragmentPaste(document().domWindow(), pastingFragment, smartReplace, matchStyle, respectsMailBlockquote));
+    target->dispatchEvent(TextEvent::createForFragmentPaste(document().domWindow(), WTFMove(pastingFragment), smartReplace, matchStyle, respectsMailBlockquote));
 }
 
 void Editor::pasteAsPlainTextBypassingDHTML()
index c9d156e..b0a5255 100644 (file)
@@ -346,7 +346,7 @@ public:
     WEBCORE_EXPORT void handleAlternativeTextUIResult(const String& correction);
     void dismissCorrectionPanelAsIgnored();
 
-    WEBCORE_EXPORT void pasteAsFragment(PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
+    WEBCORE_EXPORT void pasteAsFragment(Ref<DocumentFragment>&&, bool smartReplace, bool matchStyle, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
     WEBCORE_EXPORT void pasteAsPlainText(const String&, bool smartReplace);
 
     // This is only called on the mac where paste is implemented primarily at the WebKit level.
index 83c49e8..64e6f51 100644 (file)
@@ -77,7 +77,7 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, Ma
     bool chosePlainText;
     RefPtr<DocumentFragment> fragment = createFragmentFromPasteboardData(*pasteboard, m_frame, *range, allowPlainText, chosePlainText);
     if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))
-        pasteAsFragment(fragment, canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling);
+        pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling);
 }
 
 static const AtomicString& elementURL(Element& element)
index 12a1371..8040f44 100644 (file)
@@ -546,7 +546,7 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, Ma
     }
 
     if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))
-        pasteAsFragment(fragment, canSmartReplaceWithPasteboard(*pasteboard), false, mailBlockquoteHandling);
+        pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), false, mailBlockquoteHandling);
 }
 
 PassRefPtr<DocumentFragment> Editor::createFragmentAndAddResources(NSAttributedString *string)
@@ -602,7 +602,7 @@ void Editor::replaceSelectionWithAttributedString(NSAttributedString *attributed
     if (m_frame.selection().selection().isContentRichlyEditable()) {
         RefPtr<DocumentFragment> fragment = createFragmentAndAddResources(attributedString);
         if (fragment && shouldInsertFragment(fragment, selectedRange(), EditorInsertActionPasted))
-            pasteAsFragment(fragment, false, false, mailBlockquoteHandling);
+            pasteAsFragment(fragment.releaseNonNull(), false, false, mailBlockquoteHandling);
     } else {
         String text = [attributedString string];
         if (shouldInsertText(text, selectedRange().get(), EditorInsertActionPasted))
index 4b3c642..5a52198 100644 (file)
@@ -96,7 +96,7 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, Ma
     RefPtr<DocumentFragment> fragment = webContentFromPasteboard(*pasteboard, *range, allowPlainText, chosePlainText);
 
     if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))
-        pasteAsFragment(fragment, canSmartReplaceWithPasteboard(*pasteboard), false, mailBlockquoteHandling);
+        pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), false, mailBlockquoteHandling);
 
     client()->setInsertionPasteboard(String());
 }
@@ -283,7 +283,7 @@ void Editor::replaceNodeFromPasteboard(Node* node, const String& pasteboardName)
     if (RefPtr<DocumentFragment> fragment = webContentFromPasteboard(pasteboard, *range, true, chosePlainText)) {
         maybeCopyNodeAttributesToFragment(*node, *fragment);
         if (shouldInsertFragment(fragment, range, EditorInsertActionPasted))
-            pasteAsFragment(fragment.release(), canSmartReplaceWithPasteboard(pasteboard), false, MailBlockquoteHandling::IgnoreBlockquote);
+            pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(pasteboard), false, MailBlockquoteHandling::IgnoreBlockquote);
     }
 
     client()->setInsertionPasteboard(String());
@@ -673,7 +673,7 @@ void Editor::replaceSelectionWithAttributedString(NSAttributedString *attributed
     if (m_frame.selection().selection().isContentRichlyEditable()) {
         RefPtr<DocumentFragment> fragment = createFragmentAndAddResources(attributedString);
         if (fragment && shouldInsertFragment(fragment, selectedRange(), EditorInsertActionPasted))
-            pasteAsFragment(fragment, false, false, mailBlockquoteHandling);
+            pasteAsFragment(fragment.releaseNonNull(), false, false, mailBlockquoteHandling);
     } else {
         String text = [attributedString string];
         if (shouldInsertText(text, selectedRange().get(), EditorInsertActionPasted))
index a8ad67c..215d6f8 100644 (file)
@@ -44,7 +44,7 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, Ma
     bool chosePlainText;
     RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, *range, allowPlainText, chosePlainText);
     if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))
-        pasteAsFragment(fragment, canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling);
+        pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling);
 }
 
 template <typename PlatformDragData>
index da76845..2af5bec 100644 (file)
@@ -1326,7 +1326,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
 
     DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText];
     if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionPasted])
-        coreFrame->editor().pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);
+        coreFrame->editor().pasteAsFragment(*core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);
 
     [webView _setInsertionPasteboard:nil];
     [webView release];