Title: [212563] trunk/Source/WebCore
Revision
212563
Author
ander...@apple.com
Date
2017-02-17 12:02:03 -0800 (Fri, 17 Feb 2017)

Log Message

Begin overhauling the pasteboard implementation
https://bugs.webkit.org/show_bug.cgi?id=168525

Reviewed by Tim Horton.

Add a new PasteboardWriterData object. This object will hold data that is going
to be written to the pasteboard at some point. Currently it only supports plain text.

Also add a Mac-only PasteboardWriter class which can convert a PasteboardWriterDataObject
into an object that conforms to NSPasteboardWriting.

The basic idea is that instead of doing a bunch of pasteboard operations,
we'll just package all the pasteboard data up into an object and ship it over to WebKit.

This code is currently unused but will be adopted by a new drag implementation (in an upcoming patch).

* WebCore.xcodeproj/project.pbxproj:
* platform/PasteboardWriterData.cpp: Added.
(WebCore::PasteboardWriterData::PasteboardWriterData):
(WebCore::PasteboardWriterData::~PasteboardWriterData):
(WebCore::PasteboardWriterData::isEmpty):
(WebCore::PasteboardWriterData::setPlainText):
* platform/PasteboardWriterData.h: Added.
* platform/mac/PasteboardWriter.h: Added.
* platform/mac/PasteboardWriter.mm: Added.
(WebCore::createPasteboardWriting):
* platform/spi/mac/NSPasteboardSPI.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (212562 => 212563)


--- trunk/Source/WebCore/CMakeLists.txt	2017-02-17 19:34:48 UTC (rev 212562)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-02-17 20:02:03 UTC (rev 212563)
@@ -2093,6 +2093,7 @@
     platform/MainThreadSharedTimer.cpp
     platform/MemoryPressureHandler.cpp
     platform/NotImplemented.cpp
+    platform/PasteboardWriterData.cpp
     platform/PlatformSpeechSynthesisUtterance.cpp
     platform/PlatformSpeechSynthesisVoice.cpp
     platform/PlatformSpeechSynthesizer.cpp

Modified: trunk/Source/WebCore/ChangeLog (212562 => 212563)


--- trunk/Source/WebCore/ChangeLog	2017-02-17 19:34:48 UTC (rev 212562)
+++ trunk/Source/WebCore/ChangeLog	2017-02-17 20:02:03 UTC (rev 212563)
@@ -1,3 +1,33 @@
+2017-02-17  Anders Carlsson  <ander...@apple.com>
+
+        Begin overhauling the pasteboard implementation
+        https://bugs.webkit.org/show_bug.cgi?id=168525
+
+        Reviewed by Tim Horton.
+
+        Add a new PasteboardWriterData object. This object will hold data that is going
+        to be written to the pasteboard at some point. Currently it only supports plain text.
+
+        Also add a Mac-only PasteboardWriter class which can convert a PasteboardWriterDataObject
+        into an object that conforms to NSPasteboardWriting.
+
+        The basic idea is that instead of doing a bunch of pasteboard operations,
+        we'll just package all the pasteboard data up into an object and ship it over to WebKit.
+
+        This code is currently unused but will be adopted by a new drag implementation (in an upcoming patch).
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/PasteboardWriterData.cpp: Added.
+        (WebCore::PasteboardWriterData::PasteboardWriterData):
+        (WebCore::PasteboardWriterData::~PasteboardWriterData):
+        (WebCore::PasteboardWriterData::isEmpty):
+        (WebCore::PasteboardWriterData::setPlainText):
+        * platform/PasteboardWriterData.h: Added.
+        * platform/mac/PasteboardWriter.h: Added.
+        * platform/mac/PasteboardWriter.mm: Added.
+        (WebCore::createPasteboardWriting):
+        * platform/spi/mac/NSPasteboardSPI.h: Added.
+
 2017-02-17  Per Arne Vollan  <pvol...@apple.com>
 
         Apply SVG styles paint-order, stroke-linejoin, and stroke-linecap on DOM text.

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (212562 => 212563)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-02-17 19:34:48 UTC (rev 212562)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-02-17 20:02:03 UTC (rev 212563)
@@ -951,6 +951,10 @@
 		1AEF4E69170E174800AB2799 /* CachedSVGDocumentClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEF4E68170E174800AB2799 /* CachedSVGDocumentClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AF326790D78B9440068F0C4 /* EditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF326770D78B9440068F0C4 /* EditorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AF4CEEC18BC3C1B00BC2D34 /* VisitedLinkStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF4CEEB18BC3C1B00BC2D34 /* VisitedLinkStore.cpp */; };
