Changeset 195927 in webkit
- Timestamp:
- Jan 31, 2016 4:08:32 AM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r195925 r195927 1 2016-01-31 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 3 Reduce PassRefPtr uses in dom - 5 4 https://bugs.webkit.org/show_bug.cgi?id=153470 5 6 Reviewed by Darin Adler. 7 8 As a step to remove PassRefPtr, this patch reduces uses of PassRefPtr in WebCore/dom. 9 10 * dom/Document.cpp: 11 (WebCore::Document::adoptNode): 12 (WebCore::Document::implicitClose): 13 (WebCore::Document::enqueuePopstateEvent): 14 (WebCore::Document::setInputCursor): 15 * dom/Document.h: 16 * dom/DocumentMarker.cpp: 17 (WebCore::DocumentMarkerTextMatch::instanceFor): 18 * dom/Event.cpp: 19 (WebCore::Event::setUnderlyingEvent): 20 * dom/Event.h: 21 * dom/EventDispatcher.h: 22 * dom/GenericEventQueue.cpp: 23 (WebCore::GenericEventQueue::enqueueEvent): 24 * dom/GenericEventQueue.h: 25 * dom/MouseEvent.cpp: 26 (WebCore::SimulatedMouseEvent::SimulatedMouseEvent): 27 * dom/Node.cpp: 28 (WebCore::Node::dispatchDOMActivateEvent): 29 * dom/NodeIterator.h: 30 * dom/PendingScript.h: 31 * dom/PopStateEvent.cpp: 32 (WebCore::PopStateEvent::create): 33 * dom/PopStateEvent.h: 34 * dom/ProcessingInstruction.cpp: 35 (WebCore::ProcessingInstruction::setCSSStyleSheet): Deleted. Nobody calls this function. 36 * dom/ProcessingInstruction.h: 37 * dom/RangeBoundaryPoint.h: 38 (WebCore::RangeBoundaryPoint::RangeBoundaryPoint): 39 * dom/TextEvent.cpp: 40 (WebCore::TextEvent::createForFragmentPaste): 41 (WebCore::TextEvent::TextEvent): 42 * dom/TextEvent.h: 43 * editing/Editor.cpp: 44 (WebCore::Editor::pasteAsFragment): 45 * editing/Editor.h: 46 * editing/mac/EditorMac.mm: 47 (WebCore::Editor::replaceNodeFromPasteboard): 48 1 49 2016-01-31 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 50 -
trunk/Source/WebCore/dom/Document.cpp
r195790 r195927 1006 1006 1007 1007 1008 RefPtr<Node> Document::adoptNode( PassRefPtr<Node>source, ExceptionCode& ec)1008 RefPtr<Node> Document::adoptNode(Node* source, ExceptionCode& ec) 1009 1009 { 1010 1010 if (!source) { … … 1045 1045 } 1046 1046 1047 adoptIfNeeded(source .get());1047 adoptIfNeeded(source); 1048 1048 1049 1049 return source; … … 2732 2732 enqueuePageshowEvent(PageshowEventNotPersisted); 2733 2733 if (m_pendingStateObject) 2734 enqueuePopstateEvent( m_pendingStateObject.release());2735 2734 enqueuePopstateEvent(WTFMove(m_pendingStateObject)); 2735 2736 2736 if (f) 2737 2737 f->loader().dispatchOnloadEvents(); … … 5551 5551 } 5552 5552 5553 void Document::enqueuePopstateEvent( PassRefPtr<SerializedScriptValue>stateObject)5554 { 5555 enqueueWindowEvent(PopStateEvent::create( stateObject, m_domWindow ? m_domWindow->history() : nullptr));5553 void Document::enqueuePopstateEvent(RefPtr<SerializedScriptValue>&& stateObject) 5554 { 5555 enqueueWindowEvent(PopStateEvent::create(WTFMove(stateObject), m_domWindow ? m_domWindow->history() : nullptr)); 5556 5556 } 5557 5557 … … 6831 6831 void Document::setInputCursor(PassRefPtr<InputCursor> cursor) 6832 6832 { 6833 m_inputCursor = cursor;6833 m_inputCursor = WTFMove(cursor); 6834 6834 } 6835 6835 #endif -
trunk/Source/WebCore/dom/Document.h
r195917 r195927 467 467 #endif 468 468 469 RefPtr<Node> adoptNode( PassRefPtr<Node>source, ExceptionCode&);469 RefPtr<Node> adoptNode(Node* source, ExceptionCode&); 470 470 471 471 Ref<HTMLCollection> images(); … … 1101 1101 void enqueuePageshowEvent(PageshowEventPersistence); 1102 1102 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); 1103 void enqueuePopstateEvent( PassRefPtr<SerializedScriptValue>stateObject);1103 void enqueuePopstateEvent(RefPtr<SerializedScriptValue>&& stateObject); 1104 1104 virtual DocumentEventQueue& eventQueue() const override final { return m_eventQueue; } 1105 1105 -
trunk/Source/WebCore/dom/DocumentMarker.cpp
r177733 r195927 38 38 } 39 39 40 class DocumentMarkerDescription : public DocumentMarkerDetails {40 class DocumentMarkerDescription final : public DocumentMarkerDetails { 41 41 public: 42 42 static Ref<DocumentMarkerDescription> create(const String&); -
trunk/Source/WebCore/dom/Event.cpp
r195524 r195927 177 177 } 178 178 179 void Event::setUnderlyingEvent( PassRefPtr<Event> ue)179 void Event::setUnderlyingEvent(Event* underlyingEvent) 180 180 { 181 181 // Prohibit creation of a cycle -- just do nothing in that case. 182 for (Event* e = ue.get(); e; e = e->underlyingEvent())183 if (e == this)182 for (Event* event = underlyingEvent; event; event = event->underlyingEvent()) { 183 if (event == this) 184 184 return; 185 m_underlyingEvent = ue; 185 } 186 m_underlyingEvent = underlyingEvent; 186 187 } 187 188 -
trunk/Source/WebCore/dom/Event.h
r195524 r195927 174 174 175 175 Event* underlyingEvent() const { return m_underlyingEvent.get(); } 176 void setUnderlyingEvent( PassRefPtr<Event>);176 void setUnderlyingEvent(Event*); 177 177 178 178 virtual DataTransfer* internalDataTransfer() const { return 0; } -
trunk/Source/WebCore/dom/EventDispatcher.h
r192354 r195927 29 29 #include "SimulatedClickOptions.h" 30 30 #include <wtf/Forward.h> 31 #include <wtf/PassRefPtr.h>32 31 33 32 namespace WebCore { -
trunk/Source/WebCore/dom/GenericEventQueue.cpp
r192354 r195927 46 46 } 47 47 48 void GenericEventQueue::enqueueEvent( PassRefPtr<Event>event)48 void GenericEventQueue::enqueueEvent(RefPtr<Event>&& event) 49 49 { 50 50 if (m_isClosed) … … 54 54 event->setTarget(nullptr); 55 55 56 m_pendingEvents.append( event);56 m_pendingEvents.append(WTFMove(event)); 57 57 58 58 if (m_isSuspended) -
trunk/Source/WebCore/dom/GenericEventQueue.h
r187031 r195927 43 43 ~GenericEventQueue(); 44 44 45 void enqueueEvent( PassRefPtr<Event>);45 void enqueueEvent(RefPtr<Event>&&); 46 46 void close(); 47 47 -
trunk/Source/WebCore/dom/MouseEvent.cpp
r195524 r195927 279 279 m_metaKey = keyStateEvent->metaKey(); 280 280 } 281 setUnderlyingEvent(underlyingEvent );281 setUnderlyingEvent(underlyingEvent.get()); 282 282 283 283 if (is<MouseEvent>(this->underlyingEvent())) { -
trunk/Source/WebCore/dom/Node.cpp
r195355 r195927 2129 2129 ASSERT_WITH_SECURITY_IMPLICATION(!NoEventDispatchAssertion::isEventDispatchForbidden()); 2130 2130 Ref<UIEvent> event = UIEvent::create(eventNames().DOMActivateEvent, true, true, document().defaultView(), detail); 2131 event->setUnderlyingEvent(underlyingEvent );2131 event->setUnderlyingEvent(underlyingEvent.get()); 2132 2132 dispatchScopedEvent(event); 2133 2133 return event->defaultHandled(); -
trunk/Source/WebCore/dom/NodeIterator.h
r195524 r195927 29 29 #include "ScriptWrappable.h" 30 30 #include "Traversal.h" 31 #include <wtf/PassRefPtr.h>32 31 #include <wtf/RefCounted.h> 33 32 -
trunk/Source/WebCore/dom/PendingScript.h
r195243 r195927 30 30 #include "CachedResourceHandle.h" 31 31 #include <wtf/text/TextPosition.h> 32 #include <wtf/PassRefPtr.h>33 32 #include <wtf/RefPtr.h> 34 33 -
trunk/Source/WebCore/dom/PopStateEvent.cpp
r191955 r195927 65 65 } 66 66 67 Ref<PopStateEvent> PopStateEvent::create( PassRefPtr<SerializedScriptValue>serializedState, PassRefPtr<History> history)67 Ref<PopStateEvent> PopStateEvent::create(RefPtr<SerializedScriptValue>&& serializedState, PassRefPtr<History> history) 68 68 { 69 return adoptRef(*new PopStateEvent( serializedState, history));69 return adoptRef(*new PopStateEvent(WTFMove(serializedState), history)); 70 70 } 71 71 -
trunk/Source/WebCore/dom/PopStateEvent.h
r186955 r195927 47 47 virtual ~PopStateEvent(); 48 48 static Ref<PopStateEvent> create(); 49 static Ref<PopStateEvent> create( PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);49 static Ref<PopStateEvent> create(RefPtr<SerializedScriptValue>&&, PassRefPtr<History>); 50 50 static Ref<PopStateEvent> create(const AtomicString&, const PopStateEventInit&); 51 51 -
trunk/Source/WebCore/dom/ProcessingInstruction.cpp
r194496 r195927 237 237 } 238 238 239 void ProcessingInstruction::setCSSStyleSheet(PassRefPtr<CSSStyleSheet> sheet)240 {241 ASSERT(!m_cachedSheet);242 ASSERT(!m_loading);243 m_sheet = sheet;244 sheet->setTitle(m_title);245 sheet->setDisabled(m_alternate);246 }247 248 239 void ProcessingInstruction::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const 249 240 { -
trunk/Source/WebCore/dom/ProcessingInstruction.h
r191955 r195927 46 46 const String& localHref() const { return m_localHref; } 47 47 StyleSheet* sheet() const { return m_sheet.get(); } 48 void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>);49 48 50 49 bool isCSS() const { return m_isCSS; } -
trunk/Source/WebCore/dom/RangeBoundaryPoint.h
r195281 r195927 34 34 class RangeBoundaryPoint { 35 35 public: 36 explicit RangeBoundaryPoint( PassRefPtr<Node>container);36 explicit RangeBoundaryPoint(Node* container); 37 37 38 38 explicit RangeBoundaryPoint(const RangeBoundaryPoint&); … … 66 66 }; 67 67 68 inline RangeBoundaryPoint::RangeBoundaryPoint( PassRefPtr<Node>container)68 inline RangeBoundaryPoint::RangeBoundaryPoint(Node* container) 69 69 : m_containerNode(container) 70 70 { -
trunk/Source/WebCore/dom/TextEvent.cpp
r194896 r195927 48 48 } 49 49 50 Ref<TextEvent> TextEvent::createForFragmentPaste(AbstractView* view, PassRefPtr<DocumentFragment>data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)50 Ref<TextEvent> TextEvent::createForFragmentPaste(AbstractView* view, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling) 51 51 { 52 return adoptRef(*new TextEvent(view, "", data, shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling));52 return adoptRef(*new TextEvent(view, emptyString(), WTFMove(data), shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling)); 53 53 } 54 54 … … 81 81 } 82 82 83 TextEvent::TextEvent(AbstractView* view, const String& data, PassRefPtr<DocumentFragment>pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)83 TextEvent::TextEvent(AbstractView* view, const String& data, RefPtr<DocumentFragment>&& pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling) 84 84 : UIEvent(eventNames().textInputEvent, true, true, view, 0) 85 85 , m_inputType(TextEventInputPaste) 86 86 , m_data(data) 87 , m_pastingFragment( pastingFragment)87 , m_pastingFragment(WTFMove(pastingFragment)) 88 88 , m_shouldSmartReplace(shouldSmartReplace) 89 89 , m_shouldMatchStyle(shouldMatchStyle) -
trunk/Source/WebCore/dom/TextEvent.h
r194896 r195927 44 44 static Ref<TextEvent> create(AbstractView*, const String& data, TextEventInputType = TextEventInputKeyboard); 45 45 static Ref<TextEvent> createForPlainTextPaste(AbstractView*, const String& data, bool shouldSmartReplace); 46 static Ref<TextEvent> createForFragmentPaste(AbstractView*, PassRefPtr<DocumentFragment>data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);46 static Ref<TextEvent> createForFragmentPaste(AbstractView*, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling); 47 47 static Ref<TextEvent> createForDrop(AbstractView*, const String& data); 48 48 static Ref<TextEvent> createForDictation(AbstractView*, const String& data, const Vector<DictationAlternative>& dictationAlternatives); … … 73 73 74 74 TextEvent(AbstractView*, const String& data, TextEventInputType = TextEventInputKeyboard); 75 TextEvent(AbstractView*, const String& data, PassRefPtr<DocumentFragment>, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);75 TextEvent(AbstractView*, const String& data, RefPtr<DocumentFragment>&&, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling); 76 76 TextEvent(AbstractView*, const String& data, const Vector<DictationAlternative>& dictationAlternatives); 77 77 -
trunk/Source/WebCore/editing/Editor.cpp
r195547 r195927 465 465 } 466 466 467 void Editor::pasteAsFragment( PassRefPtr<DocumentFragment>pastingFragment, bool smartReplace, bool matchStyle, MailBlockquoteHandling respectsMailBlockquote)467 void Editor::pasteAsFragment(Ref<DocumentFragment>&& pastingFragment, bool smartReplace, bool matchStyle, MailBlockquoteHandling respectsMailBlockquote) 468 468 { 469 469 Node* target = findEventTargetFromSelection(); 470 470 if (!target) 471 471 return; 472 target->dispatchEvent(TextEvent::createForFragmentPaste(document().domWindow(), pastingFragment, smartReplace, matchStyle, respectsMailBlockquote));472 target->dispatchEvent(TextEvent::createForFragmentPaste(document().domWindow(), WTFMove(pastingFragment), smartReplace, matchStyle, respectsMailBlockquote)); 473 473 } 474 474 -
trunk/Source/WebCore/editing/Editor.h
r195078 r195927 347 347 void dismissCorrectionPanelAsIgnored(); 348 348 349 WEBCORE_EXPORT void pasteAsFragment( PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);349 WEBCORE_EXPORT void pasteAsFragment(Ref<DocumentFragment>&&, bool smartReplace, bool matchStyle, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote); 350 350 WEBCORE_EXPORT void pasteAsPlainText(const String&, bool smartReplace); 351 351 -
trunk/Source/WebCore/editing/gtk/EditorGtk.cpp
r174676 r195927 78 78 RefPtr<DocumentFragment> fragment = createFragmentFromPasteboardData(*pasteboard, m_frame, *range, allowPlainText, chosePlainText); 79 79 if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted)) 80 pasteAsFragment(fragment , canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling);80 pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling); 81 81 } 82 82 -
trunk/Source/WebCore/editing/ios/EditorIOS.mm
r194496 r195927 547 547 548 548 if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted)) 549 pasteAsFragment(fragment , canSmartReplaceWithPasteboard(*pasteboard), false, mailBlockquoteHandling);549 pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), false, mailBlockquoteHandling); 550 550 } 551 551 … … 603 603 RefPtr<DocumentFragment> fragment = createFragmentAndAddResources(attributedString); 604 604 if (fragment && shouldInsertFragment(fragment, selectedRange(), EditorInsertActionPasted)) 605 pasteAsFragment(fragment , false, false, mailBlockquoteHandling);605 pasteAsFragment(fragment.releaseNonNull(), false, false, mailBlockquoteHandling); 606 606 } else { 607 607 String text = [attributedString string]; -
trunk/Source/WebCore/editing/mac/EditorMac.mm
r194496 r195927 97 97 98 98 if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted)) 99 pasteAsFragment(fragment , canSmartReplaceWithPasteboard(*pasteboard), false, mailBlockquoteHandling);99 pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), false, mailBlockquoteHandling); 100 100 101 101 client()->setInsertionPasteboard(String()); … … 284 284 maybeCopyNodeAttributesToFragment(*node, *fragment); 285 285 if (shouldInsertFragment(fragment, range, EditorInsertActionPasted)) 286 pasteAsFragment(fragment.release (), canSmartReplaceWithPasteboard(pasteboard), false, MailBlockquoteHandling::IgnoreBlockquote);286 pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(pasteboard), false, MailBlockquoteHandling::IgnoreBlockquote); 287 287 } 288 288 … … 674 674 RefPtr<DocumentFragment> fragment = createFragmentAndAddResources(attributedString); 675 675 if (fragment && shouldInsertFragment(fragment, selectedRange(), EditorInsertActionPasted)) 676 pasteAsFragment(fragment , false, false, mailBlockquoteHandling);676 pasteAsFragment(fragment.releaseNonNull(), false, false, mailBlockquoteHandling); 677 677 } else { 678 678 String text = [attributedString string]; -
trunk/Source/WebCore/editing/win/EditorWin.cpp
r174314 r195927 45 45 RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, *range, allowPlainText, chosePlainText); 46 46 if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted)) 47 pasteAsFragment(fragment , canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling);47 pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling); 48 48 } 49 49 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r195553 r195927 1327 1327 DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText]; 1328 1328 if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionPasted]) 1329 coreFrame->editor().pasteAsFragment( core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false);1329 coreFrame->editor().pasteAsFragment(*core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false); 1330 1330 1331 1331 [webView _setInsertionPasteboard:nil];
Note: See TracChangeset
for help on using the changeset viewer.