Title: [149976] trunk/Source/WebCore
Revision
149976
Author
[email protected]
Date
2013-05-12 19:28:16 -0700 (Sun, 12 May 2013)

Log Message

[Mac] Move hasData from ClipboardMac to PasteboardMac
https://bugs.webkit.org/show_bug.cgi?id=115999

Reviewed by Andreas Kling.

* dom/Clipboard.cpp:
(WebCore::Clipboard::hasData): Added. Calls through to Pasteboard.

* dom/Clipboard.h: Added LEGACY_VIRTUAL and LEGACY_PURE macros,
only for within this header file. These help us keep many functions
as pure virtual in the legacy style Clipboard class, but have them
be non-virtual in the normal/future style. Use LEGACY_VIRTUAL and
LEGACY_PURE to make the hasData member non-virtual.

* platform/Pasteboard.h: Added hasData, and added some blank lines and a FIXME.

* platform/mac/ClipboardMac.h: Removed hasData override.
* platform/mac/ClipboardMac.mm: Ditto.

* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::hasData): Added. Moved code here from ClipboardMac.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149975 => 149976)


--- trunk/Source/WebCore/ChangeLog	2013-05-13 02:14:42 UTC (rev 149975)
+++ trunk/Source/WebCore/ChangeLog	2013-05-13 02:28:16 UTC (rev 149976)
@@ -1,3 +1,27 @@
+2013-05-12  Darin Adler  <[email protected]>
+
+        [Mac] Move hasData from ClipboardMac to PasteboardMac
+        https://bugs.webkit.org/show_bug.cgi?id=115999
+
+        Reviewed by Andreas Kling.
+
+        * dom/Clipboard.cpp:
+        (WebCore::Clipboard::hasData): Added. Calls through to Pasteboard.
+
+        * dom/Clipboard.h: Added LEGACY_VIRTUAL and LEGACY_PURE macros,
+        only for within this header file. These help us keep many functions
+        as pure virtual in the legacy style Clipboard class, but have them
+        be non-virtual in the normal/future style. Use LEGACY_VIRTUAL and
+        LEGACY_PURE to make the hasData member non-virtual.
+
+        * platform/Pasteboard.h: Added hasData, and added some blank lines and a FIXME.
+
+        * platform/mac/ClipboardMac.h: Removed hasData override.
+        * platform/mac/ClipboardMac.mm: Ditto.
+
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::Pasteboard::hasData): Added. Moved code here from ClipboardMac.
+
 2013-05-12  David Kilzer  <[email protected]>
 
         BUILD FIX (r149971): sudden termination is a Mac-only concept

Modified: trunk/Source/WebCore/dom/Clipboard.cpp (149975 => 149976)


--- trunk/Source/WebCore/dom/Clipboard.cpp	2013-05-13 02:14:42 UTC (rev 149975)
+++ trunk/Source/WebCore/dom/Clipboard.cpp	2013-05-13 02:28:16 UTC (rev 149976)
@@ -251,4 +251,13 @@
     return false;
 }
 
+#if !USE(LEGACY_STYLE_ABSTRACT_CLIPBOARD_CLASS)
+
+bool Clipboard::hasData()
+{
+    return m_pasteboard->hasData();
+}
+
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/Clipboard.h (149975 => 149976)


--- trunk/Source/WebCore/dom/Clipboard.h	2013-05-13 02:14:42 UTC (rev 149975)
+++ trunk/Source/WebCore/dom/Clipboard.h	2013-05-13 02:28:16 UTC (rev 149976)
@@ -36,6 +36,18 @@
 // uses this as an abstract base class.
 #define WTF_USE_LEGACY_STYLE_ABSTRACT_CLIPBOARD_CLASS !PLATFORM(MAC)
 