+		1AF5E4D41E56735B004A1F01 /* PasteboardWriterData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF5E4D21E56735A004A1F01 /* PasteboardWriterData.cpp */; };
+		1AF5E4D51E56735B004A1F01 /* PasteboardWriterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF5E4D31E56735A004A1F01 /* PasteboardWriterData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		1AF5E4E21E5779B1004A1F01 /* PasteboardWriter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF5E4E01E5779B1004A1F01 /* PasteboardWriter.mm */; };
+		1AF5E4E31E5779B1004A1F01 /* PasteboardWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF5E4E11E5779B1004A1F01 /* PasteboardWriter.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AF62EE614DA22A70041556C /* ScrollingCoordinatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF62EE314DA22A70041556C /* ScrollingCoordinatorMac.mm */; };
 		1AF62EE714DA22A70041556C /* ScrollingCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF62EE414DA22A70041556C /* ScrollingCoordinator.cpp */; };
 		1AF62EE814DA22A70041556C /* ScrollingCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF62EE514DA22A70041556C /* ScrollingCoordinator.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7832,6 +7836,7 @@
 		1A2AAC570DC2A3B100A20D9A /* ApplicationCacheStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationCacheStorage.h; sourceTree = "<group>"; };
 		1A2E6E580CC55213004A2062 /* SQLValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLValue.h; sourceTree = "<group>"; };
 		1A2E6E780CC556D5004A2062 /* SQLiteAuthorizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteAuthorizer.cpp; sourceTree = "<group>"; };
+		1A2F67891E577ABD00997FD1 /* NSPasteboardSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSPasteboardSPI.h; sourceTree = "<group>"; };
 		1A3586DD15264C450022A659 /* RenderMultiColumnFlowThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMultiColumnFlowThread.cpp; sourceTree = "<group>"; };
 		1A3586DE15264C450022A659 /* RenderMultiColumnFlowThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMultiColumnFlowThread.h; sourceTree = "<group>"; };
 		1A3763691A2E68BB009A7EE2 /* StorageNamespaceProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespaceProvider.cpp; sourceTree = "<group>"; };
@@ -8129,6 +8134,10 @@
 		1AEF4E68170E174800AB2799 /* CachedSVGDocumentClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGDocumentClient.h; sourceTree = "<group>"; };
 		1AF326770D78B9440068F0C4 /* EditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorClient.h; sourceTree = "<group>"; };
 		1AF4CEEB18BC3C1B00BC2D34 /* VisitedLinkStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkStore.cpp; sourceTree = "<group>"; };
+		1AF5E4D21E56735A004A1F01 /* PasteboardWriterData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PasteboardWriterData.cpp; sourceTree = "<group>"; };
+		1AF5E4D31E56735A004A1F01 /* PasteboardWriterData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasteboardWriterData.h; sourceTree = "<group>"; };
+		1AF5E4E01E5779B1004A1F01 /* PasteboardWriter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PasteboardWriter.mm; sourceTree = "<group>"; };
+		1AF5E4E11E5779B1004A1F01 /* PasteboardWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasteboardWriter.h; sourceTree = "<group>"; };
 		1AF62EE314DA22A70041556C /* ScrollingCoordinatorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingCoordinatorMac.mm; sourceTree = "<group>"; };
 		1AF62EE414DA22A70041556C /* ScrollingCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingCoordinator.cpp; sourceTree = "<group>"; };
 		1AF62EE514DA22A70041556C /* ScrollingCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingCoordinator.h; sourceTree = "<group>"; };
@@ -18063,6 +18072,8 @@
 				93500F3113FDE3BE0099EC24 /* NSScrollerImpDetails.h */,
 				52F52E1014A0134F00ACC397 /* NSScrollerImpDetails.mm */,
 				4B2709810AF2E5E00065127F /* PasteboardMac.mm */,
