Title: [154231] trunk/Source/WebCore
Revision
154231
Author
[email protected]
Date
2013-08-17 08:32:51 -0700 (Sat, 17 Aug 2013)

Log Message

<https://webkit.org/b/119948> Change drag-specific clipboard writing in DragController to go straight to Pasteboard, not forward through Clipboard

Reviewed by Andreas Kling.

* dom/Clipboard.cpp: Removed writeRange, writePlainText, and writeURL functions.
All three are just unneeded forwarding to pasteboard.
* dom/Clipboard.h: Ditto.

* page/DragController.cpp:
(WebCore::DragController::startDrag): Move the logic in here. Later we might
want to straighten this out a bit, perhaps using functions in Editor, but it's
not much code so fine to just have it here for now.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154230 => 154231)


--- trunk/Source/WebCore/ChangeLog	2013-08-17 15:21:00 UTC (rev 154230)
+++ trunk/Source/WebCore/ChangeLog	2013-08-17 15:32:51 UTC (rev 154231)
@@ -1,5 +1,20 @@
 2013-08-17  Darin Adler  <[email protected]>
 
+        <https://webkit.org/b/119948> Change drag-specific clipboard writing in DragController to go straight to Pasteboard, not forward through Clipboard
+
+        Reviewed by Andreas Kling.
+
+        * dom/Clipboard.cpp: Removed writeRange, writePlainText, and writeURL functions.
+        All three are just unneeded forwarding to pasteboard.
+        * dom/Clipboard.h: Ditto.
+
+        * page/DragController.cpp:
+        (WebCore::DragController::startDrag): Move the logic in here. Later we might
+        want to straighten this out a bit, perhaps using functions in Editor, but it's
+        not much code so fine to just have it here for now.
+
+2013-08-17  Darin Adler  <[email protected]>
+
         <https://webkit.org/b/119947> Remove LEGACY_STYLE_ABSTRACT_CLIPBOARD_CLASS
 
         Reviewed by Andreas Kling.

Modified: trunk/Source/WebCore/dom/Clipboard.cpp (154230 => 154231)


--- trunk/Source/WebCore/dom/Clipboard.cpp	2013-08-17 15:21:00 UTC (rev 154230)
+++ trunk/Source/WebCore/dom/Clipboard.cpp	2013-08-17 15:32:51 UTC (rev 154231)
@@ -366,29 +366,6 @@
     m_clipboard->updateDragImage();
 }
 
-void Clipboard::writeRange(Range* range, Frame* frame)
-{
-    ASSERT(range);
-    ASSERT(frame);
-    // FIXME: This is a design mistake, a layering violation that should be fixed.
-    // The code to write the range to a pasteboard should be an Editor function that takes a pasteboard argument.
-    // FIXME: The frame argument seems redundant, since a Range is in a particular document, which has a corresponding frame.
-    m_pasteboard->writeSelection(range, frame->editor().smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame, IncludeImageAltTextForClipboard);
-}
-
-void Clipboard::writePlainText(const String& text)
-{
-    m_pasteboard->writePlainText(text, Pasteboard::CannotSmartReplace);
-}
-
-void Clipboard::writeURL(const KURL& url, const String& title, Frame* frame)
-{
-    ASSERT(frame);
-    // FIXME: This is a design mistake, a layering violation that should be fixed.
-    // The pasteboard writeURL function should not take a frame argument, nor does this function need a frame.
-    m_pasteboard->writeURL(url, title, frame);
-}
-
 #endif // ENABLE(DRAG_SUPPORT)
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/Clipboard.h (154230 => 154231)


--- trunk/Source/WebCore/dom/Clipboard.h	2013-08-17 15:21:00 UTC (rev 154230)
+++ trunk/Source/WebCore/dom/Clipboard.h	2013-08-17 15:32:51 UTC (rev 154231)
@@ -79,9 +79,6 @@
         Node* dragImageElement() const { return m_dragImageElement.get(); }
         
         DragImageRef createDragImage(IntPoint& dragLocation) const;
-        void writeURL(const KURL&, const String&, Frame*);
-        void writeRange(Range*, Frame*);
-        void writePlainText(const String&);
 
         bool hasData();
 

Modified: trunk/Source/WebCore/page/DragController.cpp (154230 => 154231)


--- trunk/Source/WebCore/page/DragController.cpp	2013-08-17 15:21:00 UTC (rev 154230)
+++ trunk/Source/WebCore/page/DragController.cpp	2013-08-17 15:32:51 UTC (rev 154231)
@@ -61,6 +61,7 @@
 #include "ImageOrientation.h"
 #include "MoveSelectionCommand.h"
 #include "Page.h"
+#include "Pasteboard.h"
 #include "PlatformKeyboardEvent.h"
 #include "PluginDocument.h"
 #include "PluginViewBase.h"
@@ -792,9 +793,11 @@
             src->editor().willWriteSelectionToPasteboard(selectionRange.get());
 
             if (enclosingTextFormControl(src->selection()->start()))
-                clipboard->writePlainText(src->editor().selectedTextForClipboard());
-            else
-                clipboard->writeRange(selectionRange.get(), src);
+                clipboard->pasteboard().writePlainText(src->editor().selectedTextForClipboard(), Pasteboard::CannotSmartReplace);
+            else {
+                // FIXME: Could this instead be a helper function in Editor?
+                clipboard->pasteboard().writeSelection(selectionRange.get(), src->editor().smartInsertDeleteEnabled() && src->selection()->granularity() == WordGranularity, src, IncludeImageAltTextForClipboard);
+            }
 
             src->editor().didWriteSelectionToPasteboard();
         }
@@ -830,7 +833,7 @@
         if (!clipboard->hasData())
             // Simplify whitespace so the title put on the clipboard resembles what the user sees
             // on the web page. This includes replacing newlines with spaces.
-            clipboard->writeURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace(), src);
+            clipboard->pasteboard().writeURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace(), src);
 
         if (src->selection()->isCaret() && src->selection()->isContentEditable()) {
             // a user can initiate a drag on a link without having any text
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to