+#if USE(LEGACY_STYLE_ABSTRACT_CLIPBOARD_CLASS)
+#define LEGACY_VIRTUAL virtual
+#else
+#define LEGACY_VIRTUAL
+#endif
+
+#if USE(LEGACY_STYLE_ABSTRACT_CLIPBOARD_CLASS)
+#define LEGACY_PURE = 0
+#else
+#define LEGACY_PURE
+#endif
+
 namespace WebCore {
 
     class CachedImage;
@@ -90,8 +102,8 @@
         virtual void writeRange(Range*, Frame*) = 0;
         virtual void writePlainText(const String&) = 0;
 
-        virtual bool hasData() = 0;
-        
+        LEGACY_VIRTUAL bool hasData() LEGACY_PURE;
+
         void setAccessPolicy(ClipboardAccessPolicy);
         bool canReadTypes() const;
         bool canReadData() const;
@@ -148,7 +160,10 @@
 
     DragOperation convertDropZoneOperationToDragOperation(const String& dragOperation);
     String convertDragOperationToDropZoneOperation(DragOperation);
-    
+
+#undef LEGACY_VIRTUAL
+#undef LEGACY_PURE
+
 } // namespace WebCore
 
 #endif // Clipboard_h

Modified: trunk/Source/WebCore/platform/Pasteboard.h (149975 => 149976)


--- trunk/Source/WebCore/platform/Pasteboard.h	2013-05-13 02:14:42 UTC (rev 149975)
+++ trunk/Source/WebCore/platform/Pasteboard.h	2013-05-13 02:28:16 UTC (rev 149976)
@@ -94,13 +94,21 @@
 #endif
     
     static Pasteboard* generalPasteboard();
+
+    bool hasData();
+
     void writeSelection(Range*, bool canSmartCopyOrDelete, Frame*, ShouldSerializeSelectedTextForClipboard = DefaultSelectedTextType);
     void writePlainText(const String&, SmartReplaceOption);
     void writeURL(const KURL&, const String&, Frame* = 0);
     void writeImage(Node*, const KURL&, const String& title);
     void writeClipboard(Clipboard*);
+
     void clear();
+
     bool canSmartReplace();
+
+    // FIXME: Having these functions here is a layering violation.
+    // These functions need to move to the editing directory even if they have platform-specific aspects.
     PassRefPtr<DocumentFragment> documentFragment(Frame*, PassRefPtr<Range>, bool allowPlainText, bool& chosePlainText);
     String plainText(Frame* = 0);
     

Modified: trunk/Source/WebCore/platform/mac/ClipboardMac.h (149975 => 149976)


--- trunk/Source/WebCore/platform/mac/ClipboardMac.h	2013-05-13 02:14:42 UTC (rev 149975)
+++ trunk/Source/WebCore/platform/mac/ClipboardMac.h	2013-05-13 02:28:16 UTC (rev 149976)
@@ -58,8 +58,6 @@
     String getData(const String& type) const;
     bool setData(const String& type, const String& data);
     
-    virtual bool hasData();
-    
     // extensions beyond IE's API
     virtual ListHashSet<String> types() const;
     virtual PassRefPtr<FileList> files() const;

Modified: trunk/Source/WebCore/platform/mac/ClipboardMac.mm (149975 => 149976)


--- trunk/Source/WebCore/platform/mac/ClipboardMac.mm	2013-05-13 02:14:42 UTC (rev 149975)
+++ trunk/Source/WebCore/platform/mac/ClipboardMac.mm	2013-05-13 02:28:16 UTC (rev 149976)
@@ -70,13 +70,6 @@
         m_dragImage->removeClient(this);
 }
 
-bool ClipboardMac::hasData()
-{
-    Vector<String> types;
-    platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
-    return !types.isEmpty();
-}
-    
 static String cocoaTypeFromHTMLClipboardType(const String& type)
 {
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-datatransfer-setdata

Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (149975 => 149976)


--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm	2013-05-13 02:14:42 UTC (rev 149975)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm	2013-05-13 02:28:16 UTC (rev 149976)
@@ -589,4 +589,11 @@
     return 0;
 }
 
+bool Pasteboard::hasData()
+{
+    Vector<String> types;
+    platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
+    return !types.isEmpty();
 }
+
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to