+				1AF5E4E01E5779B1004A1F01 /* PasteboardWriter.mm */,
+				1AF5E4E11E5779B1004A1F01 /* PasteboardWriter.h */,
 				CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */,
 				CDEA762F146084EE008B31F1 /* PlatformClockCA.h */,
 				CDAA8D0714D385600061EA60 /* PlatformClockCM.h */,
@@ -19034,6 +19045,7 @@
 				1C6466271A12C3F90094603C /* NSFontSPI.h */,
 				9321D58F1A3906FA008052BE /* NSImmediateActionGestureRecognizerSPI.h */,
 				937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */,
+				1A2F67891E577ABD00997FD1 /* NSPasteboardSPI.h */,
 				93F1E1EB1A40FDDC00348D13 /* NSPopoverSPI.h */,
 				7C0406121C66EE9C00AF0711 /* NSScrollerImpSPI.h */,
 				F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */,
@@ -22961,6 +22973,8 @@
 				E1513D501677F08800149FCB /* NotImplemented.cpp */,
 				98EB1F941313FE0500D0E1EA /* NotImplemented.h */,
 				4B2708C50AF19EE40065127F /* Pasteboard.h */,
+				1AF5E4D21E56735A004A1F01 /* PasteboardWriterData.cpp */,
+				1AF5E4D31E56735A004A1F01 /* PasteboardWriterData.h */,
 				C5F765B414E1D414006C899B /* PasteboardStrategy.h */,
 				A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */,
 				BC5C76291497FE1400BC4775 /* PlatformEvent.h */,
@@ -25584,6 +25598,7 @@
 				D0B0556809C6700100307E43 /* CreateLinkCommand.h in Headers */,
 				514C766E0CE923A1007EF3CD /* Credential.h in Headers */,
 				3792917A1985EF3900F4B661 /* CredentialBase.h in Headers */,
+				1AF5E4E31E5779B1004A1F01 /* PasteboardWriter.h in Headers */,
 				3792917E1987678F00F4B661 /* CredentialCocoa.h in Headers */,
 				51A052331058774F00CC9E95 /* CredentialStorage.h in Headers */,
 				2D481F02146B5C5500AA7834 /* CrossfadeGeneratedImage.h in Headers */,
@@ -25832,6 +25847,7 @@
 				2D29ECC6192ECC8300984B78 /* DisplayRefreshMonitorClient.h in Headers */,
 				2D29ECCA192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h in Headers */,
 				2DE70023192FE82A00B0975C /* DisplayRefreshMonitorMac.h in Headers */,
+				1AF5E4D51E56735B004A1F01 /* PasteboardWriterData.h in Headers */,
 				2D29ECC8192ECC8300984B78 /* DisplayRefreshMonitorManager.h in Headers */,
 				CD52481B18E200ED0008A07D /* DisplaySleepDisabler.h in Headers */,
 				5D8C4DC01428222C0026CE72 /* DisplaySleepDisablerCocoa.h in Headers */,
@@ -31134,6 +31150,7 @@
 				9493B6BE1D74B4120088E780 /* MediaQueryBlockWatcher.cpp in Sources */,
 				4E19592B0A39DACC00220FE5 /* MediaQueryEvaluator.cpp in Sources */,
 				7CB5CA3F1E525C7100FAEF13 /* MediaQueryExpression.cpp in Sources */,
+				1AF5E4D41E56735B004A1F01 /* PasteboardWriterData.cpp in Sources */,
 				D3A94A38122DABAC00A37BBC /* MediaQueryList.cpp in Sources */,
 				D3AA10F3123A98AA0092152B /* MediaQueryMatcher.cpp in Sources */,
 				9493B6C01D74B4120088E780 /* MediaQueryParser.cpp in Sources */,
@@ -31751,6 +31768,7 @@
 				A78FE13B12366B1000ACE8D0 /* SpellChecker.cpp in Sources */,
 				B8DBDB4D130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp in Sources */,
 				4512502215DCE37D002F84E2 /* SpinButtonElement.cpp in Sources */,
