Changeset 286861 in webkit
- Timestamp:
- Dec 10, 2021, 11:02:55 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
platform/Pasteboard.cpp (modified) (1 diff)
-
platform/Pasteboard.h (modified) (2 diffs)
-
platform/gtk/PasteboardGtk.cpp (modified) (1 diff)
-
platform/ios/PasteboardIOS.mm (modified) (1 diff)
-
platform/libwpe/PasteboardLibWPE.cpp (modified) (1 diff)
-
platform/mac/PasteboardMac.mm (modified) (1 diff)
-
platform/win/PasteboardWin.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286860 r286861 1 2021-12-10 Devin Rousso <drousso@apple.com> 2 3 Add a way to write a `SharedBuffer` to the Pasteboard 4 https://bugs.webkit.org/show_bug.cgi?id=234065 5 6 Reviewed by Wenson Hsieh. 7 8 In order to match the WK1 implementation of `-pasteFont:` <https://webkit.org/b/191379>, we 9 need to be able to write a `SharedBuffer` (with an associated type) to the font pasteboard. 10 11 Create a `struct PasteboardBuffer` to wrap the `SharedBuffer` and `String type` (and a 12 `String contentOrigin` on Cocoa platforms, which is used to decide whether to show a "Paste" 13 callout to the user as a gate on crossorigin content sharing) in a single object. 14 15 Though it isn't used in this patch, `-pasteFont:` <https://webkit.org/b/191379> will use 16 this to write RTF data (which contains the necessary font data). 17 18 No change in behavior. 19 20 * platform/Pasteboard.h: 21 * platform/Pasteboard.cpp: 22 * platform/libwpe/PasteboardLibWPE.cpp: 23 (WebCore::Pasteboard::write): 24 * platform/gtk/PasteboardGtk.cpp: 25 (WebCore::Pasteboard::write): 26 * platform/ios/PasteboardIOS.mm: 27 (WebCore::Pasteboard::write): 28 * platform/mac/PasteboardMac.mm: 29 (WebCore::Pasteboard::write): 30 * platform/win/PasteboardWin.cpp: 31 (WebCore::Pasteboard::write): 32 1 33 2021-12-10 Patrick Griffis <pgriffis@igalia.com> 2 34 -
trunk/Source/WebCore/platform/Pasteboard.cpp
r278253 r286861 38 38 PasteboardImage::PasteboardImage() = default; 39 39 PasteboardImage::~PasteboardImage() = default; 40 41 // Making this non-inline so that WebKit 2's decoding doesn't have to include SharedBuffer.h. 42 PasteboardBuffer::PasteboardBuffer() = default; 43 PasteboardBuffer::~PasteboardBuffer() = default; 40 44 41 45 bool Pasteboard::isSafeTypeForDOMToReadAndWrite(const String& type) -
trunk/Source/WebCore/platform/Pasteboard.h
r278253 r286861 136 136 }; 137 137 138 struct PasteboardBuffer { 139 WEBCORE_EXPORT PasteboardBuffer(); 140 WEBCORE_EXPORT ~PasteboardBuffer(); 141 142 #if PLATFORM(COCOA) 143 String contentOrigin; 144 #endif 145 String type; 146 RefPtr<SharedBuffer> data; 147 }; 148 138 149 // For reading from the pasteboard. 139 150 … … 224 235 virtual WEBCORE_EXPORT void writeTrustworthyWebURLsPboardType(const PasteboardURL&); 225 236 virtual WEBCORE_EXPORT void write(const PasteboardImage&); 237 virtual WEBCORE_EXPORT void write(const PasteboardBuffer&); 226 238 virtual WEBCORE_EXPORT void write(const PasteboardWebContent&); 227 239 -
trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp
r278340 r286861 184 184 } 185 185 186 void Pasteboard::write(const PasteboardBuffer&) 187 { 188 } 189 186 190 void Pasteboard::write(const PasteboardWebContent& pasteboardContent) 187 191 { -
trunk/Source/WebCore/platform/ios/PasteboardIOS.mm
r278253 r286861 129 129 } 130 130 131 void Pasteboard::write(const PasteboardBuffer&) 132 { 133 } 134 131 135 void Pasteboard::writePlainText(const String& text, SmartReplaceOption) 132 136 { -
trunk/Source/WebCore/platform/libwpe/PasteboardLibWPE.cpp
r278340 r286861 124 124 } 125 125 126 void Pasteboard::write(const PasteboardBuffer&) 127 { 128 } 129 126 130 void Pasteboard::write(const PasteboardWebContent& content) 127 131 { -
trunk/Source/WebCore/platform/mac/PasteboardMac.mm
r278253 r286861 299 299 } 300 300 301 void Pasteboard::write(const PasteboardBuffer& pasteboardBuffer) 302 { 303 ASSERT(!pasteboardBuffer.type.isEmpty()); 304 ASSERT(pasteboardBuffer.data); 305 306 m_changeCount = platformStrategies()->pasteboardStrategy()->setTypes({ pasteboardBuffer.type, PasteboardCustomData::cocoaType() }, m_pasteboardName, context()); 307 308 m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(pasteboardBuffer.data.get(), pasteboardBuffer.type, m_pasteboardName, context()); 309 310 PasteboardCustomData pasteboardCustomData; 311 pasteboardCustomData.setOrigin(pasteboardBuffer.contentOrigin); 312 m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(pasteboardCustomData.createSharedBuffer().ptr(), PasteboardCustomData::cocoaType(), m_pasteboardName, context()); 313 } 314 301 315 bool Pasteboard::canSmartReplace() 302 316 { -
trunk/Source/WebCore/platform/win/PasteboardWin.cpp
r286772 r286861 1119 1119 } 1120 1120 1121 void Pasteboard::write(const PasteboardBuffer&) 1122 { 1123 } 1124 1121 1125 void Pasteboard::writeCustomData(const Vector<PasteboardCustomData>& data) 1122 1126 {
Note:
See TracChangeset
for help on using the changeset viewer.