Title: [154712] trunk/Source/WebCore
Revision
154712
Author
[email protected]
Date
2013-08-27 15:25:19 -0700 (Tue, 27 Aug 2013)

Log Message

No need for generalPasteboard (aside from "global selection mode")
https://bugs.webkit.org/show_bug.cgi?id=120367

Reviewed by Alexey Proskuryakov.

* editing/Editor.cpp:
(WebCore::Editor::pasteAsPlainTextBypassingDHTML):
(WebCore::Editor::dispatchCPPEvent):
(WebCore::Editor::cut):
(WebCore::Editor::copy):
(WebCore::Editor::paste):
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::copyURL):
(WebCore::Editor::copyImage):
Use Pasteboard::createForCopyAndPaste rather than the single general pasteboard
for editing operations.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154711 => 154712)


--- trunk/Source/WebCore/ChangeLog	2013-08-27 22:23:16 UTC (rev 154711)
+++ trunk/Source/WebCore/ChangeLog	2013-08-27 22:25:19 UTC (rev 154712)
@@ -1,3 +1,22 @@
+2013-08-27  Darin Adler  <[email protected]>
+
+        No need for generalPasteboard (aside from "global selection mode")
+        https://bugs.webkit.org/show_bug.cgi?id=120367
+
+        Reviewed by Alexey Proskuryakov.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::pasteAsPlainTextBypassingDHTML):
+        (WebCore::Editor::dispatchCPPEvent):
+        (WebCore::Editor::cut):
+        (WebCore::Editor::copy):
+        (WebCore::Editor::paste):
+        (WebCore::Editor::pasteAsPlainText):
+        (WebCore::Editor::copyURL):
+        (WebCore::Editor::copyImage):
+        Use Pasteboard::createForCopyAndPaste rather than the single general pasteboard
+        for editing operations.
+
 2013-08-27  Chris Fleizach  <[email protected]>
 
         <https://webkit.org/b/120117> AX: <noscript> contents are exposed as static text

Modified: trunk/Source/WebCore/editing/Editor.cpp (154711 => 154712)


--- trunk/Source/WebCore/editing/Editor.cpp	2013-08-27 22:23:16 UTC (rev 154711)
+++ trunk/Source/WebCore/editing/Editor.cpp	2013-08-27 22:25:19 UTC (rev 154712)
@@ -414,7 +414,7 @@
 
 void Editor::pasteAsPlainTextBypassingDHTML()
 {
-    pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
+    pasteAsPlainTextWithPasteboard(Pasteboard::createForCopyAndPaste().get());
 }
 
 void Editor::pasteAsPlainTextWithPasteboard(Pasteboard* pasteboard)
@@ -706,7 +706,7 @@
     target->dispatchEvent(event, IGNORE_EXCEPTION);
     bool noDefaultProcessing = event->defaultPrevented();
     if (noDefaultProcessing && policy == ClipboardWritable) {
-        Pasteboard* pasteboard = Pasteboard::generalPasteboard();
+        OwnPtr<Pasteboard> pasteboard = Pasteboard::createForCopyAndPaste();
         pasteboard->clear();
         pasteboard->writePasteboard(clipboard->pasteboard());
     }
@@ -1041,10 +1041,10 @@
     if (shouldDeleteRange(selection.get())) {
         updateMarkersForWordsAffectedByEditing(true);
         if (enclosingTextFormControl(m_frame.selection().start())) {
-            Pasteboard::generalPasteboard()->writePlainText(selectedTextForClipboard(),
+            Pasteboard::createForCopyAndPaste()->writePlainText(selectedTextForClipboard(),
                 canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace : Pasteboard::CannotSmartReplace);
         } else
-            Pasteboard::generalPasteboard()->writeSelection(selection.get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
+            Pasteboard::createForCopyAndPaste()->writeSelection(selection.get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
         didWriteSelectionToPasteboard();
         deleteSelectionWithSmartDelete(canSmartCopyOrDelete());
     }
@@ -1061,14 +1061,14 @@
 
     willWriteSelectionToPasteboard(selectedRange());
     if (enclosingTextFormControl(m_frame.selection().start())) {
-        Pasteboard::generalPasteboard()->writePlainText(selectedTextForClipboard(),
+        Pasteboard::createForCopyAndPaste()->writePlainText(selectedTextForClipboard(),
             canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace : Pasteboard::CannotSmartReplace);
     } else {
         Document* document = m_frame.document();
         if (HTMLImageElement* imageElement = imageElementFromImageDocument(document))
-            Pasteboard::generalPasteboard()->writeImage(imageElement, document->url(), document->title());
+            Pasteboard::createForCopyAndPaste()->writeImage(imageElement, document->url(), document->title());
         else
-            Pasteboard::generalPasteboard()->writeSelection(selectedRange().get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
+            Pasteboard::createForCopyAndPaste()->writeSelection(selectedRange().get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
     }
 
     didWriteSelectionToPasteboard();
@@ -1085,9 +1085,9 @@
     CachedResourceLoader* loader = m_frame.document()->cachedResourceLoader();
     ResourceCacheValidationSuppressor validationSuppressor(loader);
     if (m_frame.selection().isContentRichlyEditable())
-        pasteWithPasteboard(Pasteboard::generalPasteboard(), true);
+        pasteWithPasteboard(Pasteboard::createForCopyAndPaste().get(), true);
     else
-        pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
+        pasteAsPlainTextWithPasteboard(Pasteboard::createForCopyAndPaste().get());
 }
 
 void Editor::pasteAsPlainText()
@@ -1097,7 +1097,7 @@
     if (!canPaste())
         return;
     updateMarkersForWordsAffectedByEditing(false);
-    pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
+    pasteAsPlainTextWithPasteboard(Pasteboard::createForCopyAndPaste().get());
 }
 
 void Editor::performDelete()
@@ -1135,7 +1135,7 @@
 
 void Editor::copyURL(const KURL& url, const String& title)
 {
-    Pasteboard::generalPasteboard()->writeURL(url, title, &m_frame);
+    Pasteboard::createForCopyAndPaste()->writeURL(url, title, &m_frame);
 }
 
 void Editor::copyImage(const HitTestResult& result)
@@ -1144,7 +1144,7 @@
     if (url.isEmpty())
         url = ""
 
-    Pasteboard::generalPasteboard()->writeImage(result.innerNonSharedNode(), url, result.altDisplayString());
+    Pasteboard::createForCopyAndPaste()->writeImage(result.innerNonSharedNode(), url, result.altDisplayString());
 }
 
 bool Editor::isContinuousSpellCheckingEnabled() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to