+				1AF5E4E21E5779B1004A1F01 /* PasteboardWriter.mm in Sources */,
 				93309E11099E64920056E581 /* SplitElementCommand.cpp in Sources */,
 				93309E13099E64920056E581 /* SplitTextNodeCommand.cpp in Sources */,
 				93309E15099E64920056E581 /* SplitTextNodeContainingElementCommand.cpp in Sources */,

Added: trunk/Source/WebCore/platform/PasteboardWriterData.cpp (0 => 212563)


--- trunk/Source/WebCore/platform/PasteboardWriterData.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/PasteboardWriterData.cpp	2017-02-17 20:02:03 UTC (rev 212563)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include "config.h"
+#include "PasteboardWriterData.h"
+
+namespace WebCore {
+
+PasteboardWriterData::PasteboardWriterData()
+{
+}
+
+PasteboardWriterData::~PasteboardWriterData()
+{
+}
+
+bool PasteboardWriterData::isEmpty() const
+{
+    if (m_plainText)
+        return false;
+
+    return true;
+}
+
+void PasteboardWriterData::setPlainText(PlainText plainText)
+{
+    ASSERT(!m_plainText);
+
+    m_plainText = WTFMove(plainText);
+}
+
+}

Added: trunk/Source/WebCore/platform/PasteboardWriterData.h (0 => 212563)


--- trunk/Source/WebCore/platform/PasteboardWriterData.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/PasteboardWriterData.h	2017-02-17 20:02:03 UTC (rev 212563)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+#include <wtf/Optional.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class PasteboardWriterData final {
+public:
+    PasteboardWriterData();
+    ~PasteboardWriterData();
+
+    struct PlainText {
+        bool canSmartCopyOrDelete;
+        String text;
+    };
+
+    WEBCORE_EXPORT bool isEmpty() const;
+
+    const std::optional<PlainText>& plainText() const { return m_plainText; }
+    void setPlainText(PlainText);
+
+private:
+    std::optional<PlainText> m_plainText;
+};
+
+}

Added: trunk/Source/WebCore/platform/mac/PasteboardWriter.h (0 => 212563)


--- trunk/Source/WebCore/platform/mac/PasteboardWriter.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/mac/PasteboardWriter.h	2017-02-17 20:02:03 UTC (rev 212563)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+#if PLATFORM(MAC)
+
+#import <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+class PasteboardWriterData;
+
+WEBCORE_EXPORT RetainPtr<id <NSPasteboardWriting>> createPasteboardWriting(const PasteboardWriterData&);
+
+}
+
+#endif

Added: trunk/Source/WebCore/platform/mac/PasteboardWriter.mm (0 => 212563)


--- trunk/Source/WebCore/platform/mac/PasteboardWriter.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/mac/PasteboardWriter.mm	2017-02-17 20:02:03 UTC (rev 212563)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2017 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 "PasteboardWriter.h"
+
+#if PLATFORM(MAC)
+
+#import "NSPasteboardSPI.h"
+#import "PasteboardWriterData.h"
+
+namespace WebCore {
+
+RetainPtr<id <NSPasteboardWriting>> createPasteboardWriting(const PasteboardWriterData& data)
+{
+    auto pasteboardItem = adoptNS([[NSPasteboardItem alloc] init]);
+
+    if (auto& plainText = data.plainText()) {
+        [pasteboardItem setString:plainText->text forType:NSPasteboardTypeString];
+        if (plainText->canSmartCopyOrDelete)
+            [pasteboardItem setData:nil forType:_NXSmartPaste];
+    }
+
+    return pasteboardItem;
+}
+
+}
+
+#endif

Added: trunk/Source/WebCore/platform/spi/mac/NSPasteboardSPI.h (0 => 212563)


--- trunk/Source/WebCore/platform/spi/mac/NSPasteboardSPI.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/spi/mac/NSPasteboardSPI.h	2017-02-17 20:02:03 UTC (rev 212563)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+// FIXME: This should include AppKit/AppKitPrivate.h when using the internal SDK,
+// but that file won't compile as C++.
+
+extern NSString *_NXSmartPaste;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to