Changeset 173687 in webkit
- Timestamp:
- Sep 17, 2014 12:05:45 AM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r173686 r173687 1 2014-09-16 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Fix layering violations in PasteboardGtk 4 https://bugs.webkit.org/show_bug.cgi?id=136802 5 6 Reviewed by Darin Adler. 7 8 Refactor the Pasteboard code moving the WebCore parts to the Editor. 9 10 * PlatformGTK.cmake: Add new file to compilation. 11 * editing/Editor.cpp: 12 (WebCore::Editor::performCutOrCopy): 13 (WebCore::Editor::copyImage): 14 * editing/Editor.h: 15 * editing/gtk/EditorGtk.cpp: Added. 16 (WebCore::createFragmentFromPasteBoardData): 17 (WebCore::Editor::pasteWithPasteboard): 18 (WebCore::getImageAndURLForElement): 19 (WebCore::Editor::writeImageToPasteboard): 20 (WebCore::Editor::writeSelectionToPasteboard): 21 * page/DragController.cpp: 22 (WebCore::DragController::startDrag): 23 * page/gtk/DragControllerGtk.cpp: 24 (WebCore::DragController::declareAndWriteDragImage): 25 * platform/Pasteboard.h: 26 * platform/gtk/DataObjectGtk.cpp: Remove range member, the caller 27 should call setText() + setMarkup() intead. 28 (WebCore::DataObjectGtk::setText): 29 (WebCore::DataObjectGtk::setMarkup): 30 (WebCore::DataObjectGtk::clearText): 31 (WebCore::DataObjectGtk::clearMarkup): 32 (WebCore::DataObjectGtk::clearAllExceptFilenames): 33 * platform/gtk/DataObjectGtk.h: 34 (WebCore::DataObjectGtk::hasText): 35 (WebCore::DataObjectGtk::hasMarkup): 36 (WebCore::DataObjectGtk::clearImage): 37 (WebCore::DataObjectGtk::text): 38 (WebCore::DataObjectGtk::markup): 39 (WebCore::DataObjectGtk::setRange): Deleted. 40 * platform/gtk/GtkDragAndDropHelper.h: 41 * platform/gtk/PasteboardGtk.cpp: 42 (WebCore::PasteboardImage::PasteboardImage): 43 (WebCore::PasteboardImage::~PasteboardImage): 44 (WebCore::Pasteboard::write): 45 (WebCore::Pasteboard::writeSelection): Deleted. 46 (WebCore::getURLForImageElement): Deleted. 47 (WebCore::Pasteboard::writeImage): Deleted. 48 (WebCore::Pasteboard::documentFragment): Deleted. 49 * platform/gtk/PasteboardHelper.cpp: 50 (WebCore::displayFromFrame): Deleted. 51 (WebCore::PasteboardHelper::getPrimarySelectionClipboard): Deleted. 52 * platform/gtk/PasteboardHelper.h: 53 1 54 2014-09-16 Carlos Garcia Campos <cgarcia@igalia.com> 2 55 -
trunk/Source/WebCore/PlatformGTK.cmake
r173651 r173687 181 181 182 182 editing/atk/FrameSelectionAtk.cpp 183 editing/gtk/EditorGtk.cpp 183 184 184 185 page/gtk/DragControllerGtk.cpp -
trunk/Source/WebCore/editing/Editor.cpp
r173665 r173687 563 563 #endif 564 564 565 #if !PLATFORM(COCOA) && !PLATFORM(EFL) 565 #if !PLATFORM(COCOA) && !PLATFORM(EFL) && !PLATFORM(GTK) 566 566 void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, MailBlockquoteHandling mailBlockquoteHandling) 567 567 { … … 1325 1325 1326 1326 if (imageElement) { 1327 #if PLATFORM(COCOA) || PLATFORM(EFL) 1327 #if PLATFORM(COCOA) || PLATFORM(EFL) || PLATFORM(GTK) 1328 1328 writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *imageElement, document().url(), document().title()); 1329 1329 #else … … 1331 1331 #endif 1332 1332 } else { 1333 #if PLATFORM(COCOA) || PLATFORM(EFL) 1333 #if PLATFORM(COCOA) || PLATFORM(EFL) || PLATFORM(GTK) 1334 1334 writeSelectionToPasteboard(*Pasteboard::createForCopyAndPaste()); 1335 1335 #else … … 1437 1437 url = result.absoluteImageURL(); 1438 1438 1439 #if PLATFORM(COCOA) || PLATFORM(EFL) 1439 #if PLATFORM(COCOA) || PLATFORM(EFL) || PLATFORM(GTK) 1440 1440 writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *element, url, result.altDisplayString()); 1441 1441 #else -
trunk/Source/WebCore/editing/Editor.h
r173235 r173687 444 444 #endif 445 445 446 #if PLATFORM(COCOA) || PLATFORM(EFL) 446 #if PLATFORM(COCOA) || PLATFORM(EFL) || PLATFORM(GTK) 447 447 WEBCORE_EXPORT void writeSelectionToPasteboard(Pasteboard&); 448 448 WEBCORE_EXPORT void writeImageToPasteboard(Pasteboard&, Element& imageElement, const URL&, const String& title); -
trunk/Source/WebCore/page/DragController.cpp
r173686 r173687 784 784 dataTransfer.pasteboard().writePlainText(src.editor().selectedTextForDataTransfer(), Pasteboard::CannotSmartReplace); 785 785 else { 786 #if PLATFORM(COCOA) || PLATFORM(EFL) 786 #if PLATFORM(COCOA) || PLATFORM(EFL) || PLATFORM(GTK) 787 787 src.editor().writeSelectionToPasteboard(dataTransfer.pasteboard()); 788 788 #else -
trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp
r173686 r173687 32 32 #include "DocumentFragment.h" 33 33 #include "DragData.h" 34 #include "Editor.h" 34 35 #include "Element.h" 35 36 #include "Frame.h" … … 76 77 void DragController::declareAndWriteDragImage(DataTransfer& dataTransfer, Element& element, const URL& url, const String& label) 77 78 { 78 dataTransfer.pasteboard().writeImage(element, url, label); 79 Frame* frame = element.document().frame(); 80 ASSERT(frame); 81 frame->editor().writeImageToPasteboard(dataTransfer.pasteboard(), element, url, label); 79 82 } 80 83 -
trunk/Source/WebCore/platform/Pasteboard.h
r172862 r173687 35 35 #if PLATFORM(GTK) 36 36 typedef struct _GtkClipboard GtkClipboard; 37 #include <wtf/gobject/GRefPtr.h> 37 38 #endif 38 39 … … 79 80 Vector<RefPtr<SharedBuffer>> clientData; 80 81 #endif 82 #if PLATFORM(GTK) 83 bool canSmartCopyOrDelete; 84 String text; 85 String markup; 86 GRefPtr<GClosure> callback; 87 #endif 81 88 }; 82 89 … … 86 93 #if PLATFORM(MAC) 87 94 String userVisibleForm; 95 #endif 96 #if PLATFORM(GTK) 97 String markup; 88 98 #endif 89 99 }; … … 93 103 WEBCORE_EXPORT ~PasteboardImage(); 94 104 RefPtr<Image> image; 105 #if !(PLATFORM(EFL) || PLATFORM(WIN)) 106 PasteboardURL url; 107 #endif 95 108 #if !(PLATFORM(EFL) || PLATFORM(GTK) || PLATFORM(WIN)) 96 PasteboardURL url;97 109 RefPtr<SharedBuffer> resourceData; 98 110 String resourceMIMEType; … … 163 175 #endif 164 176 165 #if PLATFORM( GTK) || PLATFORM(WIN)177 #if PLATFORM(WIN) 166 178 PassRefPtr<DocumentFragment> documentFragment(Frame&, Range&, bool allowPlainText, bool& chosePlainText); // FIXME: Layering violation. 167 179 void writeImage(Element&, const URL&, const String& title); // FIXME: Layering violation. -
trunk/Source/WebCore/platform/gtk/DataObjectGtk.cpp
r163797 r173687 20 20 #include "DataObjectGtk.h" 21 21 22 #include "markup.h"23 22 #include <gtk/gtk.h> 24 23 #include <wtf/gobject/GUniquePtr.h> 24 #include <wtf/text/CString.h> 25 25 #include <wtf/text/StringBuilder.h> 26 26 … … 34 34 } 35 35 36 String DataObjectGtk::text() const37 {38 if (m_range) {39 String text = m_range->text();40 replaceNonBreakingSpaceWithSpace(text);41 return text;42 }43 return m_text;44 }45 46 String DataObjectGtk::markup() const47 {48 if (m_range)49 return createMarkup(*m_range, 0, AnnotateForInterchange, false, ResolveNonLocalURLs);50 return m_markup;51 }52 53 36 HashMap<String, String> DataObjectGtk::unknownTypes() const 54 37 { … … 58 41 void DataObjectGtk::setText(const String& newText) 59 42 { 60 m_range = 0;61 43 m_text = newText; 62 44 replaceNonBreakingSpaceWithSpace(m_text); … … 65 47 void DataObjectGtk::setMarkup(const String& newMarkup) 66 48 { 67 m_range = 0;68 49 m_markup = newMarkup; 69 50 } … … 132 113 void DataObjectGtk::clearText() 133 114 { 134 m_range = 0; 135 m_text = ""; 115 m_text = emptyString(); 136 116 } 137 117 138 118 void DataObjectGtk::clearMarkup() 139 119 { 140 m_range = 0; 141 m_markup = ""; 120 m_markup = emptyString(); 142 121 } 143 122 … … 155 134 void DataObjectGtk::clearAllExceptFilenames() 156 135 { 157 m_text = "";158 m_markup = "";159 m_uriList = "";136 m_text = emptyString(); 137 m_markup = emptyString(); 138 m_uriList = emptyString(); 160 139 m_url = URL(); 161 m_image = 0; 162 m_range = 0; 140 m_image = nullptr; 163 141 m_unknownTypeData.clear(); 164 142 } -
trunk/Source/WebCore/platform/gtk/DataObjectGtk.h
r159837 r173687 22 22 #include "FileList.h" 23 23 #include "URL.h" 24 #include "Range.h"25 24 #include <wtf/RefCounted.h> 26 25 #include <wtf/gobject/GRefPtr.h> 27 #include <wtf/text/CString.h>28 26 #include <wtf/text/StringHash.h> 29 27 … … 41 39 const Vector<String>& filenames() const { return m_filenames; } 42 40 GdkPixbuf* image() const { return m_image.get(); } 43 void setRange(PassRefPtr<Range> newRange) { m_range = newRange; }44 41 void setImage(GdkPixbuf* newImage) { m_image = newImage; } 45 42 void setURL(const URL&, const String&); 46 43 bool hasUnknownTypeData() const { return !m_unknownTypeData.isEmpty(); } 47 bool hasText() const { return m_range ||!m_text.isEmpty(); }48 bool hasMarkup() const { return m_range ||!m_markup.isEmpty(); }44 bool hasText() const { return !m_text.isEmpty(); } 45 bool hasMarkup() const { return !m_markup.isEmpty(); } 49 46 bool hasURIList() const { return !m_uriList.isEmpty(); } 50 47 bool hasURL() const { return !m_url.isEmpty() && m_url.isValid(); } … … 53 50 void clearURIList() { m_uriList = ""; } 54 51 void clearURL() { m_url = URL(); } 55 void clearImage() { m_image = 0; }52 void clearImage() { m_image = nullptr; } 56 53 57 String text() const ;58 String markup() const ;54 String text() const { return m_text; } 55 String markup() const { return m_markup; } 59 56 String unknownTypeData(const String& type) const { return m_unknownTypeData.get(type); } 60 57 HashMap<String, String> unknownTypes() const; … … 79 76 Vector<String> m_filenames; 80 77 GRefPtr<GdkPixbuf> m_image; 81 RefPtr<Range> m_range;82 78 HashMap<String, String> m_unknownTypeData; 83 79 }; -
trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h
r157058 r173687 28 28 struct DroppingContext; 29 29 class DragData; 30 class IntPoint; 30 31 31 32 typedef void (*DragExitedCallback)(GtkWidget*, DragData&, bool dropHappened); -
trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp
r169327 r173687 21 21 #include "Pasteboard.h" 22 22 23 #include "CachedImage.h"24 23 #include "DataObjectGtk.h" 25 #include "DocumentFragment.h"26 24 #include "DragData.h" 27 #include "Editor.h"28 #include "Frame.h"29 #include "HTMLImageElement.h"30 #include "HTMLInputElement.h"31 #include "HTMLNames.h"32 #include "HTMLParserIdioms.h"33 25 #include "Image.h" 34 26 #include "URL.h" 35 27 #include "PasteboardHelper.h" 36 #include "RenderImage.h"37 #include "SVGElement.h"38 #include "SVGNames.h"39 #include "XLinkNames.h"40 #include "markup.h"41 28 #include <gtk/gtk.h> 42 29 #include <wtf/PassOwnPtr.h> 43 30 44 31 namespace WebCore { … … 89 76 } 90 77 #endif 78 79 // Making this non-inline so that WebKit 2's decoding doesn't have to include Image.h. 80 PasteboardImage::PasteboardImage() 81 { 82 } 83 84 PasteboardImage::~PasteboardImage() 85 { 86 } 91 87 92 88 Pasteboard::Pasteboard(PassRefPtr<DataObjectGtk> dataObject) … … 157 153 } 158 154 159 void Pasteboard::writeSelection(Range& selectedRange, bool canSmartCopyOrDelete, Frame& frame, ShouldSerializeSelectedTextForDataTransfer shouldSerializeSelectedTextForDataTransfer)160 {161 m_dataObject->clearAll();162 m_dataObject->setText(shouldSerializeSelectedTextForDataTransfer == IncludeImageAltTextForDataTransfer ? frame.editor().selectedTextForDataTransfer() : frame.editor().selectedText());163 m_dataObject->setMarkup(createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs));164 165 if (m_gtkClipboard)166 PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_gtkClipboard, canSmartCopyOrDelete ? PasteboardHelper::IncludeSmartPaste : PasteboardHelper::DoNotIncludeSmartPaste);167 }168 169 155 void Pasteboard::writePlainText(const String& text, SmartReplaceOption smartReplaceOption) 170 156 { … … 187 173 } 188 174 189 static URL getURLForImageElement(Element& element) 190 { 191 // FIXME: Later this code should be shared with Chromium somehow. Chances are all platforms want it. 192 AtomicString urlString; 193 if (isHTMLImageElement(element) || isHTMLInputElement(element)) 194 urlString = element.getAttribute(HTMLNames::srcAttr); 195 else if (element.hasTagName(SVGNames::imageTag)) 196 urlString = element.getAttribute(XLinkNames::hrefAttr); 197 else if (element.hasTagName(HTMLNames::embedTag) || isHTMLObjectElement(element)) 198 urlString = element.imageSourceURL(); 199 200 return urlString.isEmpty() ? URL() : element.document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString)); 201 } 202 203 void Pasteboard::writeImage(Element& element, const URL&, const String& title) 204 { 205 if (!(element.renderer() && element.renderer()->isRenderImage())) 206 return; 207 208 RenderImage* renderer = toRenderImage(element.renderer()); 209 CachedImage* cachedImage = renderer->cachedImage(); 210 if (!cachedImage || cachedImage->errorOccurred()) 211 return; 212 Image* image = cachedImage->imageForRenderer(renderer); 213 ASSERT(image); 214 215 m_dataObject->clearAll(); 216 217 URL url = getURLForImageElement(element); 218 if (!url.isEmpty()) { 219 m_dataObject->setURL(url, title); 220 221 m_dataObject->setMarkup(createMarkup(element, IncludeNode, 0, ResolveAllURLs)); 222 } 223 224 GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->getGdkPixbuf()); 225 m_dataObject->setImage(pixbuf.get()); 226 227 if (m_gtkClipboard) 228 PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_gtkClipboard); 175 void Pasteboard::write(const PasteboardImage& pasteboardImage) 176 { 177 m_dataObject->clearAll(); 178 if (!pasteboardImage.url.url.isEmpty()) { 179 m_dataObject->setURL(pasteboardImage.url.url, pasteboardImage.url.title); 180 m_dataObject->setMarkup(pasteboardImage.url.markup); 181 } 182 183 GRefPtr<GdkPixbuf> pixbuf = adoptGRef(pasteboardImage.image->getGdkPixbuf()); 184 if (pixbuf) 185 m_dataObject->setImage(pixbuf.get()); 186 187 if (m_gtkClipboard) 188 PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_gtkClipboard); 189 } 190 191 void Pasteboard::write(const PasteboardWebContent& pasteboardContent) 192 { 193 m_dataObject->clearAll(); 194 m_dataObject->setText(pasteboardContent.text); 195 m_dataObject->setMarkup(pasteboardContent.markup); 196 197 if (m_gtkClipboard) 198 PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_gtkClipboard, pasteboardContent.canSmartCopyOrDelete ? PasteboardHelper::IncludeSmartPaste : PasteboardHelper::DoNotIncludeSmartPaste, pasteboardContent.callback.get()); 229 199 } 230 200 … … 303 273 #endif 304 274 305 PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame& frame, Range& context, bool allowPlainText, bool& chosePlainText)306 {307 if (m_gtkClipboard)308 PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_gtkClipboard);309 310 chosePlainText = false;311 312 if (m_dataObject->hasMarkup()) {313 if (frame.document()) {314 RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(*frame.document(), m_dataObject->markup(), emptyString(), DisallowScriptingAndPluginContent);315 if (fragment)316 return fragment.release();317 }318 }319 320 if (!allowPlainText)321 return 0;322 323 if (m_dataObject->hasText()) {324 chosePlainText = true;325 RefPtr<DocumentFragment> fragment = createFragmentFromText(context, m_dataObject->text());326 if (fragment)327 return fragment.release();328 }329 330 return 0;331 }332 333 275 void Pasteboard::read(PasteboardPlainText& text) 334 276 { -
trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp
r173350 r173687 24 24 #include "PasteboardHelper.h" 25 25 26 #include "Chrome.h"27 26 #include "DataObjectGtk.h" 28 #include "Frame.h"29 27 #include "GRefPtrGtk.h" 30 28 #include "GtkVersioning.h" 31 #include "Page.h"32 29 #include "Pasteboard.h" 33 30 #include "TextResourceDecoder.h" 34 31 #include <gtk/gtk.h> 35 32 #include <wtf/gobject/GUniquePtr.h> 33 #include <wtf/text/CString.h> 36 34 37 35 namespace WebCore { … … 94 92 { 95 93 gtk_target_list_unref(m_targetList); 96 }97 98 static inline GdkDisplay* displayFromFrame(Frame* frame)99 {100 ASSERT(frame);101 Page* page = frame->page();102 ASSERT(page);103 PlatformPageClient client = page->chrome().platformPageClient();104 return client ? gtk_widget_get_display(client) : gdk_display_get_default();105 }106 107 GtkClipboard* PasteboardHelper::getPrimarySelectionClipboard(Frame* frame) const108 {109 return gtk_clipboard_get_for_display(displayFromFrame(frame), GDK_SELECTION_PRIMARY);110 94 } 111 95 … … 310 294 return; 311 295 312 G Closure* callback = static_cast<GClosure*>(data);296 GRefPtr<GClosure> callback = adoptGRef(static_cast<GClosure*>(data)); 313 297 GValue firstArgument = {0, {{0}}}; 314 298 g_value_init(&firstArgument, G_TYPE_POINTER); 315 299 g_value_set_pointer(&firstArgument, clipboard); 316 g_closure_invoke(callback, 0, 1, &firstArgument, 0); 317 g_closure_unref(callback); 300 g_closure_invoke(callback.get(), nullptr, 1, &firstArgument, 0); 318 301 } 319 302 … … 329 312 settingClipboardDataObject = dataObject; 330 313 331 gtk_clipboard_set_with_data(clipboard, table, numberOfTargets, 332 getClipboardContentsCallback, clearClipboardContentsCallback, callback); 333 gtk_clipboard_set_can_store(clipboard, 0, 0); 334 335 settingClipboardDataObject = 0; 314 if (gtk_clipboard_set_with_data(clipboard, table, numberOfTargets, getClipboardContentsCallback, clearClipboardContentsCallback, g_closure_ref(callback))) 315 gtk_clipboard_set_can_store(clipboard, nullptr, 0); 316 else { 317 // When gtk_clipboard_set_with_data fails the callbacks are ignored, so we need to release the reference we were passing to clearClipboardContentsCallback. 318 g_closure_unref(callback); 319 } 320 321 settingClipboardDataObject = nullptr; 336 322 337 323 } else -
trunk/Source/WebCore/platform/gtk/PasteboardHelper.h
r154750 r173687 26 26 #define PasteboardHelper_h 27 27 28 #include "Frame.h"29 28 #include <glib-object.h> 29 #include <wtf/Vector.h> 30 30 31 31 namespace WebCore { … … 41 41 enum SmartPasteInclusion { IncludeSmartPaste, DoNotIncludeSmartPaste }; 42 42 43 GtkClipboard* getPrimarySelectionClipboard(Frame*) const;44 43 GtkTargetList* targetList() const; 45 44 GtkTargetList* targetListForDataObject(DataObjectGtk*, SmartPasteInclusion = DoNotIncludeSmartPaste); -
trunk/Source/WebKit2/ChangeLog
r173686 r173687 1 2014-09-16 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Fix layering violations in PasteboardGtk 4 https://bugs.webkit.org/show_bug.cgi?id=136802 5 6 Reviewed by Darin Adler. 7 8 * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: 9 (WebKit::WebEditorClient::updateGlobalSelection): Use new API to 10 update the global selection. 11 1 12 2014-09-16 Carlos Garcia Campos <cgarcia@igalia.com> 2 13 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
r170774 r173687 21 21 #include "WebEditorClient.h" 22 22 23 #include "Frame.h"24 #include "FrameDestructionObserver.h"25 23 #include "PlatformKeyboardEvent.h" 26 24 #include "WebPage.h" … … 29 27 #include <WebCore/DataObjectGtk.h> 30 28 #include <WebCore/Document.h> 29 #include <WebCore/Frame.h> 30 #include <WebCore/FrameDestructionObserver.h> 31 31 #include <WebCore/KeyboardEvent.h> 32 #include <WebCore/Pasteboard Helper.h>32 #include <WebCore/Pasteboard.h> 33 33 #include <WebCore/WindowsKeyboardCodes.h> 34 #include <WebCore/markup.h> 35 #include <wtf/gobject/GRefPtr.h> 34 36 35 37 using namespace WebCore; … … 176 178 { 177 179 #if PLATFORM(X11) 178 GtkClipboard* clipboard = PasteboardHelper::defaultPasteboardHelper()->getPrimarySelectionClipboard(frame);179 DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);180 181 180 if (!frame->selection().isRange()) 182 181 return; 183 182 184 dataObject->clearAll();185 dataObject->setRange(frame->selection().toNormalizedRange());186 187 183 frameSettingClipboard = frame; 188 G Closure* callback = g_cclosure_new(G_CALLBACK(collapseSelection), frame, 0);184 GRefPtr<GClosure> callback = adoptGRef(g_cclosure_new(G_CALLBACK(collapseSelection), frame, nullptr)); 189 185 // This observer will be self-destroyed on closure finalization, 190 186 // that will happen either after closure execution or after 191 187 // closure invalidation. 192 new EditorClientFrameDestructionObserver(frame, callback); 193 g_closure_set_marshal(callback, g_cclosure_marshal_VOID__VOID); 194 PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard, PasteboardHelper::DoNotIncludeSmartPaste, callback); 195 frameSettingClipboard = 0; 188 new EditorClientFrameDestructionObserver(frame, callback.get()); 189 g_closure_set_marshal(callback.get(), g_cclosure_marshal_VOID__VOID); 190 191 RefPtr<Range> range = frame->selection().toNormalizedRange(); 192 PasteboardWebContent pasteboardContent; 193 pasteboardContent.canSmartCopyOrDelete = false; 194 pasteboardContent.text = range->text(); 195 pasteboardContent.markup = createMarkup(*range, nullptr, AnnotateForInterchange, false, ResolveNonLocalURLs); 196 pasteboardContent.callback = callback; 197 Pasteboard::createForGlobalSelection()->write(pasteboardContent); 198 frameSettingClipboard = nullptr; 196 199 #endif 197 200 }
Note: See TracChangeset
for help on using the changeset viewer.