[GTK] Get rid of DataObjectGtk::forClipboard and cleanup pasteboard code
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Sep 2016 16:13:38 +0000 (16:13 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Sep 2016 16:13:38 +0000 (16:13 +0000)
commit03cb1f408773de3fe3b716dab71332d56c7a263f
treeb7d749ec07ab581d39d47d6f046f4f0f2e6a3c7d
parent78a993cddd08e09008f9c36c701e3c154954662f
[GTK] Get rid of DataObjectGtk::forClipboard and cleanup pasteboard code
https://bugs.webkit.org/show_bug.cgi?id=161907

Reviewed by Michael Catanzaro.

Source/WebCore:

We don't really need to keep a DataObjectGtk for every clipboard, we could simply pass the DataObjectGtk to read
and write methods of PasteboardHelper.

* editing/gtk/EditorGtk.cpp:
(WebCore::createFragmentFromPasteboardData): Update for DataObjectGtk API changes.
* platform/Pasteboard.h:
* platform/gtk/DataObjectGtk.cpp: Remove forClipboard() static method.
* platform/gtk/DataObjectGtk.h: Ditto.
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::Pasteboard): Always create a new DataObjectGtk.
(WebCore::Pasteboard::dataObject): Return a const reference instead of a pointer.
(WebCore::Pasteboard::writePlainText): Pass the DataObjectGtk to PasteboardHelper.
(WebCore::Pasteboard::write): Ditto.
(WebCore::Pasteboard::writePasteboard): Ditto.
(WebCore::Pasteboard::clear): Ditto.
(WebCore::Pasteboard::read): Ditto.
(WebCore::Pasteboard::hasData): Ditto.
(WebCore::Pasteboard::types): Ditto.
(WebCore::Pasteboard::readString): Ditto.
(WebCore::Pasteboard::readFilenames): Ditto.
* platform/gtk/PasteboardHelper.cpp:
(WebCore::PasteboardHelper::getClipboardContents): Update the given DataObjectGtk.
(WebCore::PasteboardHelper::fillSelectionData): Use a const reference to DataObjectGtk instead of a pointer.
(WebCore::PasteboardHelper::targetListForDataObject): Ditto.
(WebCore::PasteboardHelper::fillDataObjectFromDropData): Use a reference to DataObjectGtk instead of a pointer.
(WebCore::ClipboardSetData::ClipboardSetData): Helper struct to pass DataObjectGtk and callback to clipboard callbacks.
(WebCore::ClipboardSetData::~ClipboardSetData):
(WebCore::getClipboardContentsCallback): Get the DataObjectGtk from ClipboardSetData struct passed as user data.
(WebCore::clearClipboardContentsCallback): Get the DataObjectGtk and callback from ClipboardSetData struct
passed as user data.
(WebCore::PasteboardHelper::writeClipboardContents): Write the given DataObjectGtk.
* platform/gtk/PasteboardHelper.h:

Source/WebKit2:

Update to DataObjectGtk and PasteboardHelper API changes.

* UIProcess/gtk/DragAndDropHandler.cpp:
(WebKit::DragAndDropHandler::startDrag):
(WebKit::DragAndDropHandler::fillDragData):
(WebKit::DragAndDropHandler::dataObjectForDropData):
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
(WebKit::WebDragClient::startDrag):
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::collapseSelection):
(WebKit::WebEditorClient::updateGlobalSelection): Remove wrong X11 guards, since that code is not X11 specific.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205860 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/editing/gtk/EditorGtk.cpp
Source/WebCore/platform/Pasteboard.h
Source/WebCore/platform/gtk/DataObjectGtk.cpp
Source/WebCore/platform/gtk/DataObjectGtk.h
Source/WebCore/platform/gtk/PasteboardGtk.cpp
Source/WebCore/platform/gtk/PasteboardHelper.cpp
Source/WebCore/platform/gtk/PasteboardHelper.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp
Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp
Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp