Diff
Modified: trunk/Source/WebCore/ChangeLog (250949 => 250950)
--- trunk/Source/WebCore/ChangeLog 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/ChangeLog 2019-10-10 01:27:14 UTC (rev 250950)
@@ -1,3 +1,100 @@
+2019-10-09 Wenson Hsieh <[email protected]>
+
+ [Clipboard API] Refactor Pasteboard item reading functions to work on both iOS and macOS
+ https://bugs.webkit.org/show_bug.cgi?id=202647
+
+ Reviewed by Tim Horton.
+
+ Moves some pasteboard helper functions out of iOS-specific code, and into platform-agnostic code. See below for
+ more details. There is no change in behavior, as nothing exercises these new pasteboard functions on macOS yet.
+
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/Pasteboard.cpp:
+ (WebCore::Pasteboard::allPasteboardItemInfo const):
+ (WebCore::Pasteboard::pasteboardItemInfo const):
+ (WebCore::Pasteboard::readString):
+ (WebCore::Pasteboard::readBuffer):
+ (WebCore::Pasteboard::readURL):
+
+ Add some new helpers on Pasteboard to read Strings, data, and URLs from the platform pasteboard. These forward
+ to the platform strategy which, in WebKit2, are currently implemented using sync IPC, but could be changed in
+ the future to be fully asynchronous.
+
+ * platform/Pasteboard.h:
+ (WebCore::Pasteboard::name const):
+
+ Expose a cross-platform name() getter on Pasteboard. On non-Cocoa platforms, this simply returns the empty
+ string, but on macOS and iOS, this returns the platform pasteboard name, which is stored in m_pasteboardName.
+
+ * platform/PasteboardItemInfo.h:
+ (WebCore::PasteboardItemInfo::pathForContentType const):
+ (WebCore::PasteboardItemInfo::contentTypeForHighestFidelityItem const):
+ (WebCore::PasteboardItemInfo::encode const):
+ (WebCore::PasteboardItemInfo::decode):
+
+ Adds a couple of new members to PasteboardItemInfo (which represents metadata about a given item in the platform
+ pasteboard). These are changeCount (which is self explanatory), and webSafeTypesByFidelity, which is a list of
+ types in fidelity order which contains the list of pasteboard types that are safe to expose to bindings. These
+ may include types such as "text/plain", "text/html", "text/uri-list", and "image/png".
+
+ To distinguish this list from the existing contentTypesByFidelity list, I've also renamed contentTypesByFidelity
+ to platformTypesByFidelity, to make it more obvious that this other list of types are platform-specific, and not
+ generally safe to expose to the web.
+
+ * platform/PasteboardStrategy.h:
+ * platform/PlatformPasteboard.h:
+
+ Move several helpers out into platform-agnostic code.
+
+ * platform/cocoa/PasteboardCocoa.mm:
+ (WebCore::Pasteboard::fileContentState):
+ * platform/cocoa/PlatformPasteboardCocoa.mm: Added.
+
+ Add a new file to contain the implementation of PlatformPasteboard::allPasteboardItemInfo, which is the same
+ across Cocoa platforms.
+
+ (WebCore::PlatformPasteboard::allPasteboardItemInfo):
+ * platform/ios/PasteboardIOS.mm:
+ (WebCore::Pasteboard::readRespectingUTIFidelities):
+ * platform/ios/PlatformPasteboardIOS.mm:
+ (WebCore::PlatformPasteboard::informationForItemAtIndex):
+ (WebCore::PlatformPasteboard::readBuffer const):
+ (WebCore::PlatformPasteboard::readString const):
+ (WebCore::PlatformPasteboard::readURL const):
+
+ Additionally refactor all methods on PlatformPasteboard that take pasteboard item indices as signed integers
+ (`int`) to receive `size_t` values instead.
+
+ (WebCore::PlatformPasteboard::allPasteboardItemInfo): Deleted.
+ * platform/libwpe/PasteboardLibWPE.cpp:
+ (WebCore::Pasteboard::readString):
+ (WebCore::Pasteboard::read):
+ * platform/libwpe/PlatformPasteboardLibWPE.cpp:
+ (WebCore::PlatformPasteboard::readString const):
+
+ Add an implementation stub for WPE.
+
+ * platform/mac/PlatformPasteboardMac.mm:
+ (WebCore::modernPasteboardTypeForWebSafeMIMEType):
+ (WebCore::webSafeMIMETypeForModernPasteboardType):
+
+ Add helpers to convert between modern NSPasteboardTypes and web-safe types. While some logic exists today on
+ macOS to convert between legacy pasteboard types and web-safe types, conversion between the modern pasteboard
+ types and web-safe types are needed since NSPasteboardItem's types only support NSPasteboardTypes and
+ dynamically declared types that match the format of a universal type identfier (for instance, "com.foo.bar").
+
+ (WebCore::PlatformPasteboard::readBuffer const):
+ (WebCore::PlatformPasteboard::readString const):
+ (WebCore::PlatformPasteboard::readURL const):
+ (WebCore::PlatformPasteboard::count const):
+ (WebCore::PlatformPasteboard::informationForItemAtIndex):
+
+ Implement all of these helpers by looking up the NSPasteboardItem at the given item index and querying it for
+ data for non-legacy pasteboard types.
+
+ (WebCore::PlatformPasteboard::itemAtIndex const):
+
2019-10-09 Daniel Bates <[email protected]>
Add support for CompactPointerTuple<..., OptionSet<...>>
Modified: trunk/Source/WebCore/SourcesCocoa.txt (250949 => 250950)
--- trunk/Source/WebCore/SourcesCocoa.txt 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2019-10-10 01:27:14 UTC (rev 250950)
@@ -198,6 +198,7 @@
platform/cocoa/NetworkExtensionContentFilter.mm
platform/cocoa/ParentalControlsContentFilter.mm
platform/cocoa/PasteboardCocoa.mm
+platform/cocoa/PlatformPasteboardCocoa.mm
platform/cocoa/PlaybackSessionModelMediaElement.mm
platform/cocoa/RuntimeApplicationChecksCocoa.mm
platform/cocoa/ScrollController.mm
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (250949 => 250950)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-10-10 01:27:14 UTC (rev 250950)
@@ -15205,6 +15205,7 @@
F44EBBDA1DB5DD9D00277334 /* StaticRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticRange.cpp; sourceTree = "<group>"; };
F45C231B1995B73B00A6E2E3 /* AxisScrollSnapOffsets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AxisScrollSnapOffsets.cpp; sourceTree = "<group>"; };
F45C231C1995B73B00A6E2E3 /* AxisScrollSnapOffsets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AxisScrollSnapOffsets.h; sourceTree = "<group>"; };
+ F4628A9E234D3BBF00BC884C /* PlatformPasteboardCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformPasteboardCocoa.mm; sourceTree = "<group>"; };
F46729251E0DE5AB00ACC3D8 /* ScrollSnapOffsetsInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollSnapOffsetsInfo.h; sourceTree = "<group>"; };
F478755219983AFF0024A287 /* ScrollSnapAnimatorState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollSnapAnimatorState.h; sourceTree = "<group>"; };
F478755319983AFF0024A287 /* ScrollSnapAnimatorState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollSnapAnimatorState.mm; sourceTree = "<group>"; };
@@ -22727,6 +22728,7 @@
A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */,
A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */,
9BED2CAF1F7CC06200666018 /* PasteboardCocoa.mm */,
+ F4628A9E234D3BBF00BC884C /* PlatformPasteboardCocoa.mm */,
52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */,
CDA29A081CBD99F400901CCF /* PlaybackSessionInterface.h */,
CDA29A0A1CBD9A7400901CCF /* PlaybackSessionModel.h */,
Modified: trunk/Source/WebCore/platform/Pasteboard.cpp (250949 => 250950)
--- trunk/Source/WebCore/platform/Pasteboard.cpp 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/Pasteboard.cpp 2019-10-10 01:27:14 UTC (rev 250950)
@@ -98,4 +98,29 @@
#endif
+Vector<PasteboardItemInfo> Pasteboard::allPasteboardItemInfo() const
+{
+ return platformStrategies()->pasteboardStrategy()->allPasteboardItemInfo(name());
+}
+
+PasteboardItemInfo Pasteboard::pasteboardItemInfo(size_t index) const
+{
+ return platformStrategies()->pasteboardStrategy()->informationForItemAtIndex(index, name());
+}
+
+String Pasteboard::readString(size_t index, const String& type)
+{
+ return platformStrategies()->pasteboardStrategy()->readStringFromPasteboard(index, type, name());
+}
+
+RefPtr<WebCore::SharedBuffer> Pasteboard::readBuffer(size_t index, const String& type)
+{
+ return platformStrategies()->pasteboardStrategy()->readBufferFromPasteboard(index, type, name());
+}
+
+URL Pasteboard::readURL(size_t index, String& title)
+{
+ return platformStrategies()->pasteboardStrategy()->readURLFromPasteboard(index, name(), title);
+}
+
};
Modified: trunk/Source/WebCore/platform/Pasteboard.h (250949 => 250950)
--- trunk/Source/WebCore/platform/Pasteboard.h 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/Pasteboard.h 2019-10-10 01:27:14 UTC (rev 250950)
@@ -265,11 +265,16 @@
#if PLATFORM(COCOA)
static bool shouldTreatCocoaTypeAsFile(const String&);
WEBCORE_EXPORT static NSArray *supportedFileUploadPasteboardTypes();
- const String& name() const { return m_pasteboardName; }
long changeCount() const;
const PasteboardCustomData& readCustomData();
#endif
+#if PLATFORM(COCOA)
+ const String& name() const { return m_pasteboardName; }
+#else
+ const String& name() const { return emptyString(); }
+#endif
+
#if PLATFORM(WIN)
COMPtr<IDataObject> dataObject() const { return m_dataObject; }
void setExternalDataObject(IDataObject*);
@@ -279,6 +284,13 @@
void writeImageToDataObject(Element&, const URL&); // FIXME: Layering violation.
#endif
+ Vector<PasteboardItemInfo> allPasteboardItemInfo() const;
+ PasteboardItemInfo pasteboardItemInfo(size_t index) const;
+
+ String readString(size_t index, const String& type);
+ RefPtr<WebCore::SharedBuffer> readBuffer(size_t index, const String& type);
+ URL readURL(size_t index, String& title);
+
private:
#if PLATFORM(IOS_FAMILY)
bool respectsUTIFidelities() const;
Modified: trunk/Source/WebCore/platform/PasteboardItemInfo.h (250949 => 250950)
--- trunk/Source/WebCore/platform/PasteboardItemInfo.h 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/PasteboardItemInfo.h 2019-10-10 01:27:14 UTC (rev 250950)
@@ -66,18 +66,20 @@
struct PasteboardItemInfo {
Vector<String> pathsForFileUpload;
- Vector<String> contentTypesForFileUpload;
- Vector<String> contentTypesByFidelity;
+ Vector<String> platformTypesForFileUpload;
+ Vector<String> platformTypesByFidelity;
String suggestedFileName;
PresentationSize preferredPresentationSize;
bool isNonTextType { false };
bool containsFileURLAndFileUploadContent { false };
+ Vector<String> webSafeTypesByFidelity;
+ int changeCount { 0 };
PasteboardItemPresentationStyle preferredPresentationStyle { PasteboardItemPresentationStyle::Unspecified };
String pathForContentType(const String& type) const
{
- ASSERT(pathsForFileUpload.size() == contentTypesForFileUpload.size());
- auto index = contentTypesForFileUpload.find(type);
+ ASSERT(pathsForFileUpload.size() == platformTypesForFileUpload.size());
+ auto index = platformTypesForFileUpload.find(type);
if (index == notFound)
return { };
@@ -104,10 +106,10 @@
String contentTypeForHighestFidelityItem() const
{
- if (contentTypesForFileUpload.isEmpty())
+ if (platformTypesForFileUpload.isEmpty())
return { };
- return contentTypesForFileUpload.first();
+ return platformTypesForFileUpload.first();
}
String pathForHighestFidelityItem() const
@@ -125,7 +127,7 @@
template<class Encoder>
void PasteboardItemInfo::encode(Encoder& encoder) const
{
- encoder << pathsForFileUpload << contentTypesForFileUpload << contentTypesByFidelity << suggestedFileName << preferredPresentationSize << isNonTextType << containsFileURLAndFileUploadContent;
+ encoder << pathsForFileUpload << platformTypesForFileUpload << platformTypesByFidelity << suggestedFileName << preferredPresentationSize << isNonTextType << containsFileURLAndFileUploadContent << webSafeTypesByFidelity << changeCount;
encoder.encodeEnum(preferredPresentationStyle);
}
@@ -136,10 +138,10 @@
if (!decoder.decode(result.pathsForFileUpload))
return WTF::nullopt;
- if (!decoder.decode(result.contentTypesForFileUpload))
+ if (!decoder.decode(result.platformTypesForFileUpload))
return WTF::nullopt;
- if (!decoder.decode(result.contentTypesByFidelity))
+ if (!decoder.decode(result.platformTypesByFidelity))
return WTF::nullopt;
if (!decoder.decode(result.suggestedFileName))
@@ -154,6 +156,12 @@
if (!decoder.decode(result.containsFileURLAndFileUploadContent))
return WTF::nullopt;
+ if (!decoder.decode(result.webSafeTypesByFidelity))
+ return WTF::nullopt;
+
+ if (!decoder.decode(result.changeCount))
+ return WTF::nullopt;
+
if (!decoder.decodeEnum(result.preferredPresentationStyle))
return WTF::nullopt;
Modified: trunk/Source/WebCore/platform/PasteboardStrategy.h (250949 => 250950)
--- trunk/Source/WebCore/platform/PasteboardStrategy.h 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/PasteboardStrategy.h 2019-10-10 01:27:14 UTC (rev 250950)
@@ -46,12 +46,6 @@
virtual void writeToPasteboard(const PasteboardWebContent&, const String& pasteboardName) = 0;
virtual void writeToPasteboard(const PasteboardImage&, const String& pasteboardName) = 0;
virtual void writeToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName) = 0;
- 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& 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;
#endif // PLATFORM(IOS_FAMILY)
#if PLATFORM(COCOA)
@@ -73,6 +67,12 @@
virtual long setColor(const Color&, const String& pasteboardName) = 0;
virtual long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) = 0;
#endif
+ virtual String readStringFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) = 0;
+ virtual RefPtr<SharedBuffer> readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) = 0;
+ virtual URL readURLFromPasteboard(size_t index, const String& pasteboardName, String& title) = 0;
+ virtual PasteboardItemInfo informationForItemAtIndex(size_t index, const String& pasteboardName) = 0;
+ virtual Vector<PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) = 0;
+ virtual int getPasteboardItemsCount(const String& pasteboardName) = 0;
virtual Vector<String> typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin) = 0;
virtual long writeCustomData(const PasteboardCustomData&, const String& pasteboardName) = 0;
@@ -84,7 +84,6 @@
#if USE(LIBWPE)
virtual void getTypes(Vector<String>& types) = 0;
- virtual String readStringFromPasteboard(int index, const String& pasteboardType) = 0;
virtual void writeToPasteboard(const PasteboardWebContent&) = 0;
virtual void writeToPasteboard(const String& pasteboardType, const String&) = 0;
#endif
Modified: trunk/Source/WebCore/platform/PlatformPasteboard.h (250949 => 250950)
--- trunk/Source/WebCore/platform/PlatformPasteboard.h 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/PlatformPasteboard.h 2019-10-10 01:27:14 UTC (rev 250950)
@@ -33,6 +33,7 @@
#if PLATFORM(MAC)
OBJC_CLASS NSPasteboard;
+OBJC_CLASS NSPasteboardItem;
#endif
#if PLATFORM(IOS_FAMILY)
@@ -59,10 +60,10 @@
WEBCORE_EXPORT explicit PlatformPasteboard(const String& pasteboardName);
#if PLATFORM(IOS_FAMILY) || USE(LIBWPE)
WEBCORE_EXPORT PlatformPasteboard();
- WEBCORE_EXPORT Vector<PasteboardItemInfo> allPasteboardItemInfo();
- WEBCORE_EXPORT PasteboardItemInfo informationForItemAtIndex(int index);
WEBCORE_EXPORT void updateSupportedTypeIdentifiers(const Vector<String>& types);
#endif
+ WEBCORE_EXPORT PasteboardItemInfo informationForItemAtIndex(size_t index);
+ WEBCORE_EXPORT Vector<PasteboardItemInfo> allPasteboardItemInfo();
WEBCORE_EXPORT static String uniqueName();
WEBCORE_EXPORT static String platformPasteboardTypeForSafeTypeForDOMToReadAndWrite(const String& domType);
@@ -90,9 +91,9 @@
WEBCORE_EXPORT void write(const PasteboardImage&);
WEBCORE_EXPORT void write(const String& pasteboardType, const String&);
WEBCORE_EXPORT void write(const PasteboardURL&);
- WEBCORE_EXPORT RefPtr<SharedBuffer> readBuffer(int index, const String& pasteboardType) const;
- WEBCORE_EXPORT String readString(int index, const String& pasteboardType) const;
- WEBCORE_EXPORT URL readURL(int index, String& title) const;
+ WEBCORE_EXPORT RefPtr<SharedBuffer> readBuffer(size_t index, const String& pasteboardType) const;
+ WEBCORE_EXPORT String readString(size_t index, const String& pasteboardType) const;
+ WEBCORE_EXPORT URL readURL(size_t index, String& title) const;
WEBCORE_EXPORT int count() const;
WEBCORE_EXPORT int numberOfFiles() const;
@@ -110,6 +111,10 @@
#endif
#if PLATFORM(MAC)
+ NSPasteboardItem *itemAtIndex(size_t index) const;
+#endif
+
+#if PLATFORM(MAC)
RetainPtr<NSPasteboard> m_pasteboard;
#endif
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm (250949 => 250950)
--- trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm 2019-10-10 01:27:14 UTC (rev 250950)
@@ -148,7 +148,7 @@
// If the item can't be treated as an attachment, it's very likely that the content being dropped is just
// an inline piece of text, with no files in the pasteboard (and therefore, no risk of leaking file paths
// to web content). In cases such as these, we should not suppress DataTransfer access.
- auto items = platformStrategies()->pasteboardStrategy()->allPasteboardItemInfo(m_pasteboardName);
+ auto items = allPasteboardItemInfo();
mayContainFilePaths = items.size() != 1 || notFound != items.findMatching([] (auto& item) {
return item.canBeTreatedAsAttachmentOrFile() || item.isNonTextType || item.containsFileURLAndFileUploadContent;
});
Copied: trunk/Source/WebCore/platform/cocoa/PlatformPasteboardCocoa.mm (from rev 250949, trunk/Source/WebKit/UIProcess/wpe/WebPasteboardProxyWPE.cpp) (0 => 250950)
--- trunk/Source/WebCore/platform/cocoa/PlatformPasteboardCocoa.mm (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/PlatformPasteboardCocoa.mm 2019-10-10 01:27:14 UTC (rev 250950)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "PlatformPasteboard.h"
+
+#import "PasteboardItemInfo.h"
+
+namespace WebCore {
+
+Vector<PasteboardItemInfo> PlatformPasteboard::allPasteboardItemInfo()
+{
+ Vector<PasteboardItemInfo> itemInfo;
+ int numberOfItems = count();
+ itemInfo.reserveInitialCapacity(numberOfItems);
+ for (NSInteger itemIndex = 0; itemIndex < numberOfItems; ++itemIndex)
+ itemInfo.uncheckedAppend(informationForItemAtIndex(itemIndex));
+ return itemInfo;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (250949 => 250950)
--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2019-10-10 01:27:14 UTC (rev 250950)
@@ -355,7 +355,7 @@
// Try to read data from each type identifier that this pasteboard item supports, and WebKit also recognizes. Type identifiers are
// read in order of fidelity, as specified by each pasteboard item.
ReaderResult result = ReaderResult::DidNotReadType;
- for (auto& type : info.contentTypesByFidelity) {
+ for (auto& type : info.platformTypesByFidelity) {
if (!isTypeAllowedByReadingPolicy(type, policy))
continue;
Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (250949 => 250950)
--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2019-10-10 01:27:14 UTC (rev 250950)
@@ -116,17 +116,9 @@
#endif // PASTEBOARD_SUPPORTS_PRESENTATION_STYLE_AND_TEAM_DATA
-Vector<PasteboardItemInfo> PlatformPasteboard::allPasteboardItemInfo()
+PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(size_t index)
{
- Vector<PasteboardItemInfo> itemInfo;
- for (NSInteger itemIndex = 0; itemIndex < [m_pasteboard numberOfItems]; ++itemIndex)
- itemInfo.append(informationForItemAtIndex(itemIndex));
- return itemInfo;
-}
-
-PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(int index)
-{
- if (index >= [m_pasteboard numberOfItems])
+ if (index >= static_cast<NSUInteger>([m_pasteboard numberOfItems]))
return { };
PasteboardItemInfo info;
@@ -140,15 +132,15 @@
for (NSURL *url in urls)
info.pathsForFileUpload.uncheckedAppend(url.path);
- info.contentTypesForFileUpload.reserveInitialCapacity(fileTypes.count);
+ info.platformTypesForFileUpload.reserveInitialCapacity(fileTypes.count);
for (NSString *fileType in fileTypes)
- info.contentTypesForFileUpload.uncheckedAppend(fileType);
+ info.platformTypesForFileUpload.uncheckedAppend(fileType);
} else {
NSArray *fileTypes = itemProvider.web_fileUploadContentTypes;
- info.contentTypesForFileUpload.reserveInitialCapacity(fileTypes.count);
+ info.platformTypesForFileUpload.reserveInitialCapacity(fileTypes.count);
info.pathsForFileUpload.reserveInitialCapacity(fileTypes.count);
for (NSString *fileType in fileTypes) {
- info.contentTypesForFileUpload.uncheckedAppend(fileType);
+ info.platformTypesForFileUpload.uncheckedAppend(fileType);
info.pathsForFileUpload.uncheckedAppend({ });
}
}
@@ -168,9 +160,9 @@
info.containsFileURLAndFileUploadContent = itemProvider.web_containsFileURLAndFileUploadContent;
info.suggestedFileName = itemProvider.suggestedName;
NSArray<NSString *> *registeredTypeIdentifiers = itemProvider.registeredTypeIdentifiers;
- info.contentTypesByFidelity.reserveInitialCapacity(registeredTypeIdentifiers.count);
+ info.platformTypesByFidelity.reserveInitialCapacity(registeredTypeIdentifiers.count);
for (NSString *typeIdentifier in registeredTypeIdentifiers) {
- info.contentTypesByFidelity.uncheckedAppend(typeIdentifier);
+ info.platformTypesByFidelity.uncheckedAppend(typeIdentifier);
CFStringRef cfTypeIdentifier = (CFStringRef)typeIdentifier;
if (!UTTypeIsDeclared(cfTypeIdentifier))
continue;
@@ -190,21 +182,18 @@
info.isNonTextType = true;
}
+ info.changeCount = changeCount();
+
return info;
}
#else
-PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(int)
+PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(size_t)
{
return { };
}
-Vector<PasteboardItemInfo> PlatformPasteboard::allPasteboardItemInfo()
-{
- return { };
-}
-
#endif
static bool pasteboardMayContainFilePaths(id<AbstractPasteboard> pasteboard)
@@ -656,7 +645,7 @@
return strings;
}
-RefPtr<SharedBuffer> PlatformPasteboard::readBuffer(int index, const String& type) const
+RefPtr<SharedBuffer> PlatformPasteboard::readBuffer(size_t index, const String& type) const
{
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:index];
@@ -667,7 +656,7 @@
return SharedBuffer::create([pasteboardItem.get() objectAtIndex:0]);
}
-String PlatformPasteboard::readString(int index, const String& type) const
+String PlatformPasteboard::readString(size_t index, const String& type) const
{
if (type == String(kUTTypeURL)) {
String title;
@@ -697,7 +686,7 @@
return String();
}
-URL PlatformPasteboard::readURL(int index, String& title) const
+URL PlatformPasteboard::readURL(size_t index, String& title) const
{
id value = [m_pasteboard valuesForPasteboardType:(__bridge NSString *)kUTTypeURL inItemSet:[NSIndexSet indexSetWithIndex:index]].firstObject;
if (!value)
Modified: trunk/Source/WebCore/platform/libwpe/PasteboardLibWPE.cpp (250949 => 250950)
--- trunk/Source/WebCore/platform/libwpe/PasteboardLibWPE.cpp 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/libwpe/PasteboardLibWPE.cpp 2019-10-10 01:27:14 UTC (rev 250950)
@@ -72,7 +72,7 @@
String Pasteboard::readString(const String& type)
{
- return platformStrategies()->pasteboardStrategy()->readStringFromPasteboard(0, type);
+ return platformStrategies()->pasteboardStrategy()->readStringFromPasteboard(0, type, name());
}
String Pasteboard::readStringInCustomData(const String&)
@@ -96,7 +96,7 @@
void Pasteboard::read(PasteboardPlainText& text)
{
- text.text = platformStrategies()->pasteboardStrategy()->readStringFromPasteboard(0, "text/plain;charset=utf-8");
+ text.text = platformStrategies()->pasteboardStrategy()->readStringFromPasteboard(0, "text/plain;charset=utf-8", name());
}
void Pasteboard::read(PasteboardWebContentReader&, WebContentReadingPolicy)
Modified: trunk/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp (250949 => 250950)
--- trunk/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp 2019-10-10 01:27:14 UTC (rev 250950)
@@ -60,7 +60,7 @@
wpe_pasteboard_string_vector_free(&pasteboardTypes);
}
-String PlatformPasteboard::readString(int, const String& type) const
+String PlatformPasteboard::readString(size_t, const String& type) const
{
struct wpe_pasteboard_string string = { nullptr, 0 };
wpe_pasteboard_get_string(m_pasteboard, type.utf8().data(), &string);
Modified: trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm (250949 => 250950)
--- trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm 2019-10-10 01:27:14 UTC (rev 250950)
@@ -384,6 +384,116 @@
return changeCount();
}
+static NSPasteboardType modernPasteboardTypeForWebSafeMIMEType(const String& webSafeType)
+{
+ if (webSafeType == "text/plain"_s)
+ return NSPasteboardTypeString;
+ if (webSafeType == "text/html"_s)
+ return NSPasteboardTypeHTML;
+ if (webSafeType == "text/uri-list"_s)
+ return NSPasteboardTypeURL;
+ if (webSafeType == "image/png"_s)
+ return NSPasteboardTypePNG;
+ return nil;
}
+enum class ContainsFileURL { No, Yes };
+static String webSafeMIMETypeForModernPasteboardType(NSPasteboardType platformType, ContainsFileURL containsFileURL)
+{
+ if ([platformType isEqual:NSPasteboardTypeString] && containsFileURL == ContainsFileURL::No)
+ return "text/plain"_s;
+ if ([platformType isEqual:NSPasteboardTypeHTML] || [platformType isEqual:NSPasteboardTypeRTF] || [platformType isEqual:NSPasteboardTypeRTFD])
+ return "text/html"_s;
+ if ([platformType isEqual:NSPasteboardTypeURL] && containsFileURL == ContainsFileURL::No)
+ return "text/uri-list"_s;
+ if ([platformType isEqual:NSPasteboardTypePNG] || [platformType isEqual:NSPasteboardTypeTIFF])
+ return "image/png"_s;
+ return { };
+}
+
+RefPtr<SharedBuffer> PlatformPasteboard::readBuffer(size_t index, const String& type) const
+{
+ NSPasteboardItem *item = itemAtIndex(index);
+ if (!item)
+ return { };
+
+ auto platformType = modernPasteboardTypeForWebSafeMIMEType(type);
+ if (!platformType)
+ return nullptr;
+
+ if (NSData *data = "" dataForType:platformType]) {
+ auto nsData = adoptNS(data.copy);
+ return SharedBuffer::create(nsData.get());
+ }
+
+ return nullptr;
+}
+
+String PlatformPasteboard::readString(size_t index, const String& type) const
+{
+ NSPasteboardItem *item = itemAtIndex(index);
+ if (!item)
+ return { };
+
+ auto platformType = modernPasteboardTypeForWebSafeMIMEType(type);
+ if (!platformType)
+ return { };
+
+ return [item stringForType:platformType];
+}
+
+URL PlatformPasteboard::readURL(size_t index, String& title) const
+{
+ title = emptyString();
+
+ NSPasteboardItem *item = itemAtIndex(index);
+ if (!item)
+ return { };
+
+ RetainPtr<NSURL> url;
+ if (id propertyList = [item propertyListForType:NSPasteboardTypeURL])
+ url = "" alloc] initWithPasteboardPropertyList:propertyList ofType:NSPasteboardTypeURL]);
+ else if (NSString *absoluteString = [item stringForType:NSPasteboardTypeURL])
+ url = "" URLWithString:absoluteString];
+ return { [url isFileURL] ? nil : url.get() };
+}
+
+int PlatformPasteboard::count() const
+{
+ return [m_pasteboard pasteboardItems].count;
+}
+
+PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(size_t index)
+{
+ NSPasteboardItem *item = itemAtIndex(index);
+ if (!item)
+ return { };
+
+ PasteboardItemInfo info;
+ NSArray<NSPasteboardType> *platformTypes = [item types];
+ auto containsFileURL = [platformTypes containsObject:NSPasteboardTypeFileURL] ? ContainsFileURL::Yes : ContainsFileURL::No;
+ ListHashSet<String> webSafeTypes;
+ info.platformTypesByFidelity.reserveInitialCapacity(platformTypes.count);
+ for (NSPasteboardType type in platformTypes) {
+ info.platformTypesByFidelity.uncheckedAppend(type);
+ auto webSafeType = webSafeMIMETypeForModernPasteboardType(type, containsFileURL);
+ if (webSafeType.isEmpty())
+ continue;
+
+ webSafeTypes.add(WTFMove(webSafeType));
+ }
+ info.containsFileURLAndFileUploadContent = containsFileURL == ContainsFileURL::Yes;
+ info.webSafeTypesByFidelity = copyToVector(webSafeTypes);
+ info.changeCount = changeCount();
+ return info;
+}
+
+NSPasteboardItem *PlatformPasteboard::itemAtIndex(size_t index) const
+{
+ NSArray<NSPasteboardItem *> *items = [m_pasteboard pasteboardItems];
+ return index >= items.count ? nil : items[index];
+}
+
+}
+
#endif // PLATFORM(MAC)
Modified: trunk/Source/WebKit/ChangeLog (250949 => 250950)
--- trunk/Source/WebKit/ChangeLog 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKit/ChangeLog 2019-10-10 01:27:14 UTC (rev 250950)
@@ -1,3 +1,42 @@
+2019-10-09 Wenson Hsieh <[email protected]>
+
+ [Clipboard API] Refactor Pasteboard item reading functions to work on both iOS and macOS
+ https://bugs.webkit.org/show_bug.cgi?id=202647
+
+ Reviewed by Tim Horton.
+
+ Refactor iOS-specific pasteboard functions to be platform-agnostic. See WebCore ChangeLog for more details.
+
+ * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
+ (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
+ (WebKit::WebPasteboardProxy::informationForItemAtIndex):
+ (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
+ (WebKit::WebPasteboardProxy::readStringFromPasteboard):
+ (WebKit::WebPasteboardProxy::readURLFromPasteboard):
+ (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
+ (WebKit::WebPasteboardProxy::writeURLToPasteboard):
+ (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
+ (WebKit::WebPasteboardProxy::writeImageToPasteboard):
+ (WebKit::WebPasteboardProxy::writeStringToPasteboard):
+ * UIProcess/WebPasteboardProxy.cpp:
+ (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
+ (WebKit::WebPasteboardProxy::informationForItemAtIndex):
+ (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
+ (WebKit::WebPasteboardProxy::readStringFromPasteboard):
+ (WebKit::WebPasteboardProxy::readURLFromPasteboard):
+ (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
+ * UIProcess/WebPasteboardProxy.h:
+ * UIProcess/WebPasteboardProxy.messages.in:
+ * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+ (WebKit::WebPlatformStrategies::informationForItemAtIndex):
+ (WebKit::WebPlatformStrategies::readBufferFromPasteboard):
+ (WebKit::WebPlatformStrategies::readURLFromPasteboard):
+ (WebKit::WebPlatformStrategies::readStringFromPasteboard):
+ (WebKit::WebPlatformStrategies::writeToPasteboard):
+ (WebKit::WebPlatformStrategies::updateSupportedTypeIdentifiers):
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
2019-10-09 John Wilander <[email protected]>
IsLoggedIn: Add as experimental feature
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (250949 => 250950)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2019-10-10 01:27:14 UTC (rev 250950)
@@ -180,34 +180,27 @@
completionHandler(PlatformPasteboard(pasteboardName).write(data));
}
-#if PLATFORM(IOS_FAMILY)
-
-void WebPasteboardProxy::writeURLToPasteboard(const PasteboardURL& url, const String& pasteboardName)
+void WebPasteboardProxy::allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<PasteboardItemInfo>&&)>&& completionHandler)
{
- PlatformPasteboard(pasteboardName).write(url);
+ completionHandler(PlatformPasteboard(pasteboardName).allPasteboardItemInfo());
}
-void WebPasteboardProxy::writeWebContentToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName)
+void WebPasteboardProxy::informationForItemAtIndex(size_t index, const String& pasteboardName, CompletionHandler<void(PasteboardItemInfo&&)>&& completionHandler)
{
- PlatformPasteboard(pasteboardName).write(content);
+ completionHandler(PlatformPasteboard(pasteboardName).informationForItemAtIndex(index));
}
-void WebPasteboardProxy::writeImageToPasteboard(const WebCore::PasteboardImage& pasteboardImage, const String& pasteboardName)
+void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
{
- PlatformPasteboard(pasteboardName).write(pasteboardImage);
+ completionHandler(PlatformPasteboard(pasteboardName).count());
}
-void WebPasteboardProxy::writeStringToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName)
+void WebPasteboardProxy::readStringFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&& completionHandler)
{
- PlatformPasteboard(pasteboardName).write(pasteboardType, text);
-}
-
-void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&& completionHandler)
-{
completionHandler(PlatformPasteboard(pasteboardName).readString(index, pasteboardType));
}
-void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&& completionHandler)
+void WebPasteboardProxy::readURLFromPasteboard(size_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&& completionHandler)
{
String title;
String url = "" title);
@@ -214,7 +207,7 @@
completionHandler(WTFMove(url), WTFMove(title));
}
-void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&& completionHandler)
+void WebPasteboardProxy::readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&& completionHandler)
{
RefPtr<SharedBuffer> buffer = PlatformPasteboard(pasteboardName).readBuffer(index, pasteboardType);
if (!buffer)
@@ -231,26 +224,33 @@
completionHandler(WTFMove(handle), size);
}
-void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
+#if PLATFORM(IOS_FAMILY)
+
+void WebPasteboardProxy::writeURLToPasteboard(const PasteboardURL& url, const String& pasteboardName)
{
- completionHandler(PlatformPasteboard(pasteboardName).count());
+ PlatformPasteboard(pasteboardName).write(url);
}
-void WebPasteboardProxy::allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<PasteboardItemInfo>&&)>&& completionHandler)
+void WebPasteboardProxy::writeWebContentToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName)
{
- completionHandler(PlatformPasteboard(pasteboardName).allPasteboardItemInfo());
+ PlatformPasteboard(pasteboardName).write(content);
}
-void WebPasteboardProxy::informationForItemAtIndex(int index, const String& pasteboardName, CompletionHandler<void(PasteboardItemInfo&&)>&& completionHandler)
+void WebPasteboardProxy::writeImageToPasteboard(const WebCore::PasteboardImage& pasteboardImage, const String& pasteboardName)
{
- completionHandler(PlatformPasteboard(pasteboardName).informationForItemAtIndex(index));
+ PlatformPasteboard(pasteboardName).write(pasteboardImage);
}
+void WebPasteboardProxy::writeStringToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName)
+{
+ PlatformPasteboard(pasteboardName).write(pasteboardType, text);
+}
+
void WebPasteboardProxy::updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName)
{
PlatformPasteboard(pasteboardName).updateSupportedTypeIdentifiers(identifiers);
}
-#endif
+#endif // PLATFORM(IOS_FAMILY)
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp (250949 => 250950)
--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp 2019-10-10 01:27:14 UTC (rev 250950)
@@ -26,9 +26,11 @@
#include "config.h"
#include "WebPasteboardProxy.h"
+#include "SharedMemory.h"
#include "WebPasteboardProxyMessages.h"
#include "WebProcessProxy.h"
#include <mutex>
+#include <wtf/CompletionHandler.h>
#include <wtf/NeverDestroyed.h>
namespace WebKit {
@@ -73,6 +75,40 @@
completionHandler(0);
}
-#endif
+void WebPasteboardProxy::allPasteboardItemInfo(const String&, CompletionHandler<void(Vector<PasteboardItemInfo>&&)>&& completionHandler)
+{
+ completionHandler({ });
+}
+void WebPasteboardProxy::informationForItemAtIndex(size_t, const String&, CompletionHandler<void(PasteboardItemInfo&&)>&& completionHandler)
+{
+ completionHandler({ });
+}
+
+void WebPasteboardProxy::getPasteboardItemsCount(const String&, CompletionHandler<void(uint64_t)>&& completionHandler)
+{
+ completionHandler(0);
+}
+
+void WebPasteboardProxy::readURLFromPasteboard(size_t, const String&, CompletionHandler<void(String&& url, String&& title)>&& completionHandler)
+{
+ completionHandler({ }, { });
+}
+
+void WebPasteboardProxy::readBufferFromPasteboard(size_t, const String&, const String&, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&& completionHandler)
+{
+ completionHandler({ }, 0);
+}
+
+#if !PLATFORM(WPE)
+
+void WebPasteboardProxy::readStringFromPasteboard(size_t, const String&, const String&, CompletionHandler<void(String&&)>&& completionHandler)
+{
+ completionHandler({ });
+}
+
+#endif // !PLATFORM(WPE)
+
+#endif // !PLATFORM(COCOA)
+
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h (250949 => 250950)
--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h 2019-10-10 01:27:14 UTC (rev 250950)
@@ -73,12 +73,6 @@
void writeWebContentToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName);
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, CompletionHandler<void(String&&)>&&);
- void readURLFromPasteboard(uint64_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&&);
- void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&&);
- void getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
- void allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<WebCore::PasteboardItemInfo>&&)>&&);
- void informationForItemAtIndex(int index, const String& pasteboardName, CompletionHandler<void(WebCore::PasteboardItemInfo&&)>&&);
void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName);
#endif
#if PLATFORM(COCOA)
@@ -101,6 +95,13 @@
void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, CompletionHandler<void(uint64_t)>&&);
#endif
+ void readStringFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&&);
+ void readURLFromPasteboard(size_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&&);
+ void readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&&);
+ void getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
+ void informationForItemAtIndex(size_t index, const String& pasteboardName, CompletionHandler<void(WebCore::PasteboardItemInfo&&)>&&);
+ void allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<WebCore::PasteboardItemInfo>&&)>&&);
+
void writeCustomData(const WebCore::PasteboardCustomData&, const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
void typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&&);
@@ -114,7 +115,6 @@
#if USE(LIBWPE)
void getPasteboardTypes(CompletionHandler<void(Vector<String>&&)>&&);
- void readStringFromPasteboard(uint64_t index, const String& pasteboardType, CompletionHandler<void(String&&)>&&);
void writeWebContentToPasteboard(const WebCore::PasteboardWebContent&);
void writeStringToPasteboard(const String& pasteboardType, const String&);
#endif
Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in (250949 => 250950)
--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in 2019-10-10 01:27:14 UTC (rev 250950)
@@ -26,17 +26,17 @@
WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content, String pasteboardName)
WriteImageToPasteboard(struct WebCore::PasteboardImage pasteboardImage, String pasteboardName)
WriteStringToPasteboard(String pasteboardType, String text, String pasteboardName)
- ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) Synchronous
- ReadURLFromPasteboard(uint64_t index, String pasteboardName) -> (String url, String title) Synchronous
- ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Synchronous
- GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount) Synchronous
- AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo) Synchronous
- InformationForItemAtIndex(uint64_t index, String pasteboardName) -> (struct WebCore::PasteboardItemInfo info) Synchronous
UpdateSupportedTypeIdentifiers(Vector<String> identifiers, String pasteboardName)
#endif
WriteCustomData(struct WebCore::PasteboardCustomData data, String pasteboardName) -> (uint64_t changeCount) Synchronous
TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) Synchronous
+ AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo) Synchronous
+ InformationForItemAtIndex(uint64_t index, String pasteboardName) -> (struct WebCore::PasteboardItemInfo info) Synchronous
+ GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount) Synchronous
+ ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) Synchronous
+ ReadURLFromPasteboard(uint64_t index, String pasteboardName) -> (String url, String title) Synchronous
+ ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Synchronous
#if PLATFORM(COCOA)
# Pasteboard messages.
@@ -66,7 +66,6 @@
#if USE(LIBWPE)
GetPasteboardTypes() -> (Vector<String> types) Synchronous
- ReadStringFromPasteboard(uint64_t index, String pasteboardType) -> (String string) Synchronous
WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content)
WriteStringToPasteboard(String pasteboardType, String text)
#endif
Modified: trunk/Source/WebKit/UIProcess/wpe/WebPasteboardProxyWPE.cpp (250949 => 250950)
--- trunk/Source/WebKit/UIProcess/wpe/WebPasteboardProxyWPE.cpp 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKit/UIProcess/wpe/WebPasteboardProxyWPE.cpp 2019-10-10 01:27:14 UTC (rev 250950)
@@ -40,7 +40,7 @@
completionHandler(WTFMove(pasteboardTypes));
}
-void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, CompletionHandler<void(String&&)>&& completionHandler)
+void WebPasteboardProxy::readStringFromPasteboard(size_t index, const String& pasteboardType, const String&, CompletionHandler<void(String&&)>&& completionHandler)
{
completionHandler(PlatformPasteboard().readString(index, pasteboardType));
}
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (250949 => 250950)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2019-10-10 01:27:14 UTC (rev 250950)
@@ -265,56 +265,10 @@
WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteStringToPasteboard(pasteboardType, text, pasteboardName), 0);
}
-int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)
-{
- uint64_t itemsCount { 0 };
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardItemsCount(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardItemsCount::Reply(itemsCount), 0);
- return itemsCount;
-}
-
-Vector<PasteboardItemInfo> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName)
-{
- Vector<PasteboardItemInfo> allInfo;
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::AllPasteboardItemInfo(pasteboardName), Messages::WebPasteboardProxy::AllPasteboardItemInfo::Reply(allInfo), 0);
- return allInfo;
-}
-
-PasteboardItemInfo WebPlatformStrategies::informationForItemAtIndex(int index, const String& pasteboardName)
-{
- PasteboardItemInfo info;
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::InformationForItemAtIndex(index, pasteboardName), Messages::WebPasteboardProxy::InformationForItemAtIndex::Reply(info), 0);
- return info;
-}
-
void WebPlatformStrategies::updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName)
{
WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::UpdateSupportedTypeIdentifiers(identifiers, pasteboardName), 0);
}
-
-RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
-{
- SharedMemory::Handle handle;
- uint64_t size { 0 };
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadBufferFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadBufferFromPasteboard::Reply(handle, size), 0);
- if (handle.isNull())
- return nullptr;
- RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
- return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
-}
-
-URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardName, String& title)
-{
- String urlString;
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardName), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString, title), 0);
- return URL({ }, urlString);
-}
-
-String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
-{
- String value;
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadStringFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadStringFromPasteboard::Reply(value), 0);
- return value;
-}
#endif // PLATFORM(IOS_FAMILY)
#endif // PLATFORM(COCOA)
@@ -345,13 +299,6 @@
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardTypes(), Messages::WebPasteboardProxy::GetPasteboardTypes::Reply(types), 0);
}
-String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType)
-{
- String value;
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadStringFromPasteboard(index, pasteboardType), Messages::WebPasteboardProxy::ReadStringFromPasteboard::Reply(value), 0);
- return value;
-}
-
void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content)
{
WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteWebContentToPasteboard(content), 0);
@@ -378,4 +325,50 @@
return newChangeCount;
}
+int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)
+{
+ uint64_t itemsCount { 0 };
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardItemsCount(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardItemsCount::Reply(itemsCount), 0);
+ return itemsCount;
+}
+
+Vector<PasteboardItemInfo> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName)
+{
+ Vector<PasteboardItemInfo> allInfo;
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::AllPasteboardItemInfo(pasteboardName), Messages::WebPasteboardProxy::AllPasteboardItemInfo::Reply(allInfo), 0);
+ return allInfo;
+}
+
+PasteboardItemInfo WebPlatformStrategies::informationForItemAtIndex(size_t index, const String& pasteboardName)
+{
+ PasteboardItemInfo info;
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::InformationForItemAtIndex(index, pasteboardName), Messages::WebPasteboardProxy::InformationForItemAtIndex::Reply(info), 0);
+ return info;
+}
+
+RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName)
+{
+ SharedMemory::Handle handle;
+ uint64_t size { 0 };
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadBufferFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadBufferFromPasteboard::Reply(handle, size), 0);
+ if (handle.isNull())
+ return nullptr;
+ RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
+ return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
+}
+
+URL WebPlatformStrategies::readURLFromPasteboard(size_t index, const String& pasteboardName, String& title)
+{
+ String urlString;
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardName), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString, title), 0);
+ return URL({ }, urlString);
+}
+
+String WebPlatformStrategies::readStringFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName)
+{
+ String value;
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadStringFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadStringFromPasteboard::Reply(value), 0);
+ return value;
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h (250949 => 250950)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h 2019-10-10 01:27:14 UTC (rev 250950)
@@ -50,12 +50,6 @@
void writeToPasteboard(const WebCore:: PasteboardURL&, const String& pasteboardName) override;
void writeToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName) override;
void writeToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName) override;
- 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;
- 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;
#endif
#if PLATFORM(COCOA)
@@ -83,11 +77,16 @@
#endif
#if USE(LIBWPE)
void getTypes(Vector<String>& types) override;
- String readStringFromPasteboard(int index, const String& pasteboardType) override;
void writeToPasteboard(const WebCore::PasteboardWebContent&) override;
void writeToPasteboard(const String& pasteboardType, const String&) override;
#endif
+ String readStringFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) override;
+ RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) override;
+ URL readURLFromPasteboard(size_t index, const String& pasteboardName, String& title) override;
+ int getPasteboardItemsCount(const String& pasteboardName) override;
+ WebCore::PasteboardItemInfo informationForItemAtIndex(size_t index, const String& pasteboardName) override;
+ Vector<WebCore::PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) override;
Vector<String> typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin) override;
long writeCustomData(const WebCore::PasteboardCustomData&, const String&) override;
};
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (250949 => 250950)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-10-10 01:27:14 UTC (rev 250950)
@@ -1,3 +1,23 @@
+2019-10-09 Wenson Hsieh <[email protected]>
+
+ [Clipboard API] Refactor Pasteboard item reading functions to work on both iOS and macOS
+ https://bugs.webkit.org/show_bug.cgi?id=202647
+
+ Reviewed by Tim Horton.
+
+ Refactor iOS-specific pasteboard functions to be platform-agnostic. See WebCore ChangeLog for more details.
+
+ * WebCoreSupport/WebPlatformStrategies.h:
+ * WebCoreSupport/WebPlatformStrategies.mm:
+ (WebPlatformStrategies::informationForItemAtIndex):
+ (WebPlatformStrategies::allPasteboardItemInfo):
+ (WebPlatformStrategies::getPasteboardItemsCount):
+ (WebPlatformStrategies::readBufferFromPasteboard):
+ (WebPlatformStrategies::readURLFromPasteboard):
+ (WebPlatformStrategies::readStringFromPasteboard):
+ (WebPlatformStrategies::writeToPasteboard):
+ (WebPlatformStrategies::updateSupportedTypeIdentifiers):
+
2019-10-08 Antti Koivisto <[email protected]>
[CSS Shadow Parts] Enable by default
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h (250949 => 250950)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h 2019-10-10 01:27:14 UTC (rev 250950)
@@ -51,14 +51,14 @@
void writeToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName) override;
void writeToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName) override;
void writeToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName) override;
+ void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName) override;
+#endif
+ String readStringFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) override;
+ RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) override;
+ URL readURLFromPasteboard(size_t index, const String& pasteboardName, String& title) override;
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;
- URL readURLFromPasteboard(int index, const String& pasteboardName, String& title) override;
+ WebCore::PasteboardItemInfo informationForItemAtIndex(size_t index, const String& pasteboardName) 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;
-#endif
int getNumberOfFiles(const String& pasteboardName) override;
void getTypes(Vector<String>& types, const String& pasteboardName) override;
RefPtr<WebCore::SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) override;
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (250949 => 250950)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm 2019-10-10 01:01:58 UTC (rev 250949)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm 2019-10-10 01:27:14 UTC (rev 250950)
@@ -173,60 +173,60 @@
return PlatformPasteboard(pasteboardName).write(data);
}
-#if PLATFORM(IOS_FAMILY)
-
-void WebPlatformStrategies::writeToPasteboard(const PasteboardURL& url, const String& pasteboardName)
+WebCore::PasteboardItemInfo WebPlatformStrategies::informationForItemAtIndex(size_t index, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).write(url);
+ return PlatformPasteboard(pasteboardName).informationForItemAtIndex(index);
}
-void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName)
+Vector<WebCore::PasteboardItemInfo> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).write(content);
+ return PlatformPasteboard(pasteboardName).allPasteboardItemInfo();
}
-void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image, const String& pasteboardName)
+int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).write(image);
+ return PlatformPasteboard(pasteboardName).count();
}
-void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName)
+RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(size_t index, const String& type, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).write(pasteboardType, text);
+ return PlatformPasteboard(pasteboardName).readBuffer(index, type);
}
-int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)
+URL WebPlatformStrategies::readURLFromPasteboard(size_t index, const String& pasteboardName, String& title)
{
- return PlatformPasteboard(pasteboardName).count();
+ return PlatformPasteboard(pasteboardName).readURL(index, title);
}
-void WebPlatformStrategies::updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName)
+String WebPlatformStrategies::readStringFromPasteboard(size_t index, const String& type, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).updateSupportedTypeIdentifiers(identifiers);
+ return PlatformPasteboard(pasteboardName).readString(index, type);
}
-RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& type, const String& pasteboardName)
+#if PLATFORM(IOS_FAMILY)
+
+void WebPlatformStrategies::writeToPasteboard(const PasteboardURL& url, const String& pasteboardName)
{
- return PlatformPasteboard(pasteboardName).readBuffer(index, type);
+ PlatformPasteboard(pasteboardName).write(url);
}
-URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardName, String& title)
+void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName)
{
- return PlatformPasteboard(pasteboardName).readURL(index, title);
+ PlatformPasteboard(pasteboardName).write(content);
}
-String WebPlatformStrategies::readStringFromPasteboard(int index, const String& type, const String& pasteboardName)
+void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image, const String& pasteboardName)
{
- return PlatformPasteboard(pasteboardName).readString(index, type);
+ PlatformPasteboard(pasteboardName).write(image);
}
-Vector<WebCore::PasteboardItemInfo> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName)
+void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName)
{
- return PlatformPasteboard(pasteboardName).allPasteboardItemInfo();
+ PlatformPasteboard(pasteboardName).write(pasteboardType, text);
}
-WebCore::PasteboardItemInfo WebPlatformStrategies::informationForItemAtIndex(int index, const String& pasteboardName)
+void WebPlatformStrategies::updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName)
{
- return PlatformPasteboard(pasteboardName).informationForItemAtIndex(index);
+ PlatformPasteboard(pasteboardName).updateSupportedTypeIdentifiers(identifiers);
}
#endif // PLATFORM(IOS_FAMILY)