Title: [150127] trunk/Source/WebCore
Revision
150127
Author
[email protected]
Date
2013-05-15 10:14:19 -0700 (Wed, 15 May 2013)

Log Message

[Mac] Change Clipboard::create functions so they don't use ClipboardMac::create any more
https://bugs.webkit.org/show_bug.cgi?id=116163

Reviewed by Anders Carlsson.

* dom/Clipboard.h: Made the file drag boolean default to false, better for most callers.

* platform/mac/ClipboardMac.mm: Remove #if ENABLE(DRAG_SUPPORT); that's always on for Mac
and it's not helpful to have the conditionals in here. It's helpful in cross-platform
source files.
(WebCore::Clipboard::create): Create a Pasteboard and then create a Clipboard with new.
Later could refactor to have the Pasteboard creation be platform-specific, and make these
functions platform-independent.
(WebCore::Clipboard::createForDragAndDrop): Ditto.
(WebCore::Clipboard::createForCopyAndPaste): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150126 => 150127)


--- trunk/Source/WebCore/ChangeLog	2013-05-15 17:04:13 UTC (rev 150126)
+++ trunk/Source/WebCore/ChangeLog	2013-05-15 17:14:19 UTC (rev 150127)
@@ -1,5 +1,23 @@
 2013-05-15  Darin Adler  <[email protected]>
 
+        [Mac] Change Clipboard::create functions so they don't use ClipboardMac::create any more
+        https://bugs.webkit.org/show_bug.cgi?id=116163
+
+        Reviewed by Anders Carlsson.
+
+        * dom/Clipboard.h: Made the file drag boolean default to false, better for most callers.
+
+        * platform/mac/ClipboardMac.mm: Remove #if ENABLE(DRAG_SUPPORT); that's always on for Mac
+        and it's not helpful to have the conditionals in here. It's helpful in cross-platform
+        source files.
+        (WebCore::Clipboard::create): Create a Pasteboard and then create a Clipboard with new.
+        Later could refactor to have the Pasteboard creation be platform-specific, and make these
+        functions platform-independent.
+        (WebCore::Clipboard::createForDragAndDrop): Ditto.
+        (WebCore::Clipboard::createForCopyAndPaste): Ditto.
+
+2013-05-15  Darin Adler  <[email protected]>
+
         [Mac] Remove call to ClipboardMac::create from Editor::newGeneralClipboard
         https://bugs.webkit.org/show_bug.cgi?id=116162
 

Modified: trunk/Source/WebCore/dom/Clipboard.h (150126 => 150127)


--- trunk/Source/WebCore/dom/Clipboard.h	2013-05-15 17:04:13 UTC (rev 150126)
+++ trunk/Source/WebCore/dom/Clipboard.h	2013-05-15 17:14:19 UTC (rev 150127)
@@ -141,7 +141,7 @@
 
     protected:
 #if !USE(LEGACY_STYLE_ABSTRACT_CLIPBOARD_CLASS)
-        Clipboard(ClipboardAccessPolicy, ClipboardType, PassOwnPtr<Pasteboard>, bool forFileDrag);
+        Clipboard(ClipboardAccessPolicy, ClipboardType, PassOwnPtr<Pasteboard>, bool forFileDrag = false);
 #else
         Clipboard(ClipboardAccessPolicy, ClipboardType);
 #endif

Modified: trunk/Source/WebCore/platform/mac/ClipboardMac.mm (150126 => 150127)


--- trunk/Source/WebCore/platform/mac/ClipboardMac.mm	2013-05-15 17:04:13 UTC (rev 150126)
+++ trunk/Source/WebCore/platform/mac/ClipboardMac.mm	2013-05-15 17:14:19 UTC (rev 150127)
@@ -41,22 +41,20 @@
 
 namespace WebCore {
 
-#if ENABLE(DRAG_SUPPORT)
-PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame* frame)
+PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame*)
 {
-    return ClipboardMac::create(DragAndDrop, dragData->pasteboardName(), policy, dragData->containsFiles() ? ClipboardMac::DragAndDropFiles : ClipboardMac::DragAndDropData, frame);
+    return adoptRef(new Clipboard(policy, DragAndDrop, Pasteboard::create(dragData->pasteboardName()), dragData->containsFiles()));
 }
-#endif
 
 PassRefPtr<Clipboard> Clipboard::createForDragAndDrop()
 {
-    return ClipboardMac::create(Clipboard::DragAndDrop, NSDragPboard, ClipboardWritable, ClipboardMac::DragAndDropData, 0);
+    return adoptRef(new Clipboard(ClipboardWritable, DragAndDrop, Pasteboard::create(NSDragPboard)));
 }
 
 PassRefPtr<Clipboard> Clipboard::createForCopyAndPaste(ClipboardAccessPolicy policy)
 {
-    return ClipboardMac::create(Clipboard::CopyAndPaste,
-        policy == ClipboardWritable ? platformStrategies()->pasteboardStrategy()->uniqueName() : String(NSGeneralPboard), policy, ClipboardMac::CopyAndPasteGeneric, 0);
+    String pasteboardName = policy == ClipboardWritable ? platformStrategies()->pasteboardStrategy()->uniqueName() : String(NSGeneralPboard);
+    return adoptRef(new Clipboard(policy, CopyAndPaste, Pasteboard::create(pasteboardName)));
 }
 
 ClipboardMac::ClipboardMac(ClipboardType clipboardType, const String& pasteboardName, ClipboardAccessPolicy policy, ClipboardContents clipboardContents)
@@ -64,14 +62,12 @@
 {
 }
 
-#if ENABLE(DRAG_SUPPORT)
 void Clipboard::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame)
 {
     ASSERT(frame);
     if (Page* page = frame->page())
         page->dragController()->client()->declareAndWriteDragImage(m_pasteboard->name(), kit(element), url, title, frame);
 }
-#endif
     
 DragImageRef Clipboard::createDragImage(IntPoint& location) const
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to