Changeset 206197 in webkit


Ignore:
Timestamp:
Sep 20, 2016 11:17:13 PM (8 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Clean up DataObjectGtk handling
https://bugs.webkit.org/show_bug.cgi?id=162267

Reviewed by Michael Catanzaro.

Source/WebCore:

  • platform/Pasteboard.h: Use Ref instead of RefPtr for DataObjectGtk member.
  • platform/PasteboardStrategy.h: Pass a const reference to DataObjectGtk in write method and return a Ref from read.
  • platform/PlatformPasteboard.h: Ditto.
  • platform/gtk/DataObjectGtk.h:

(WebCore::DataObjectGtk::image): Use Image instead of GdkPixbuf.
(WebCore::DataObjectGtk::setImage):

  • platform/gtk/PasteboardGtk.cpp:

(WebCore::Pasteboard::createForDragAndDrop): Use a reference instead of a pointer.
(WebCore::Pasteboard::Pasteboard): Receives a reference, so we can also remove the ASSERT.
(WebCore::Pasteboard::dataObject):
(WebCore::Pasteboard::writeToClipboard): Remove the ShouldIncludeSmartPaste parameter, callers should also update
canSmartPaste property of DataObjectGtk before calling this.
(WebCore::Pasteboard::writePlainText):
(WebCore::Pasteboard::write): Do not convert the image the GdkPixbuf, pass the image to the DataObjectGtk instead.

  • platform/gtk/PasteboardHelper.cpp:

(WebCore::PasteboardHelper::fillSelectionData): Convert the DataObjectGtk image to GdkPixbuf right before
passing it to gtk_selection_data_set_pixbuf().
(WebCore::ClipboardSetData::ClipboardSetData): Use reference instead of pointer.
(WebCore::getClipboardContentsCallback):
(WebCore::clearClipboardContentsCallback): Never clear the saved DataObjectGtk, that was only needed when we had
a global DataObjectGtk associated to a GtkClipboard.
(WebCore::PasteboardHelper::writeClipboardContents): Use TemporaryChange to set the settingClipboardDataObject global.

  • platform/gtk/PlatformPasteboardGtk.cpp:

(WebCore::PlatformPasteboard::writeToClipboard):
(WebCore::PlatformPasteboard::readFromClipboard):

Source/WebKit2:

In some cases the ownership of DataObjectGtk instances is not clear enough, and we have hacks to avoid memory
leaks because of that.

  • Shared/gtk/ArgumentCodersGtk.cpp:

(IPC::encodeImage): Use Image instead of GdkPixbuf.
(IPC::decodeImage): Ditto.
(IPC::ArgumentCoder<DataObjectGtk>::encode):
(IPC::ArgumentCoder<DataObjectGtk>::decode):
(IPC::encode): Deleted.
(IPC::decode): Deleted.
(IPC::ArgumentCoder<DragData>::encode): Deleted.
(IPC::ArgumentCoder<DragData>::decode): Deleted.

  • Shared/gtk/ArgumentCodersGtk.h:
  • Shared/gtk/PasteboardContent.cpp:

(WebKit::PasteboardContent::PasteboardContent): Add empty constructor that creates a new DataObjectGtk, a
constructor that receives a const reference and another one that takes the ownership of the given DataObjectGtk.
(WebKit::PasteboardContent::encode):
(WebKit::PasteboardContent::decode):

  • Shared/gtk/PasteboardContent.h: Use Ref instead of RefPtr for the DataObjectGtk member.
  • UIProcess/API/gtk/PageClientImpl.cpp:

(WebKit::PageClientImpl::startDrag): Transfer the DataObjectGtk to the DragAndDropHandler, instead of using DragData.

  • UIProcess/API/gtk/PageClientImpl.h:
  • UIProcess/PageClient.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::performDragControllerAction): Instead of sending a DragData object to the web process,
send the DataObjectGtk and DragData members needed as parameters.
(WebKit::WebPageProxy::startDrag): Transfer the received DataObjectGtk to page client, instead of using
DragData. Also notify the web process that drag started.

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in: Update StartDrag message parameters.
  • UIProcess/gtk/DragAndDropHandler.cpp:

(WebKit::DragAndDropHandler::DragAndDropHandler): Remove unneeded initialization.
(WebKit::DragAndDropHandler::startDrag): Take ownership of the given DataObjectGtk.

  • UIProcess/gtk/DragAndDropHandler.h:
  • UIProcess/gtk/WebPasteboardProxyGtk.cpp:

(WebKit::WebPasteboardProxy::writeToClipboard):
(WebKit::WebPasteboardProxy::readFromClipboard):

  • WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:

(WebKit::WebPlatformStrategies::writeToClipboard):
(WebKit::WebPlatformStrategies::readFromClipboard):

  • WebProcess/WebCoreSupport/WebPlatformStrategies.h:
  • WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:

