Title: [235448] trunk/Source
Revision
235448
Author
wenson_hs...@apple.com
Date
2018-08-28 16:28:19 -0700 (Tue, 28 Aug 2018)

Log Message

Work towards: [iOS] Consolidate the implementations of readString, stringForType, and readURL in PlatformPasteboardIOS.mm
https://bugs.webkit.org/show_bug.cgi?id=189054

Reviewed by Andy Estes.

Source/WebCore:

Remove the pasteboard type argument from PlatformPasteboard::readURL(). Currently, we only ever pass it
"public.url" anyways; for reading other types of strings, readString() already exists, which takes an arbitrary
pasteboard type.

* platform/PasteboardStrategy.h:
* platform/PlatformPasteboard.h:
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::readPasteboardWebContentDataForType):
(WebCore::Pasteboard::readPlatformValueAsString):
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::readURL):

Source/WebKit:

Remove the pasteboard type argument from readURLFromPasteboard.

* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::readURLFromPasteboard):
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::readURLFromPasteboard):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

Source/WebKitLegacy/mac:

Remove the pasteboard type argument from readURLFromPasteboard.

* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::readURLFromPasteboard):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (235447 => 235448)


--- trunk/Source/WebCore/ChangeLog	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebCore/ChangeLog	2018-08-28 23:28:19 UTC (rev 235448)
@@ -1,3 +1,22 @@
+2018-08-28  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Work towards: [iOS] Consolidate the implementations of readString, stringForType, and readURL in PlatformPasteboardIOS.mm
+        https://bugs.webkit.org/show_bug.cgi?id=189054
+
+        Reviewed by Andy Estes.
+
+        Remove the pasteboard type argument from PlatformPasteboard::readURL(). Currently, we only ever pass it
+        "public.url" anyways; for reading other types of strings, readString() already exists, which takes an arbitrary
+        pasteboard type.
+
+        * platform/PasteboardStrategy.h:
+        * platform/PlatformPasteboard.h:
+        * platform/ios/PasteboardIOS.mm:
+        (WebCore::Pasteboard::readPasteboardWebContentDataForType):
+        (WebCore::Pasteboard::readPlatformValueAsString):
+        * platform/ios/PlatformPasteboardIOS.mm:
+        (WebCore::PlatformPasteboard::readURL):
+
 2018-08-28  Youenn Fablet  <you...@apple.com>
 
         MediaDevices should be collectable as soon as its document is stopped

Modified: trunk/Source/WebCore/platform/PasteboardStrategy.h (235447 => 235448)


--- trunk/Source/WebCore/platform/PasteboardStrategy.h	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebCore/platform/PasteboardStrategy.h	2018-08-28 23:28:19 UTC (rev 235448)
@@ -50,7 +50,7 @@
     virtual int getPasteboardItemsCount(const String& pasteboardName) = 0;
     virtual String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) = 0;
     virtual RefPtr<SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) = 0;
-    virtual URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName, String& title) = 0;
+    virtual URL readURLFromPasteboard(int index, const String& pasteboardName, String& title) = 0;
     virtual Vector<PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) = 0;
     virtual PasteboardItemInfo informationForItemAtIndex(int index, const String& pasteboardName) = 0;
     virtual void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName) = 0;

Modified: trunk/Source/WebCore/platform/PlatformPasteboard.h (235447 => 235448)


--- trunk/Source/WebCore/platform/PlatformPasteboard.h	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebCore/platform/PlatformPasteboard.h	2018-08-28 23:28:19 UTC (rev 235448)
@@ -93,7 +93,7 @@
     WEBCORE_EXPORT void write(const PasteboardURL&);
     WEBCORE_EXPORT RefPtr<SharedBuffer> readBuffer(int index, const String& pasteboardType);
     WEBCORE_EXPORT String readString(int index, const String& pasteboardType);
-    WEBCORE_EXPORT URL readURL(int index, const String& pasteboardType, String& title);
+    WEBCORE_EXPORT URL readURL(int index, String& title);
     WEBCORE_EXPORT int count();
     WEBCORE_EXPORT int numberOfFiles() const;
 

Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (235447 => 235448)


--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm	2018-08-28 23:28:19 UTC (rev 235448)
@@ -219,7 +219,7 @@
 
     if ([type isEqualToString:(NSString *)kUTTypeURL]) {
         String title;
-        URL url = "" kUTTypeURL, m_pasteboardName, title);
+        URL url = "" m_pasteboardName, title);
         if (m_changeCount != changeCount())
             return ReaderResult::PasteboardWasChangedExternally;
         return !url.isNull() && reader.readURL(url, title) ? ReaderResult::ReadType : ReaderResult::DidNotReadType;
@@ -389,7 +389,7 @@
 
     if ([cocoaType isEqualToString:(NSString *)kUTTypeURL]) {
         String title;
-        URL url = "" kUTTypeURL, pasteboardName, title);
+        URL url = "" pasteboardName, title);
         if (!url.isNull())
             cocoaValue = [(NSURL *)url absoluteString];
     } else if ([cocoaType isEqualToString:(NSString *)kUTTypePlainText]) {

Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (235447 => 235448)


--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2018-08-28 23:28:19 UTC (rev 235448)
@@ -660,10 +660,10 @@
     return String();
 }
 
-URL PlatformPasteboard::readURL(int index, const String& type, String& title)
+URL PlatformPasteboard::readURL(int index, String& title)
 {
     NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:index];