(WebKit::convertCairoSurfaceToShareableBitmap):
(WebKit::WebDragClient::startDrag): Do not create a DragData and pass the DataObjectGtk directly to the
message. Also notify the WebPage that drag is about to start.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::performDragControllerAction): Remove explicit DataObjectGtk derefs and simply create a
DragData using the DataObjectGtk pointer as platform data.

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in: Update PerformDragControllerAction message parameters.
Location:
trunk/Source
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206196 r206197  
     12016-09-20  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Clean up DataObjectGtk handling
     4        https://bugs.webkit.org/show_bug.cgi?id=162267
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * platform/Pasteboard.h: Use Ref instead of RefPtr for DataObjectGtk member.
     9        * platform/PasteboardStrategy.h: Pass a const reference to DataObjectGtk in write method and return a Ref from read.
     10        * platform/PlatformPasteboard.h: Ditto.
     11        * platform/gtk/DataObjectGtk.h:
     12        (WebCore::DataObjectGtk::image): Use Image instead of GdkPixbuf.
     13        (WebCore::DataObjectGtk::setImage):
     14        * platform/gtk/PasteboardGtk.cpp:
     15        (WebCore::Pasteboard::createForDragAndDrop): Use a reference instead of a pointer.
     16        (WebCore::Pasteboard::Pasteboard): Receives a reference, so we can also remove the ASSERT.
     17        (WebCore::Pasteboard::dataObject):
     18        (WebCore::Pasteboard::writeToClipboard): Remove the ShouldIncludeSmartPaste parameter, callers should also update
     19        canSmartPaste property of DataObjectGtk before calling this.
     20        (WebCore::Pasteboard::writePlainText):
     21        (WebCore::Pasteboard::write): Do not convert the image the GdkPixbuf, pass the image to the DataObjectGtk instead.
     22        * platform/gtk/PasteboardHelper.cpp:
     23        (WebCore::PasteboardHelper::fillSelectionData): Convert the DataObjectGtk image to GdkPixbuf right before
     24        passing it to gtk_selection_data_set_pixbuf().
     25        (WebCore::ClipboardSetData::ClipboardSetData): Use reference instead of pointer.
     26        (WebCore::getClipboardContentsCallback):
     27        (WebCore::clearClipboardContentsCallback): Never clear the saved DataObjectGtk, that was only needed when we had
     28        a global DataObjectGtk associated to a GtkClipboard.
     29        (WebCore::PasteboardHelper::writeClipboardContents): Use TemporaryChange to set the settingClipboardDataObject global.
     30        * platform/gtk/PlatformPasteboardGtk.cpp:
     31        (WebCore::PlatformPasteboard::writeToClipboard):
     32        (WebCore::PlatformPasteboard::readFromClipboard):
     33
    1342016-09-20  Alex Christensen  <achristensen@webkit.org>
    235
  • trunk/Source/WebCore/platform/Pasteboard.h

    r205909 r206197  
    139139#if PLATFORM(GTK)
    140140    explicit Pasteboard(const String& name);
    141     explicit Pasteboard(RefPtr<DataObjectGtk>&&);
     141    explicit Pasteboard(DataObjectGtk&);
    142142#endif
    143143
     
    221221
    222222#if PLATFORM(GTK)
    223     enum class ShouldIncludeSmartPaste { No, Yes };
    224     void writeToClipboard(ShouldIncludeSmartPaste = ShouldIncludeSmartPaste::No);
     223    void writeToClipboard();
    225224    void readFromClipboard();
    226     RefPtr<DataObjectGtk> m_dataObject;
     225    Ref<DataObjectGtk> m_dataObject;
    227226    String m_name;
    228227#endif
  • trunk/Source/WebCore/platform/PasteboardStrategy.h

    r205909 r206197  
    7474#endif
    7575#if PLATFORM(GTK)
    76     virtual void writeToClipboard(const String& pasteboardName, const RefPtr<DataObjectGtk>&) = 0;
    77     virtual RefPtr<DataObjectGtk> readFromClipboard(const String& pasteboardName) = 0;
     76    virtual void writeToClipboard(const String& pasteboardName, const DataObjectGtk&) = 0;
     77    virtual Ref<DataObjectGtk> readFromClipboard(const String& pasteboardName) = 0;
    7878#endif // PLATFORM(GTK)
    7979protected:
  • trunk/Source/WebCore/platform/PlatformPasteboard.h

    r205909 r206197  
    8787
    8888#if PLATFORM(GTK)
    89     WEBCORE_EXPORT void writeToClipboard(const RefPtr<DataObjectGtk>&, std::function<void()>&& primarySelectionCleared);
    90     WEBCORE_EXPORT RefPtr<DataObjectGtk> readFromClipboard();
     89    WEBCORE_EXPORT void writeToClipboard(const DataObjectGtk&, std::function<void()>&& primarySelectionCleared);
     90    WEBCORE_EXPORT Ref<DataObjectGtk> readFromClipboard();
    9191#endif
    9292
  • trunk/Source/WebCore/platform/gtk/DataObjectGtk.h

    r205909 r206197  
    1919#pragma once
    2020
    21 #include "FileList.h"
     21#include "Image.h"
    2222#include "URL.h"
    2323#include <wtf/HashMap.h>
    2424#include <wtf/RefCounted.h>
    25 #include <wtf/glib/GRefPtr.h>
    2625#include <wtf/text/StringHash.h>
    2726
     
    3837    const String& uriList() const { return m_uriList; }
    3938    const Vector<String>& filenames() const { return m_filenames; }
    40     GdkPixbuf* image() const { return m_image.get(); }
    41     void setImage(GdkPixbuf* newImage) { m_image = newImage; }
     39    Image* image() const { return m_image.get(); }
     40    void setImage(Image* newImage) { m_image = newImage; }
    4241    void setURL(const URL&, const String&);
    4342    bool hasUnknownTypeData() const { return !m_unknownTypeData.isEmpty(); }
     
    7574    String m_uriList;
    7675    Vector<String> m_filenames;
    77     GRefPtr<GdkPixbuf> m_image;
     76    RefPtr<Image> m_image;
    7877    HashMap<String, String> m_unknownTypeData;
    7978    bool m_canSmartReplace { false };
  • trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp

    r205909 r206197  
    6363std::unique_ptr<Pasteboard> Pasteboard::createForDragAndDrop(const DragData& dragData)
    6464{
    65     return std::make_unique<Pasteboard>(dragData.platformData());
     65    ASSERT(dragData.platformData());
     66    return std::make_unique<Pasteboard>(*dragData.platformData());
    6667}
    6768#endif
     
    7677}
    7778
    78 Pasteboard::Pasteboard(RefPtr<DataObjectGtk>&& dataObject)
    79     : m_dataObject(WTFMove(dataObject))
    80 {
    81     ASSERT(m_dataObject);
     79Pasteboard::Pasteboard(DataObjectGtk& dataObject)
     80    : m_dataObject(dataObject)
     81{
    8282}
    8383
     
    9494const DataObjectGtk& Pasteboard::dataObject() const
    9595{
    96     return *m_dataObject;
     96    return m_dataObject.get();
    9797}
    9898
     
    120120}
    121121
    122 void Pasteboard::writeToClipboard(ShouldIncludeSmartPaste shouldIncludeSmartPaste)
     122void Pasteboard::writeToClipboard()
    123123{
    124124    if (m_name.isNull())
    125125        return;
    126     m_dataObject->setCanSmartReplace(shouldIncludeSmartPaste == ShouldIncludeSmartPaste::Yes);
     126
    127127    platformStrategies()->pasteboardStrategy()->writeToClipboard(m_name, m_dataObject);
    128128}
     
    160160    m_dataObject->clearAll();
    161161    m_dataObject->setText(text);
    162 
    163     writeToClipboard(smartReplaceOption == CanSmartReplace ? ShouldIncludeSmartPaste::Yes : ShouldIncludeSmartPaste::No);
     162    m_dataObject->setCanSmartReplace(smartReplaceOption == CanSmartReplace);
     163
     164    writeToClipboard();
    164165}
    165166
     
    181182        m_dataObject->setMarkup(pasteboardImage.url.markup);
    182183    }
    183 
    184     GRefPtr<GdkPixbuf> pixbuf = adoptGRef(pasteboardImage.image->getGdkPixbuf());
    185     if (pixbuf)
    186         m_dataObject->setImage(pixbuf.get());
     184    m_dataObject->setImage(pasteboardImage.image.get());
    187185
    188186    writeToClipboard();
     
    194192    m_dataObject->setText(pasteboardContent.text);
    195193    m_dataObject->setMarkup(pasteboardContent.markup);
    196 
    197     writeToClipboard(pasteboardContent.canSmartCopyOrDelete ? ShouldIncludeSmartPaste::Yes : ShouldIncludeSmartPaste::No);
     194    m_dataObject->setCanSmartReplace(pasteboardContent.canSmartCopyOrDelete);
     195
     196    writeToClipboard();
    198197}
    199198
  • trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp

    r205909 r206197  
    2626#include "DataObjectGtk.h"
    2727#include "GtkVersioning.h"
    28 #include "Pasteboard.h"
    29 #include "TextResourceDecoder.h"
    3028#include <gtk/gtk.h>
     29#include <wtf/TemporaryChange.h>
    3130#include <wtf/glib/GUniquePtr.h>
    3231#include <wtf/text/CString.h>
     
    149148            reinterpret_cast<const guchar*>(resultData.get()), strlen(resultData.get()));
    150149
    151     } else if (info == TargetTypeImage)
    152         gtk_selection_data_set_pixbuf(selectionData, dataObject.image());
    153 
    154     else if (info == TargetTypeSmartPaste)
     150    } else if (info == TargetTypeImage && dataObject.hasImage()) {
     151        GRefPtr<GdkPixbuf> pixbuf = adoptGRef(dataObject.image()->getGdkPixbuf());
     152        gtk_selection_data_set_pixbuf(selectionData, pixbuf.get());
     153
     154    } else if (info == TargetTypeSmartPaste)
    155155        gtk_selection_data_set_text(selectionData, "", -1);
    156156
     
    258258
    259259struct ClipboardSetData {
    260     ClipboardSetData(DataObjectGtk* dataObject, std::function<void()>&& selectionClearedCallback)
     260    ClipboardSetData(DataObjectGtk& dataObject, std::function<void()>&& selectionClearedCallback)
    261261        : dataObject(dataObject)
    262262        , selectionClearedCallback(WTFMove(selectionClearedCallback))
     
    268268    }
    269269
    270     RefPtr<DataObjectGtk> dataObject;
     270    Ref<DataObjectGtk> dataObject;
    271271    std::function<void()> selectionClearedCallback;
    272272};
     
    275275{
    276276    auto* data = static_cast<ClipboardSetData*>(userData);
    277     PasteboardHelper::singleton().fillSelectionData(selectionData, info, *data->dataObject);
     277    PasteboardHelper::singleton().fillSelectionData(selectionData, info, data->dataObject);
    278278}
    279279
     
    281281{
    282282    std::unique_ptr<ClipboardSetData> data(static_cast<ClipboardSetData*>(userData));
    283 
    284     // Only clear the DataObject for this clipboard if we are not currently setting it.
    285     if (data->dataObject.get() != settingClipboardDataObject)
    286         data->dataObject->clearAll();
    287 
    288283    if (data->selectionClearedCallback)
    289284        data->selectionClearedCallback();
     
    298293
    299294    if (numberOfTargets > 0 && table) {
    300         settingClipboardDataObject = const_cast<DataObjectGtk*>(&dataObject);
    301 
    302         auto data = std::make_unique<ClipboardSetData>(settingClipboardDataObject, WTFMove(primarySelectionCleared));
     295        TemporaryChange<DataObjectGtk*> change(settingClipboardDataObject, const_cast<DataObjectGtk*>(&dataObject));
     296        auto data = std::make_unique<ClipboardSetData>(*settingClipboardDataObject, WTFMove(primarySelectionCleared));
    303297        if (gtk_clipboard_set_with_data(clipboard, table, numberOfTargets, getClipboardContentsCallback, clearClipboardContentsCallback, data.get())) {
    304298            gtk_clipboard_set_can_store(clipboard, nullptr, 0);
     
    306300            data.release();
    307301        }
    308 
    309         settingClipboardDataObject = nullptr;
    310302    } else
    311303        gtk_clipboard_clear(clipboard);
  • trunk/Source/WebCore/platform/gtk/PlatformPasteboardGtk.cpp

    r205909 r206197  
    3535}
    3636
    37 void PlatformPasteboard::writeToClipboard(const RefPtr<DataObjectGtk>& dataObject, std::function<void()>&& primarySelectionCleared)
     37void PlatformPasteboard::writeToClipboard(const DataObjectGtk& dataObject, std::function<void()>&& primarySelectionCleared)
    3838{
    39     PasteboardHelper::singleton().writeClipboardContents(m_clipboard, *dataObject, gtk_clipboard_get(GDK_SELECTION_PRIMARY) == m_clipboard ? WTFMove(primarySelectionCleared) : nullptr);
     39    PasteboardHelper::singleton().writeClipboardContents(m_clipboard, dataObject, gtk_clipboard_get(GDK_SELECTION_PRIMARY) == m_clipboard ? WTFMove(primarySelectionCleared) : nullptr);
    4040}
    4141
    42 RefPtr<DataObjectGtk> PlatformPasteboard::readFromClipboard()
     42Ref<DataObjectGtk> PlatformPasteboard::readFromClipboard()
    4343{
    44     RefPtr<DataObjectGtk> dataObject = DataObjectGtk::create();
    45     PasteboardHelper::singleton().getClipboardContents(m_clipboard, *dataObject);
     44    Ref<DataObjectGtk> dataObject(DataObjectGtk::create());
     45    PasteboardHelper::singleton().getClipboardContents(m_clipboard, dataObject.get());
    4646    return dataObject;
    4747}
  • trunk/Source/WebKit2/ChangeLog

    r206194 r206197  
     12016-09-20  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Clean up DataObjectGtk handling
     4        https://bugs.webkit.org/show_bug.cgi?id=162267
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        In some cases the ownership of DataObjectGtk instances is not clear enough, and we have hacks to avoid memory
     9        leaks because of that.
     10
     11        * Shared/gtk/ArgumentCodersGtk.cpp:
     12        (IPC::encodeImage): Use Image instead of GdkPixbuf.
     13        (IPC::decodeImage): Ditto.
     14        (IPC::ArgumentCoder<DataObjectGtk>::encode):
     15        (IPC::ArgumentCoder<DataObjectGtk>::decode):
     16        (IPC::encode): Deleted.
     17        (IPC::decode): Deleted.
     18        (IPC::ArgumentCoder<DragData>::encode): Deleted.
     19        (IPC::ArgumentCoder<DragData>::decode): Deleted.
     20        * Shared/gtk/ArgumentCodersGtk.h:
     21        * Shared/gtk/PasteboardContent.cpp:
     22        (WebKit::PasteboardContent::PasteboardContent): Add empty constructor that creates a new DataObjectGtk, a
     23        constructor that receives a const reference and another one that takes the ownership of the given DataObjectGtk.
     24        (WebKit::PasteboardContent::encode):
     25        (WebKit::PasteboardContent::decode):
     26        * Shared/gtk/PasteboardContent.h: Use Ref instead of RefPtr for the DataObjectGtk member.
     27        * UIProcess/API/gtk/PageClientImpl.cpp:
     28        (WebKit::PageClientImpl::startDrag): Transfer the DataObjectGtk to the DragAndDropHandler, instead of using DragData.
     29        * UIProcess/API/gtk/PageClientImpl.h:
     30        * UIProcess/PageClient.h:
     31        * UIProcess/WebPageProxy.cpp:
     32        (WebKit::WebPageProxy::performDragControllerAction): Instead of sending a DragData object to the web process,
     33        send the DataObjectGtk and DragData members needed as parameters.
     34        (WebKit::WebPageProxy::startDrag): Transfer the received DataObjectGtk to page client, instead of using
     35        DragData. Also notify the web process that drag started.
     36        * UIProcess/WebPageProxy.h:
     37        * UIProcess/WebPageProxy.messages.in: Update StartDrag message parameters.
     38        * UIProcess/gtk/DragAndDropHandler.cpp:
     39        (WebKit::DragAndDropHandler::DragAndDropHandler): Remove unneeded initialization.
     40        (WebKit::DragAndDropHandler::startDrag): Take ownership of the given DataObjectGtk.
     41        * UIProcess/gtk/DragAndDropHandler.h:
     42        * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
     43        (WebKit::WebPasteboardProxy::writeToClipboard):
     44        (WebKit::WebPasteboardProxy::readFromClipboard):
     45        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
     46        (WebKit::WebPlatformStrategies::writeToClipboard):
     47        (WebKit::WebPlatformStrategies::readFromClipboard):
     48        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
     49        * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
     50        (WebKit::convertCairoSurfaceToShareableBitmap):
     51        (WebKit::WebDragClient::startDrag): Do not create a DragData and pass the DataObjectGtk directly to the
     52        message. Also notify the WebPage that drag is about to start.
     53        * WebProcess/WebPage/WebPage.cpp:
     54        (WebKit::WebPage::performDragControllerAction): Remove explicit DataObjectGtk derefs and simply create a
     55        DragData using the DataObjectGtk pointer as platform data.
     56        * WebProcess/WebPage/WebPage.h:
     57        * WebProcess/WebPage/WebPage.messages.in: Update PerformDragControllerAction message parameters.
     58
    1592016-09-20  Hunseop Jeong  <hs85.jeong@samsung.com>
    260
  • trunk/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp

    r205909 r206197  
    3131#include "WebCoreArgumentCoders.h"
    3232#include <WebCore/DataObjectGtk.h>
    33 #include <WebCore/DragData.h>
    3433#include <WebCore/GraphicsContext.h>
    35 #include <WebCore/GtkVersioning.h>
    36 #include <WebCore/PlatformContextCairo.h>
     34#include <WebCore/Image.h>
     35#include <gtk/gtk.h>
    3736#include <wtf/glib/GUniquePtr.h>
    3837
     
    4241namespace IPC {
    4342
    44 static void encodeImage(Encoder& encoder, const GdkPixbuf* pixbuf)
    45 {
    46     IntSize imageSize(gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
    47     RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(imageSize, ShareableBitmap::SupportsAlpha);
    48     auto graphicsContext = bitmap->createGraphicsContext();
    49 
    50     cairo_t* cr = graphicsContext->platformContext()->cr();
    51     gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
    52     cairo_paint(cr);
     43static void encodeImage(Encoder& encoder, Image& image)
     44{
     45    RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(IntSize(image.size()), ShareableBitmap::SupportsAlpha);
     46    bitmap->createGraphicsContext()->drawImage(image, IntPoint());
    5347
    5448    ShareableBitmap::Handle handle;
     
    5852}
    5953
    60 static bool decodeImage(Decoder& decoder, GRefPtr<GdkPixbuf>& pixbuf)
     54static bool decodeImage(Decoder& decoder, RefPtr<Image>& image)
    6155{
    6256    ShareableBitmap::Handle handle;
     
    6761    if (!bitmap)
    6862        return false;
    69 
    70     RefPtr<Image> image = bitmap->createImage();
     63    image = bitmap->createImage();
    7164    if (!image)
    7265        return false;
    73 
    74     RefPtr<cairo_surface_t> surface = image->nativeImageForCurrentFrame();
    75     if (!surface)
    76         return false;
    77 
    78     pixbuf = adoptGRef(gdk_pixbuf_get_from_surface(surface.get(), 0, 0, cairo_image_surface_get_width(surface.get()), cairo_image_surface_get_height(surface.get())));
    79     if (!pixbuf)
    80         return false;
    81 
    8266    return true;
    8367}
    8468
    85 void encode(Encoder& encoder, const DataObjectGtk* dataObject)
    86 {
    87     bool hasText = dataObject->hasText();
     69void ArgumentCoder<DataObjectGtk>::encode(Encoder& encoder, const DataObjectGtk& dataObject)
     70{
     71    bool hasText = dataObject.hasText();
    8872    encoder << hasText;
    8973    if (hasText)
    90         encoder << dataObject->text();
    91 
    92     bool hasMarkup = dataObject->hasMarkup();
     74        encoder << dataObject.text();
     75
     76    bool hasMarkup = dataObject.hasMarkup();
    9377    encoder << hasMarkup;
    9478    if (hasMarkup)
    95         encoder << dataObject->markup();
    96 
    97     bool hasURL = dataObject->hasURL();
     79        encoder << dataObject.markup();
     80
     81    bool hasURL = dataObject.hasURL();
    9882    encoder << hasURL;
    9983    if (hasURL)
    100         encoder << dataObject->url().string();
    101 
    102     bool hasURIList = dataObject->hasURIList();
     84        encoder << dataObject.url().string();
     85
     86    bool hasURIList = dataObject.hasURIList();
    10387    encoder << hasURIList;
    10488    if (hasURIList)
    105         encoder << dataObject->uriList();
    106 
    107     bool hasImage = dataObject->hasImage();
     89        encoder << dataObject.uriList();
     90
     91    bool hasImage = dataObject.hasImage();
    10892    encoder << hasImage;
    10993    if (hasImage)
    110         encodeImage(encoder, dataObject->image());
    111 
    112     bool hasUnknownTypeData = dataObject->hasUnknownTypeData();
     94        encodeImage(encoder, *dataObject.image());
     95
     96    bool hasUnknownTypeData = dataObject.hasUnknownTypeData();
    11397    encoder << hasUnknownTypeData;
    11498    if (hasUnknownTypeData)
    115         encoder << dataObject->unknownTypes();
    116 
    117     bool canSmartReplace = dataObject->canSmartReplace();
     99        encoder << dataObject.unknownTypes();
     100
     101    bool canSmartReplace = dataObject.canSmartReplace();
    118102    encoder << canSmartReplace;
    119103}
    120104
    121 bool decode(Decoder& decoder, RefPtr<DataObjectGtk>& dataObject)
    122 {
    123     RefPtr<DataObjectGtk> data = DataObjectGtk::create();
     105bool ArgumentCoder<DataObjectGtk>::decode(Decoder& decoder, DataObjectGtk& dataObject)
     106{
     107    dataObject.clearAll();
    124108
    125109    bool hasText;
     
    130114        if (!decoder.decode(text))
    131115            return false;
    132         data->setText(text);
     116        dataObject.setText(text);
    133117    }
    134118
     
    140124        if (!decoder.decode(markup))
    141125            return false;
    142         data->setMarkup(markup);
     126        dataObject.setMarkup(markup);
    143127    }
    144128
     
    150134        if (!decoder.decode(url))
    151135            return false;
    152         data->setURL(URL(URL(), url), String());
     136        dataObject.setURL(URL(URL(), url), String());
    153137    }
    154138
     
    160144        if (!decoder.decode(uriList))
    161145            return false;
    162         data->setURIList(uriList);
     146        dataObject.setURIList(uriList);
    163147    }
    164148
     
    167151        return false;
    168152    if (hasImage) {
    169         GRefPtr<GdkPixbuf> image;
     153        RefPtr<Image> image;
    170154        if (!decodeImage(decoder, image))
    171155            return false;
    172         data->setImage(image.get());
     156        dataObject.setImage(image.get());
    173157    }
    174158
     
    183167        auto end = unknownTypes.end();
    184168        for (auto it = unknownTypes.begin(); it != end; ++it)
    185             data->setUnknownTypeData(it->key, it->value);
     169            dataObject.setUnknownTypeData(it->key, it->value);
    186170    }
    187171
     
    189173    if (!decoder.decode(canSmartReplace))
    190174        return false;
    191     data->setCanSmartReplace(canSmartReplace);
    192 
    193     dataObject = data;
     175    dataObject.setCanSmartReplace(canSmartReplace);
    194176
    195177    return true;
    196178}
    197 
    198 #if ENABLE(DRAG_SUPPORT)
    199 void ArgumentCoder<DragData>::encode(Encoder& encoder, const DragData& dragData)
    200 {
    201     encoder << dragData.clientPosition();
    202     encoder << dragData.globalPosition();
    203     encoder << static_cast<uint64_t>(dragData.draggingSourceOperationMask());
    204     encoder << static_cast<uint64_t>(dragData.flags());
    205 
    206     DataObjectGtk* platformData = dragData.platformData();
    207     encoder << static_cast<bool>(platformData);
    208     if (platformData)
    209         IPC::encode(encoder, platformData);
    210 }
    211 
    212 bool ArgumentCoder<DragData>::decode(Decoder& decoder, DragData& dragData)
    213 {
    214     IntPoint clientPosition;
    215     if (!decoder.decode(clientPosition))
    216         return false;
    217 
    218     IntPoint globalPosition;
    219     if (!decoder.decode(globalPosition))
    220         return false;
    221 
    222     uint64_t sourceOperationMask;
    223     if (!decoder.decode(sourceOperationMask))
    224         return false;
    225 
    226     uint64_t flags;
    227     if (!decoder.decode(flags))
    228         return false;
    229 
    230     bool hasPlatformData;
    231     if (!decoder.decode(hasPlatformData))
    232         return false;
    233 
    234     RefPtr<DataObjectGtk> platformData;
    235     if (hasPlatformData) {
    236         if (!IPC::decode(decoder, platformData))
    237             return false;
    238     }
    239 
    240     dragData = DragData(platformData.leakRef(), clientPosition, globalPosition, static_cast<DragOperation>(sourceOperationMask),
    241                         static_cast<DragApplicationFlags>(flags));
    242 
    243     return true;
    244 }
    245 #endif // ENABLE(DRAG_SUPPORT)
    246179
    247180static void encodeGKeyFile(Encoder& encoder, GKeyFile* keyFile)
  • trunk/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h

    r205909 r206197  
    3535namespace WebCore {
    3636class DataObjectGtk;
    37 class DragData;
    3837}
    3938
    4039namespace IPC {
    41 
    42 #if ENABLE(DRAG_SUPPORT)
    43 template<> struct ArgumentCoder<WebCore::DragData> {
    44     static void encode(Encoder&, const WebCore::DragData&);
    45     static bool decode(Decoder&, WebCore::DragData&);
    46 };
    47 #endif
    4840
    4941void encode(Encoder&, GtkPrintSettings*);
     
    5345bool decode(Decoder&, GRefPtr<GtkPageSetup>&);
    5446
    55 void encode(Encoder&, const WebCore::DataObjectGtk*);
    56 bool decode(Decoder&, RefPtr<WebCore::DataObjectGtk>&);
     47template<> struct ArgumentCoder<WebCore::DataObjectGtk> {
     48    static void encode(Encoder&, const WebCore::DataObjectGtk&);
     49    static bool decode(Decoder&, WebCore::DataObjectGtk&);
     50};
    5751
    5852} // namespace IPC
  • trunk/Source/WebKit2/Shared/gtk/PasteboardContent.cpp

    r205909 r206197  
    2828namespace WebKit {
    2929
    30 PasteboardContent::PasteboardContent(const RefPtr<WebCore::DataObjectGtk>& data)
    31     : dataObject(data)
     30PasteboardContent::PasteboardContent()
     31    : dataObject(WebCore::DataObjectGtk::create())
    3232{
    33     ASSERT(dataObject);
     33}
     34
     35PasteboardContent::PasteboardContent(const WebCore::DataObjectGtk& data)
     36    : dataObject(const_cast<WebCore::DataObjectGtk&>(data))
     37{
     38}
     39
     40PasteboardContent::PasteboardContent(Ref<WebCore::DataObjectGtk>&& data)
     41    : dataObject(WTFMove(data))
     42{
    3443}
    3544
    3645void PasteboardContent::encode(IPC::Encoder& encoder) const
    3746{
    38     IPC::encode(encoder, dataObject.get());
     47    encoder << dataObject.get();
    3948}
    4049
    4150bool PasteboardContent::decode(IPC::Decoder& decoder, PasteboardContent& pasteboardContent)
    4251{
    43     return IPC::decode(decoder, pasteboardContent.dataObject);
     52    return decoder.decode(pasteboardContent.dataObject.get());
    4453}
    4554
  • trunk/Source/WebKit2/Shared/gtk/PasteboardContent.h

    r205909 r206197  
    3030
    3131struct PasteboardContent {
    32     PasteboardContent() = default;
    33     explicit PasteboardContent(const RefPtr<WebCore::DataObjectGtk>&);
     32    PasteboardContent();
     33    explicit PasteboardContent(const WebCore::DataObjectGtk&);
     34    explicit PasteboardContent(Ref<WebCore::DataObjectGtk>&&);
    3435
    35     RefPtr<WebCore::DataObjectGtk> dataObject;
     36    Ref<WebCore::DataObjectGtk> dataObject;
    3637
    3738    void encode(IPC::Encoder&) const;
  • trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp

    r204013 r206197  
    255255
    256256#if ENABLE(DRAG_SUPPORT)
    257 void PageClientImpl::startDrag(const WebCore::DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
     257void PageClientImpl::startDrag(Ref<DataObjectGtk>&& selection, DragOperation dragOperation, RefPtr<ShareableBitmap>&& dragImage)
    258258{
    259259    WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(m_viewWidget);
    260     webkitWebViewBaseDragAndDropHandler(webView).startDrag(dragData, dragImage);
     260    webkitWebViewBaseDragAndDropHandler(webView).startDrag(WTFMove(selection), dragOperation, WTFMove(dragImage));
    261261
    262262    // A drag starting should prevent a double-click from happening. This might
  • trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h

    r204013 r206197  
    8787    void selectionDidChange() override;
    8888#if ENABLE(DRAG_SUPPORT)
    89     void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) override;
     89    void startDrag(Ref<WebCore::DataObjectGtk>&&, WebCore::DragOperation, RefPtr<ShareableBitmap>&& dragImage) override;
    9090#endif
    9191
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r205412 r206197  
    158158
    159159#if PLATFORM(GTK) && ENABLE(DRAG_SUPPORT)
    160     virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0;
     160    virtual void startDrag(Ref<WebCore::DataObjectGtk>&&, WebCore::DragOperation, RefPtr<ShareableBitmap>&& dragImage) = 0;
    161161#endif
    162162
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r206040 r206197  
    156156#endif
    157157
     158#if PLATFORM(GTK)
     159#include "PasteboardContent.h"
     160#endif
     161
    158162#if USE(CAIRO)
    159163#include <WebCore/CairoUtilities.h>
     
    17691773    if (!url.isEmpty())
    17701774        m_process->assumeReadAccessToBaseURL(url);
    1771     m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData), m_pageID);
     1775
     1776    ASSERT(dragData.platformData());
     1777    PasteboardContent selection(*dragData.platformData());
     1778    m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData.clientPosition(), dragData.globalPosition(), dragData.draggingSourceOperationMask(), selection, dragData.flags()), m_pageID);
    17721779#else
    17731780    m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData.clientPosition(), dragData.globalPosition(), dragData.draggingSourceOperationMask(), dragStorageName, dragData.flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
     
    17851792
    17861793#if PLATFORM(GTK)
    1787 void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
    1788 {
    1789     RefPtr<ShareableBitmap> dragImage = 0;
    1790     if (!dragImageHandle.isNull()) {
    1791         dragImage = ShareableBitmap::create(dragImageHandle);
    1792         if (!dragImage)
    1793             return;
    1794     }
    1795 
    1796     m_pageClient.startDrag(dragData, dragImage.release());
     1794void WebPageProxy::startDrag(PasteboardContent&& selection, uint64_t dragOperation, const ShareableBitmap::Handle& dragImageHandle)
     1795{
     1796    RefPtr<ShareableBitmap> dragImage = !dragImageHandle.isNull() ? ShareableBitmap::create(dragImageHandle) : nullptr;
     1797    m_pageClient.startDrag(WTFMove(selection.dataObject), static_cast<WebCore::DragOperation>(dragOperation), WTFMove(dragImage));
     1798
     1799    m_process->send(Messages::WebPage::DidStartDrag(), m_pageID);
    17971800}
    17981801#endif
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r206033 r206197  
    810810#endif
    811811#if PLATFORM(GTK)
    812     void startDrag(const WebCore::DragData&, const ShareableBitmap::Handle& dragImage);
     812    void startDrag(PasteboardContent&&, uint64_t dragOperation, const ShareableBitmap::Handle& dragImage);
    813813#endif
    814814#endif
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r206006 r206197  
    309309#endif
    310310#if PLATFORM(GTK) && ENABLE(DRAG_SUPPORT)
    311     StartDrag(WebCore::DragData dragData, WebKit::ShareableBitmap::Handle dragImage)
     311    StartDrag(struct WebKit::PasteboardContent selection, uint64_t dragOperation, WebKit::ShareableBitmap::Handle dragImage)
    312312#endif
    313313
  • trunk/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp

    r205860 r206197  
    4545DragAndDropHandler::DragAndDropHandler(WebPageProxy& page)
    4646    : m_page(page)
    47 #if GTK_CHECK_VERSION(3, 16, 0)
    48     , m_dragContext(nullptr)
    49 #endif
    5047{
    5148}
     
    112109}
    113110
    114 void DragAndDropHandler::startDrag(const DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
     111void DragAndDropHandler::startDrag(Ref<DataObjectGtk>&& selection, DragOperation dragOperation, RefPtr<ShareableBitmap>&& dragImage)
    115112{
    116113#if GTK_CHECK_VERSION(3, 16, 0)
    117     m_draggingDataObject = adoptRef(dragData.platformData());
     114    m_draggingDataObject = WTFMove(selection);
    118115    GRefPtr<GtkTargetList> targetList = PasteboardHelper::singleton().targetListForDataObject(*m_draggingDataObject);
    119116#else
    120     RefPtr<DataObjectGtk> dataObject = adoptRef(dragData.platformData());
     117    RefPtr<DataObjectGtk> dataObject = WTFMove(selection);
    121118    GRefPtr<GtkTargetList> targetList = PasteboardHelper::singleton().targetListForDataObject(*dataObject);
    122119#endif
    123120
    124121    GUniquePtr<GdkEvent> currentEvent(gtk_get_current_event());
    125     GdkDragContext* context = gtk_drag_begin(m_page.viewWidget(), targetList.get(), dragOperationToGdkDragActions(dragData.draggingSourceOperationMask()),
     122    GdkDragContext* context = gtk_drag_begin(m_page.viewWidget(), targetList.get(), dragOperationToGdkDragActions(dragOperation),
    126123        GDK_BUTTON_PRIMARY, currentEvent.get());
    127124
     
    136133    // We don't have gtk_drag_cancel() in GTK+ < 3.16, so we use the old code.
    137134    // See https://bugs.webkit.org/show_bug.cgi?id=138468
    138     m_draggingDataObjects.set(context, dataObject.get());
     135    m_draggingDataObjects.set(context, WTFMove(dataObject));
    139136#endif
    140137
  • trunk/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h

    r195811 r206197  
    2424 */
    2525
    26 #ifndef DragAndDropHandler_h
    27 #define DragAndDropHandler_h
     26#pragma once
    2827
    2928#if ENABLE(DRAG_SUPPORT)
    3029
    3130#include <WebCore/DataObjectGtk.h>
     31#include <WebCore/DragActions.h>
    3232#include <WebCore/IntPoint.h>
    3333#include <gtk/gtk.h>
    3434#include <wtf/HashMap.h>
    3535#include <wtf/Noncopyable.h>
     36#include <wtf/glib/GRefPtr.h>
    3637
    3738typedef struct _GdkDragContext GdkDragContext;
     
    5253    DragAndDropHandler(WebPageProxy&);
    5354
    54     void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage);
     55    void startDrag(Ref<WebCore::DataObjectGtk>&&, WebCore::DragOperation, RefPtr<ShareableBitmap>&& dragImage);
    5556    void fillDragData(GdkDragContext*, GtkSelectionData*, unsigned info);
    5657    void finishDrag(GdkDragContext*);
     
    9192
    9293#endif // ENABLE(DRAG_SUPPORT)
    93 
    94 #endif // DragAndDropHandler_h
  • trunk/Source/WebKit2/UIProcess/gtk/WebPasteboardProxyGtk.cpp

    r205909 r206197  
    4242{
    4343    TemporaryChange<WebFrameProxy*> frameWritingToClipboard(m_frameWritingToClipboard, m_primarySelectionOwner);
    44     PlatformPasteboard(pasteboardName).writeToClipboard(pasteboardContent.dataObject, [this] {
     44    PlatformPasteboard(pasteboardName).writeToClipboard(pasteboardContent.dataObject.get(), [this] {
    4545        if (m_frameWritingToClipboard == m_primarySelectionOwner)
    4646            return;
     
    5151void WebPasteboardProxy::readFromClipboard(const String& pasteboardName, PasteboardContent& pasteboardContent)
    5252{
    53     pasteboardContent = PasteboardContent(PlatformPasteboard(pasteboardName).readFromClipboard().get());
     53    pasteboardContent = PasteboardContent(PlatformPasteboard(pasteboardName).readFromClipboard());
    5454}
    5555
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

    r205909 r206197  
    347347// PasteboardStrategy
    348348
    349 void WebPlatformStrategies::writeToClipboard(const String& pasteboardName, const RefPtr<WebCore::DataObjectGtk>& dataObject)
    350 {
    351     PasteboardContent pasteboardContent = PasteboardContent(dataObject.get());
     349void WebPlatformStrategies::writeToClipboard(const String& pasteboardName, const DataObjectGtk& dataObject)
     350{
     351    PasteboardContent pasteboardContent(dataObject);
    352352    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteToClipboard(pasteboardName, pasteboardContent), 0);
    353353}
    354354
    355 RefPtr<WebCore::DataObjectGtk> WebPlatformStrategies::readFromClipboard(const String& pasteboardName)
     355Ref<DataObjectGtk> WebPlatformStrategies::readFromClipboard(const String& pasteboardName)
    356356{
    357357    PasteboardContent pasteboardContent;
    358358    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadFromClipboard(pasteboardName), Messages::WebPasteboardProxy::ReadFromClipboard::Reply(pasteboardContent), 0);
    359     return pasteboardContent.dataObject;
     359    return WTFMove(pasteboardContent.dataObject);
    360360}
    361361
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

    r205909 r206197  
    8888#endif
    8989#if PLATFORM(GTK)
    90     void writeToClipboard(const String& pasteboardName, const RefPtr<WebCore::DataObjectGtk>&) override;
    91     RefPtr<WebCore::DataObjectGtk> readFromClipboard(const String& pasteboardName) override;
     90    void writeToClipboard(const String& pasteboardName, const WebCore::DataObjectGtk&) override;
     91    Ref<WebCore::DataObjectGtk> readFromClipboard(const String& pasteboardName) override;
    9292#endif
    9393};
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp

    r205860 r206197  
    3030
    3131#include "ArgumentCodersGtk.h"
     32#include "PasteboardContent.h"
    3233#include "ShareableBitmap.h"
    3334#include "WebPage.h"
     
    4445namespace WebKit {
    4546
    46 static PassRefPtr<ShareableBitmap> convertCairoSurfaceToShareableBitmap(cairo_surface_t* surface)
     47static RefPtr<ShareableBitmap> convertCairoSurfaceToShareableBitmap(cairo_surface_t* surface)
    4748{
    4849    if (!surface)
    49         return 0;
     50        return nullptr;
    5051
    5152    IntSize imageSize(cairo_image_surface_get_width(surface), cairo_image_surface_get_height(surface));
     
    5455
    5556    graphicsContext->platformContext()->drawSurfaceToContext(surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), *graphicsContext);
    56     return bitmap.release();
     57    return bitmap;
    5758}
    5859
     
    6667        return;
    6768
    68     const auto& dataObject = dataTransfer.pasteboard().dataObject();
    69     DragData dragData(const_cast<DataObjectGtk*>(&dataObject), clientPosition, globalPosition, dataTransfer.sourceOperation());
    70     m_page->send(Messages::WebPageProxy::StartDrag(dragData, handle));
     69    m_page->willStartDrag();
     70
     71    PasteboardContent selection(dataTransfer.pasteboard().dataObject());
     72    m_page->send(Messages::WebPageProxy::StartDrag(selection, dataTransfer.sourceOperation(), handle));
    7173}
    7274
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r206119 r206197  
    218218
    219219#if PLATFORM(GTK)
     220#include "PasteboardContent.h"
     221#include "WebPrintOperationGtk.h"
     222#include <WebCore/DataObjectGtk.h>
    220223#include <gtk/gtk.h>
    221 #include "DataObjectGtk.h"
    222 #include "WebPrintOperationGtk.h"
    223224#endif
    224225
     
    33973398
    33983399#if PLATFORM(GTK)
    3399 void WebPage::performDragControllerAction(uint64_t action, WebCore::DragData dragData)
     3400void WebPage::performDragControllerAction(uint64_t action, const IntPoint& clientPosition, const IntPoint& globalPosition, uint64_t draggingSourceOperationMask, PasteboardContent&& selection, uint32_t flags)
    34003401{
    34013402    if (!m_page) {
    34023403        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone, false, 0));
    3403         DataObjectGtk* data = const_cast<DataObjectGtk*>(dragData.platformData());
    3404         data->deref();
    3405         return;
    3406     }
    3407 
     3404        return;
     3405    }
     3406
     3407    DragData dragData(selection.dataObject.ptr(), clientPosition, globalPosition, static_cast<DragOperation>(draggingSourceOperationMask), static_cast<DragApplicationFlags>(flags));
    34083408    switch (action) {
    34093409    case DragControllerActionEntered: {
     
    34293429        ASSERT_NOT_REACHED();
    34303430    }
    3431     // DragData does not delete its platformData so we need to do that here.
    3432     DataObjectGtk* data = const_cast<DataObjectGtk*>(dragData.platformData());
    3433     data->deref();
    3434 }
    3435 
     3431}
    34363432#else
    34373433void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const String& dragStorageName, uint32_t flags, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsHandleArray)
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r206033 r206197  
    205205#endif
    206206
     207#if PLATFORM(GTK)
     208struct PasteboardContent;
     209#endif
     210
    207211#if ENABLE(TOUCH_EVENTS)
    208212class WebTouchEvent;
     
    730734#if ENABLE(DRAG_SUPPORT)
    731735#if PLATFORM(GTK)
    732     void performDragControllerAction(uint64_t action, WebCore::DragData);
     736    void performDragControllerAction(uint64_t action, const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t draggingSourceOperationMask, PasteboardContent&&, uint32_t flags);
    733737#else
    734738    void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r206033 r206197  
    237237    # Drag and drop.
    238238#if PLATFORM(GTK) && ENABLE(DRAG_SUPPORT)
    239     PerformDragControllerAction(uint64_t action, WebCore::DragData dragData)
     239    PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, struct WebKit::PasteboardContent selection, uint32_t flags)
    240240#endif
    241241#if !PLATFORM(GTK) && ENABLE(DRAG_SUPPORT)
Note: See TracChangeset for help on using the changeset viewer.