-    RetainPtr<NSArray> pasteboardItem = [m_pasteboard valuesForPasteboardType:type inItemSet:indexSet];
+    RetainPtr<NSArray> pasteboardItem = [m_pasteboard valuesForPasteboardType:(__bridge NSString *)kUTTypeURL inItemSet:indexSet];
 
     if (![pasteboardItem count])
         return { };

Modified: trunk/Source/WebKit/ChangeLog (235447 => 235448)


--- trunk/Source/WebKit/ChangeLog	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKit/ChangeLog	2018-08-28 23:28:19 UTC (rev 235448)
@@ -1,3 +1,20 @@
+2018-08-28  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Work towards: [iOS] Consolidate the implementations of readString, stringForType, and readURL in PlatformPasteboardIOS.mm
+        https://bugs.webkit.org/show_bug.cgi?id=189054
+
+        Reviewed by Andy Estes.
+
+        Remove the pasteboard type argument from readURLFromPasteboard.
+
+        * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
+        (WebKit::WebPasteboardProxy::readURLFromPasteboard):
+        * UIProcess/WebPasteboardProxy.h:
+        * UIProcess/WebPasteboardProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::readURLFromPasteboard):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
 2018-08-28  Alex Christensen  <achristen...@webkit.org>
 
         Remove assertion introduced in r235413

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (235447 => 235448)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm	2018-08-28 23:28:19 UTC (rev 235448)
@@ -204,9 +204,9 @@
     value = PlatformPasteboard(pasteboardName).readString(index, pasteboardType);
 }
 
-void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String& url, String& title)
+void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardName, String& url, String& title)
 {
-    url = "" pasteboardType, title);
+    url = "" title);
 }
 
 void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle& handle, uint64_t& size)

Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h (235447 => 235448)


--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h	2018-08-28 23:28:19 UTC (rev 235448)
@@ -75,7 +75,7 @@
     void writeImageToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName);
     void writeStringToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName);
     void readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String&);
-    void readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String& url, String& title);
+    void readURLFromPasteboard(uint64_t index, const String& pasteboardName, String& url, String& title);
     void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle&, uint64_t& size);
     void getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount);
     void allPasteboardItemInfo(const String& pasteboardName, Vector<WebCore::PasteboardItemInfo>&);

Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in (235447 => 235448)


--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in	2018-08-28 23:28:19 UTC (rev 235448)
@@ -27,7 +27,7 @@
     WriteImageToPasteboard(struct WebCore::PasteboardImage pasteboardImage, String pasteboardName)
     WriteStringToPasteboard(String pasteboardType, String text, String pasteboardName)
     ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string)
-    ReadURLFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String url, String title)
+    ReadURLFromPasteboard(uint64_t index, String pasteboardName) -> (String url, String title)
     ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size)
     GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount)
     AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (235447 => 235448)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2018-08-28 23:28:19 UTC (rev 235448)
@@ -357,10 +357,10 @@
     return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
 }
 
-WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName, String& title)
+WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardName, String& title)
 {
     String urlString;
-    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString, title), 0);
+    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardName), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString, title), 0);
     return URL(ParsedURLString, urlString);
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h (235447 => 235448)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2018-08-28 23:28:19 UTC (rev 235448)
@@ -64,7 +64,7 @@
     int getPasteboardItemsCount(const String& pasteboardName) override;
     String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
     RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
-    WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName, String& title) override;
+    WebCore::URL readURLFromPasteboard(int index, const String& pasteboardName, String& title) override;
     Vector<WebCore::PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) override;
     WebCore::PasteboardItemInfo informationForItemAtIndex(int index, const String& pasteboardName) override;
     void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName) override;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (235447 => 235448)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-08-28 23:28:19 UTC (rev 235448)
@@ -1,3 +1,16 @@
+2018-08-28  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Work towards: [iOS] Consolidate the implementations of readString, stringForType, and readURL in PlatformPasteboardIOS.mm
+        https://bugs.webkit.org/show_bug.cgi?id=189054
+
+        Reviewed by Andy Estes.
+
+        Remove the pasteboard type argument from readURLFromPasteboard.
+
+        * WebCoreSupport/WebPlatformStrategies.h:
+        * WebCoreSupport/WebPlatformStrategies.mm:
+        (WebPlatformStrategies::readURLFromPasteboard):
+
 2018-08-27  Keith Rollin  <krol...@apple.com>
 
         Unreviewed build fix -- disable LTO for production builds

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h (235447 => 235448)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h	2018-08-28 23:28:19 UTC (rev 235448)
@@ -65,7 +65,7 @@
     int getPasteboardItemsCount(const String& pasteboardName) override;
     String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
     RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
-    WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName, String& title) override;
+    WebCore::URL readURLFromPasteboard(int index, const String& pasteboardName, String& title) override;
     Vector<WebCore::PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) override;
     WebCore::PasteboardItemInfo informationForItemAtIndex(int index, const String& pasteboardName) override;
     void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName) override;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (235447 => 235448)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm	2018-08-28 23:26:58 UTC (rev 235447)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm	2018-08-28 23:28:19 UTC (rev 235448)
@@ -234,9 +234,9 @@
     return PlatformPasteboard(pasteboardName).readBuffer(index, type);
 }
 
-WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& type, const String& pasteboardName, String& title)
+WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardName, String& title)
 {
-    return PlatformPasteboard(pasteboardName).readURL(index, type, title);
+    return PlatformPasteboard(pasteboardName).readURL(index, title);
 }
 
 String WebPlatformStrategies::readStringFromPasteboard(int index, const String& type, const String& pasteboardName)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to