Changeset 87978 in webkit


Ignore:
Timestamp:
Jun 2, 2011 6:05:56 PM (13 years ago)
Author:
Martin Robinson
Message:

2011-05-28 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] Remove PasteboardHelperGtk
https://bugs.webkit.org/show_bug.cgi?id=61690

Remove the virtual methods from PasteboardHelper, so that PasteboardHelperGtk
can be removed. Since the GtkClipboard IDs are verified to be the same between
WebKit and WebCore we no longer need to communicate from WebCore to WebKit to
get them.

No new tests. This is just a code refactor.

  • platform/Pasteboard.h: Remove GTK+ specific methods. They are no longer needed.
  • platform/gtk/ClipboardGtk.cpp: Remove the m_helper member and access the PasteboardHelper singleton directly.
  • platform/gtk/ClipboardGtk.h: Ditto.
  • platform/gtk/PasteboardGtk.cpp: Ditto.
  • platform/gtk/PasteboardHelper.cpp: (WebCore::removeMarkupPrefix): Remove an extra line. (WebCore::PasteboardHelper::defaultPasteboardHelper): Added this static getter for the singleton. (WebCore::PasteboardHelper::PasteboardHelper): Moved the contents of initTargetList here. (WebCore::PasteboardHelper::getCurrentClipboard): Instead of talking with WebKit to determine whether or not to use the primary selection clipboard, just use our new member. (WebCore::PasteboardHelper::fillSelectionData): Use our local enum to get the ID. (WebCore::PasteboardHelper::targetListForDataObject): Ditto. (WebCore::PasteboardHelper::dropAtomsForContext): Ditto. (WebCore::getClipboardContentsCallback): Ditto.
  • platform/gtk/PasteboardHelper.h: PasteboardHelper now keeps track of whether or not to use the primary selection clipboard internally. (WebCore::PasteboardHelper::setUsePrimarySelectionClipboard): Added. (WebCore::PasteboardHelper::usePrimarySelectionClipboard): Added.

2011-05-28 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] Remove PastboardHelperGtk
https://bugs.webkit.org/show_bug.cgi?id=61690

Remove PasteboardHelperGtk and talk directly to WebCore for pasteboard
activity. This change moves the PasteboardHelper singleton from WebKit
to WebCore.

  • GNUmakefile.am: Remove PasteboardHelperGtk from the source list.
  • WebCoreSupport/AssertMatchingEnums.cpp: Added assertions verifying that the WebCore versions of the GtkClipboard enums match those in the WebKit API.
  • WebCoreSupport/DragClientGtk.cpp: (WebKit::DragClient::startDrag): Access the pasteboard helper via a static method.
  • WebCoreSupport/EditorClientGtk.cpp: (WebKit::setSelectionPrimaryClipboardIfNeeded): Ditto. Call into the helper to specify that the current clipboard is selection primary now.
  • WebCoreSupport/PasteboardHelperGtk.cpp: Removed.
  • webkit/webkitglobals.cpp: Remove function to set and get the pasteboard helper.
  • webkit/webkitglobalsprivate.h: Ditto.
  • webkit/webkitwebview.cpp: (webkit_web_view_button_press_event): Access the pasteboard helper via a static method. (webkit_web_view_drag_data_get): Ditto. (webkit_web_view_drag_motion): Ditto. (webkit_web_view_drag_data_received): Ditto. (webkit_web_view_init): Ditto. (webkit_web_view_get_copy_target_list): Ditto. (webkit_web_view_get_paste_target_list): Ditto.
  • webkit/webkitwebviewprivate.h: Ditto.
Location:
trunk/Source
Files:
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    • Property svn:executable deleted
    r87964 r87978  
     12011-05-28  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Remove PasteboardHelperGtk
     6        https://bugs.webkit.org/show_bug.cgi?id=61690
     7
     8        Remove the virtual methods from PasteboardHelper, so that PasteboardHelperGtk
     9        can be removed. Since the GtkClipboard IDs are verified to be the same between
     10        WebKit and WebCore we no longer need to communicate from WebCore to WebKit to
     11        get them.
     12
     13        No new tests. This is just a code refactor.
     14
     15        * platform/Pasteboard.h: Remove GTK+ specific methods. They are no longer needed.
     16        * platform/gtk/ClipboardGtk.cpp: Remove the m_helper member and access the
     17        PasteboardHelper singleton directly.
     18        * platform/gtk/ClipboardGtk.h: Ditto.
     19        * platform/gtk/PasteboardGtk.cpp: Ditto.
     20        * platform/gtk/PasteboardHelper.cpp:
     21        (WebCore::removeMarkupPrefix): Remove an extra line.
     22        (WebCore::PasteboardHelper::defaultPasteboardHelper): Added this static getter
     23        for the singleton.
     24        (WebCore::PasteboardHelper::PasteboardHelper): Moved the contents of initTargetList here.
     25        (WebCore::PasteboardHelper::getCurrentClipboard): Instead of talking with WebKit to determine
     26        whether or not to use the primary selection clipboard, just use our new member.
     27        (WebCore::PasteboardHelper::fillSelectionData): Use our local enum to get the ID.
     28        (WebCore::PasteboardHelper::targetListForDataObject): Ditto.
     29        (WebCore::PasteboardHelper::dropAtomsForContext): Ditto.
     30        (WebCore::getClipboardContentsCallback): Ditto.
     31        * platform/gtk/PasteboardHelper.h: PasteboardHelper now keeps track of whether or
     32        not to use the primary selection clipboard internally.
     33        (WebCore::PasteboardHelper::setUsePrimarySelectionClipboard): Added.
     34        (WebCore::PasteboardHelper::usePrimarySelectionClipboard): Added.
     35
    1362011-06-02  Levi Weintraub  <leviw@chromium.org>
    237
  • trunk/Source/WebCore/platform/Pasteboard.h

    r79494 r87978  
    114114
    115115#if PLATFORM(GTK)
    116     void setHelper(PasteboardHelper*);
    117     PasteboardHelper* helper();
    118116    ~Pasteboard();
    119117#endif
     
    140138    PasteboardPrivate p;
    141139#endif
    142 
    143 #if PLATFORM(GTK)
    144     PasteboardHelper* m_helper;
    145 #endif
    146140};
    147141
  • trunk/Source/WebCore/platform/gtk/ClipboardGtk.cpp

    r79249 r87978  
    6161    , m_dataObject(DataObjectGtk::forClipboard(clipboard))
    6262    , m_clipboard(clipboard)
    63     , m_helper(Pasteboard::generalPasteboard()->helper())
    6463    , m_frame(frame)
    6564{
     
    7069    , m_dataObject(dataObject)
    7170    , m_clipboard(0)
    72     , m_helper(Pasteboard::generalPasteboard()->helper())
    7371    , m_frame(frame)
    7472{
     
    125123
    126124    if (m_clipboard)
    127         m_helper->writeClipboardContents(m_clipboard);
     125        PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_clipboard);
    128126}
    129127
     
    137135
    138136    if (m_clipboard)
    139         m_helper->writeClipboardContents(m_clipboard);
     137        PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_clipboard);
    140138}
    141139
     
    151149
    152150    if (m_clipboard)
    153         m_helper->getClipboardContents(m_clipboard);
     151        PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_clipboard);
    154152
    155153    ClipboardDataType type = dataObjectTypeFromHTMLClipboardType(typeString);
     
    185183
    186184    if (success && m_clipboard)
    187         m_helper->writeClipboardContents(m_clipboard);
     185        PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_clipboard);
    188186
    189187    return success;
     
    196194
    197195    if (m_clipboard)
    198         m_helper->getClipboardContents(m_clipboard);
     196        PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_clipboard);
    199197
    200198    HashSet<String> types;
     
    225223
    226224    if (m_clipboard)
    227         m_helper->getClipboardContents(m_clipboard);
     225        PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_clipboard);
    228226
    229227    RefPtr<FileList> fileList = FileList::create();
     
    303301    m_dataObject->setURL(url, label);
    304302    if (m_clipboard)
    305         m_helper->writeClipboardContents(m_clipboard);
     303        PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_clipboard);
    306304}
    307305
     
    314312
    315313    if (m_clipboard)
    316         m_helper->writeClipboardContents(m_clipboard);
     314        PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_clipboard);
    317315}
    318316
     
    322320
    323321    if (m_clipboard)
    324         m_helper->writeClipboardContents(m_clipboard);
     322        PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_clipboard);
    325323}
    326324
     
    328326{
    329327    if (m_clipboard)
    330         m_helper->getClipboardContents(m_clipboard);
     328        PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_clipboard);
    331329
    332330    return m_dataObject->hasText() || m_dataObject->hasMarkup()
  • trunk/Source/WebCore/platform/gtk/ClipboardGtk.h

    r76248 r87978  
    7575        virtual bool hasData();
    7676
    77         PasteboardHelper* helper() { return m_helper; }
    7877        PassRefPtr<DataObjectGtk> dataObject() { return m_dataObject; }
    7978
     
    8483        RefPtr<DataObjectGtk> m_dataObject;
    8584        GtkClipboard* m_clipboard;
    86         PasteboardHelper* m_helper;
    8785        Frame* m_frame;
    8886    };
  • trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp

    r87709 r87978  
    5353Pasteboard::Pasteboard()
    5454{
    55     notImplemented();
    56 }
    57 
    58 Pasteboard::~Pasteboard()
    59 {
    60     delete m_helper;
    61 }
    62 
    63 PasteboardHelper* Pasteboard::helper()
    64 {
    65     return m_helper;
    66 }
    67 
    68 void Pasteboard::setHelper(PasteboardHelper* helper)
    69 {
    70     m_helper = helper;
    7155}
    7256
    7357void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
    7458{
    75     GtkClipboard* clipboard = m_helper->getClipboard(frame);
     59    PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
     60    GtkClipboard* clipboard = helper->getClipboard(frame);
    7661    DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
    7762    dataObject->setText(frame->editor()->selectedText());
    7863    dataObject->setMarkup(createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs));
    79     m_helper->writeClipboardContents(clipboard);
     64    helper->writeClipboardContents(clipboard);
    8065}
    8166
     
    8570    DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
    8671    dataObject->setText(text);
    87     m_helper->writeClipboardContents(clipboard);
     72    PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard);
    8873}
    8974
     
    9378        return;
    9479
    95     GtkClipboard* clipboard = m_helper->getClipboard(frame);
     80    PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
     81    GtkClipboard* clipboard = helper->getClipboard(frame);
    9682    DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
    9783    dataObject->setURL(url, label);
    98     m_helper->writeClipboardContents(clipboard);
     84    helper->writeClipboardContents(clipboard);
    9985}
    10086
     
    147133    dataObject->setImage(pixbuf.get());
    148134
    149     m_helper->writeClipboardContents(clipboard);
     135    PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard);
    150136}
    151137
     
    164150                                                          bool allowPlainText, bool& chosePlainText)
    165151{
    166     GtkClipboard* clipboard = m_helper->getCurrentClipboard(frame);
     152    PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
     153    GtkClipboard* clipboard = helper->getCurrentClipboard(frame);
    167154    DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
    168     m_helper->getClipboardContents(clipboard);
     155    helper->getClipboardContents(clipboard);
    169156
    170157    chosePlainText = false;
     
    191178String Pasteboard::plainText(Frame* frame)
    192179{
    193     GtkClipboard* clipboard = m_helper->getCurrentClipboard(frame);
     180    PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
     181    GtkClipboard* clipboard = helper->getCurrentClipboard(frame);
    194182    DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
    195183
    196     m_helper->getClipboardContents(clipboard);
     184    helper->getClipboardContents(clipboard);
    197185    return dataObject->text();
    198186}
  • trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp

    r86330 r87978  
    4343static void removeMarkupPrefix(String& markup)
    4444{
    45 
    4645    // The markup prefix is not harmful, but we remove it from the string anyway, so that
    4746    // we can have consistent results with other ports during the layout tests.
     
    6665}
    6766
     67PasteboardHelper* PasteboardHelper::defaultPasteboardHelper()
     68{
     69    DEFINE_STATIC_LOCAL(PasteboardHelper, defaultHelper, ());
     70    return &defaultHelper;
     71}
     72
    6873PasteboardHelper::PasteboardHelper()
    6974    : m_targetList(gtk_target_list_new(0, 0))
     75    , m_usePrimarySelectionClipboard(false)
    7076{
    7177    initGdkAtoms();
     78
     79    gtk_target_list_add_text_targets(m_targetList, PasteboardHelper::TargetTypeText);
     80    gtk_target_list_add(m_targetList, markupAtom, 0, PasteboardHelper::TargetTypeMarkup);
     81    gtk_target_list_add_uri_targets(m_targetList, PasteboardHelper::TargetTypeURIList);
     82    gtk_target_list_add(m_targetList, netscapeURLAtom, 0, PasteboardHelper::TargetTypeNetscapeURL);
     83    gtk_target_list_add_image_targets(m_targetList, PasteboardHelper::TargetTypeImage, TRUE);
    7284}
    7385
     
    7587{
    7688    gtk_target_list_unref(m_targetList);
    77 }
    78 
    79 void PasteboardHelper::initializeTargetList()
    80 {
    81     gtk_target_list_add_text_targets(m_targetList, getIdForTargetType(TargetTypeText));
    82     gtk_target_list_add(m_targetList, markupAtom, 0, getIdForTargetType(TargetTypeMarkup));
    83     gtk_target_list_add_uri_targets(m_targetList, getIdForTargetType(TargetTypeURIList));
    84     gtk_target_list_add(m_targetList, netscapeURLAtom, 0, getIdForTargetType(TargetTypeNetscapeURL));
    85     gtk_target_list_add_image_targets(m_targetList, getIdForTargetType(TargetTypeImage), TRUE);
    8689}
    8790
     
    100103GtkClipboard* PasteboardHelper::getCurrentClipboard(Frame* frame)
    101104{
    102     if (usePrimarySelectionClipboard(widgetFromFrame(frame)))
     105    if (m_usePrimarySelectionClipboard)
    103106        return getPrimarySelectionClipboard(frame);
    104107    return getClipboard(frame);
     
    157160void PasteboardHelper::fillSelectionData(GtkSelectionData* selectionData, guint info, DataObjectGtk* dataObject)
    158161{
    159     if (info == getIdForTargetType(TargetTypeText))
     162    if (info == TargetTypeText)
    160163        gtk_selection_data_set_text(selectionData, dataObject->text().utf8().data(), -1);
    161164
    162     else if (info == getIdForTargetType(TargetTypeMarkup)) {
     165    else if (info == TargetTypeMarkup) {
    163166        // Some Linux applications refuse to accept pasted markup unless it is
    164167        // prefixed by a content-type meta tag.
     
    167170            reinterpret_cast<const guchar*>(markup.data()), markup.length() + 1);
    168171
    169     } else if (info == getIdForTargetType(TargetTypeURIList)) {
     172    } else if (info == TargetTypeURIList) {
    170173        CString uriList = dataObject->uriList().utf8();
    171174        gtk_selection_data_set(selectionData, uriListAtom, 8,
    172175            reinterpret_cast<const guchar*>(uriList.data()), uriList.length() + 1);
    173176
    174     } else if (info == getIdForTargetType(TargetTypeNetscapeURL) && dataObject->hasURL()) {
     177    } else if (info == TargetTypeNetscapeURL && dataObject->hasURL()) {
    175178        String url(dataObject->url());
    176179        String result(url);
     
    186189            reinterpret_cast<const guchar*>(resultData.get()), strlen(resultData.get()) + 1);
    187190
    188     } else if (info == getIdForTargetType(TargetTypeImage))
     191    } else if (info == TargetTypeImage)
    189192        gtk_selection_data_set_pixbuf(selectionData, dataObject->image());
    190193}
     
    195198
    196199    if (dataObject->hasText())
    197         gtk_target_list_add_text_targets(list, getIdForTargetType(TargetTypeText));
     200        gtk_target_list_add_text_targets(list, TargetTypeText);
    198201
    199202    if (dataObject->hasMarkup())
    200         gtk_target_list_add(list, markupAtom, 0, getIdForTargetType(TargetTypeMarkup));
     203        gtk_target_list_add(list, markupAtom, 0, TargetTypeMarkup);
    201204
    202205    if (dataObject->hasURIList()) {
    203         gtk_target_list_add_uri_targets(list, getIdForTargetType(TargetTypeURIList));
    204         gtk_target_list_add(list, netscapeURLAtom, 0, getIdForTargetType(TargetTypeNetscapeURL));
     206        gtk_target_list_add_uri_targets(list, TargetTypeURIList);
     207        gtk_target_list_add(list, netscapeURLAtom, 0, TargetTypeNetscapeURL);
    205208    }
    206209
    207210    if (dataObject->hasImage())
    208         gtk_target_list_add_image_targets(list, getIdForTargetType(TargetTypeImage), TRUE);
     211        gtk_target_list_add_image_targets(list, TargetTypeImage, TRUE);
    209212
    210213    return list;
     
    250253    // For images, try to find the most applicable image type.
    251254    GRefPtr<GtkTargetList> list(gtk_target_list_new(0, 0));
    252     gtk_target_list_add_image_targets(list.get(), getIdForTargetType(TargetTypeImage), TRUE);
     255    gtk_target_list_add_image_targets(list.get(), TargetTypeImage, TRUE);
    253256    GdkAtom atom = gtk_drag_dest_find_target(widget, context, list.get());
    254257    if (atom != GDK_NONE)
     
    264267    DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
    265268    ASSERT(dataObject);
    266     Pasteboard::generalPasteboard()->helper()->fillSelectionData(selectionData, info, dataObject);
     269    PasteboardHelper::defaultPasteboardHelper()->fillSelectionData(selectionData, info, dataObject);
    267270}
    268271
  • trunk/Source/WebCore/platform/gtk/PasteboardHelper.h

    r66531 r87978  
    2626#define PasteboardHelper_h
    2727
    28 /*
    29  * FIXME: this is for WebCore support and must be removed once
    30  * a better solution is found
    31  */
    32 
    3328#include "Frame.h"
    3429
     
    4136    PasteboardHelper();
    4237    virtual ~PasteboardHelper();
     38    static PasteboardHelper* defaultPasteboardHelper();
     39
     40    void setUsePrimarySelectionClipboard(bool usePrimary) { m_usePrimarySelectionClipboard = usePrimary; }
     41    bool usePrimarySelectionClipboard() { return m_usePrimarySelectionClipboard; }
    4342
    4443    GtkClipboard* getCurrentClipboard(Frame*);
     
    5352    void getClipboardContents(GtkClipboard*);
    5453
    55     enum PasteboardTargetType { TargetTypeText, TargetTypeMarkup, TargetTypeURIList, TargetTypeNetscapeURL, TargetTypeImage, TargetTypeUnknown };
    56     virtual guint getIdForTargetType(PasteboardTargetType) = 0;
    57 
    58 protected:
    59     void initializeTargetList();
    60     virtual bool usePrimarySelectionClipboard(GtkWidget*) = 0;
     54    enum PasteboardTargetType { TargetTypeMarkup, TargetTypeText, TargetTypeImage, TargetTypeURIList, TargetTypeNetscapeURL, TargetTypeUnknown };
    6155
    6256private:
    6357    GtkTargetList* m_targetList;
     58    bool m_usePrimarySelectionClipboard;
    6459};
    6560
  • trunk/Source/WebKit/gtk/ChangeLog

    r87925 r87978  
     12011-05-28  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Remove PastboardHelperGtk
     6        https://bugs.webkit.org/show_bug.cgi?id=61690
     7
     8        Remove PasteboardHelperGtk and talk directly to WebCore for pasteboard
     9        activity. This change moves the PasteboardHelper singleton from WebKit
     10        to WebCore.
     11
     12        * GNUmakefile.am: Remove PasteboardHelperGtk from the source list.
     13        * WebCoreSupport/AssertMatchingEnums.cpp: Added assertions verifying that the
     14        WebCore versions of the GtkClipboard enums match those in the WebKit API.
     15        * WebCoreSupport/DragClientGtk.cpp:
     16        (WebKit::DragClient::startDrag): Access the pasteboard helper via a static method.
     17        * WebCoreSupport/EditorClientGtk.cpp:
     18        (WebKit::setSelectionPrimaryClipboardIfNeeded): Ditto. Call into the helper to specify
     19        that the current clipboard is selection primary now.
     20        * WebCoreSupport/PasteboardHelperGtk.cpp: Removed.
     21        * webkit/webkitglobals.cpp: Remove function to set and get the pasteboard helper.
     22        * webkit/webkitglobalsprivate.h: Ditto.
     23        * webkit/webkitwebview.cpp:
     24        (webkit_web_view_button_press_event): Access the pasteboard helper via a static method.
     25        (webkit_web_view_drag_data_get): Ditto.
     26        (webkit_web_view_drag_motion): Ditto.
     27        (webkit_web_view_drag_data_received): Ditto.
     28        (webkit_web_view_init): Ditto.
     29        (webkit_web_view_get_copy_target_list): Ditto.
     30        (webkit_web_view_get_paste_target_list): Ditto.
     31        * webkit/webkitwebviewprivate.h: Ditto.
     32
    1332011-06-02  Joone Hur  <joone.hur@collabora.co.uk>
    234
  • trunk/Source/WebKit/gtk/GNUmakefile.am

    r87741 r87978  
    197197        Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
    198198        Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
    199         Source/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \
    200         Source/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \
    201199        Source/WebKit/gtk/webkit/webkitapplicationcache.cpp \
    202200        Source/WebKit/gtk/webkit/webkitdownload.cpp \
  • trunk/Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp

    r78749 r87978  
    2626#include "FindOptions.h"
    2727#include "FrameLoaderTypes.h"
     28#include "PasteboardHelper.h"
    2829#include "webkitwebnavigationaction.h"
    2930#include "webkitwebsettings.h"
     31#include "webkitwebview.h"
    3032#include <wtf/Assertions.h>
    3133
     
    4951COMPILE_ASSERT_MATCHING_ENUM(WebKit::WebFindOptionsWrapAround, WrapAround);
    5052COMPILE_ASSERT_MATCHING_ENUM(WebKit::WebFindOptionsStartInSelection, StartInSelection);
     53
     54COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_WEB_VIEW_TARGET_INFO_HTML, PasteboardHelper::TargetTypeMarkup);
     55COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_WEB_VIEW_TARGET_INFO_TEXT, PasteboardHelper::TargetTypeText);
     56COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE, PasteboardHelper::TargetTypeImage);
     57COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST, PasteboardHelper::TargetTypeURIList);
     58COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL, PasteboardHelper::TargetTypeNetscapeURL);
  • trunk/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp

    r85214 r87978  
    104104    WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame));
    105105    RefPtr<DataObjectGtk> dataObject = clipboardGtk->dataObject();
    106     GRefPtr<GtkTargetList> targetList(clipboardGtk->helper()->targetListForDataObject(dataObject.get()));
     106    GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get()));
    107107    GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event());
    108108
  • trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp

    r86436 r87978  
    3737#include "NotImplemented.h"
    3838#include "Page.h"
    39 #include "PasteboardHelperGtk.h"
     39#include "PasteboardHelper.h"
    4040#include "PlatformKeyboardEvent.h"
    4141#include "WebKitDOMBinding.h"
     
    296296    GClosure* callback = g_cclosure_new_object(G_CALLBACK(collapseSelection), G_OBJECT(webView));
    297297    g_closure_set_marshal(callback, g_cclosure_marshal_VOID__VOID);
    298     pasteboardHelperInstance()->writeClipboardContents(clipboard, callback);
     298    PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard, callback);
    299299    viewSettingClipboard = 0;
    300300}
  • trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp

    r85868 r87978  
    274274    PageGroup::setShouldTrackVisitedLinks(true);
    275275
    276     Pasteboard::generalPasteboard()->setHelper(WebKit::pasteboardHelperInstance());
    277276    GOwnPtr<gchar> iconDatabasePath(g_build_filename(g_get_user_data_dir(), "webkit", "icondatabase", NULL));
    278277    webkit_icon_database_set_path(webkit_get_icon_database(), iconDatabasePath.get());
     
    294293namespace WebKit {
    295294
    296 PasteboardHelperGtk* pasteboardHelperInstance()
    297 {
    298     static PasteboardHelperGtk* helper = new PasteboardHelperGtk();
    299     return helper;
    300 }
    301 
    302295} /** end namespace WebKit */
    303296
  • trunk/Source/WebKit/gtk/webkit/webkitglobalsprivate.h

    r80561 r87978  
    2929#define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
    3030
    31 namespace WebKit {
    32 
    33 class PasteboardHelperGtk;
    34 PasteboardHelperGtk* pasteboardHelperInstance();
    35 
    36 }
    37 
    3831extern "C" {
    3932
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r87925 r87978  
    7070#include "Pasteboard.h"
    7171#include "PasteboardHelper.h"
    72 #include "PasteboardHelperGtk.h"
    7372#include "PlatformKeyboardEvent.h"
    7473#include "PlatformWheelEvent.h"
     
    141140 */
    142141
     142using namespace WebKit;
     143using namespace WebCore;
     144
    143145static const double defaultDPI = 96.0;
    144146static IntPoint globalPointForClientPoint(GdkWindow* window, const IntPoint& clientPoint);
    145 
    146 using namespace WebKit;
    147 using namespace WebCore;
    148147
    149148enum {
     
    783782    /* Copy selection to the X11 selection clipboard */
    784783    if (event->button == 2) {
    785         bool primary = webView->priv->usePrimaryForPaste;
    786         webView->priv->usePrimaryForPaste = true;
     784        PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
     785        bool wasUsingPrimary = helper->usePrimarySelectionClipboard();
     786        helper->setUsePrimarySelectionClipboard(true);
    787787
    788788        Editor* editor = webView->priv->corePage->focusController()->focusedOrMainFrame()->editor();
     
    790790        editor->paste();
    791791
    792         webView->priv->usePrimaryForPaste = primary;
     792        helper->setUsePrimarySelectionClipboard(wasUsingPrimary);
    793793    }
    794794#endif
     
    14991499        return;
    15001500
    1501     pasteboardHelperInstance()->fillSelectionData(selectionData, info, priv->draggingDataObjects.get(context).get());
     1501    PasteboardHelper::defaultPasteboardHelper()->fillSelectionData(selectionData, info, priv->draggingDataObjects.get(context).get());
    15021502}
    15031503
     
    15591559        priv->droppingContexts.set(context, droppingContext);
    15601560
    1561         Vector<GdkAtom> acceptableTargets(pasteboardHelperInstance()->dropAtomsForContext(widget, context));
     1561        Vector<GdkAtom> acceptableTargets(PasteboardHelper::defaultPasteboardHelper()->dropAtomsForContext(widget, context));
    15621562        droppingContext->pendingDataRequests = acceptableTargets.size();
    15631563        for (size_t i = 0; i < acceptableTargets.size(); i++)
     
    15921592    DroppingContext* droppingContext = priv->droppingContexts.get(context);
    15931593    droppingContext->pendingDataRequests--;
    1594     pasteboardHelperInstance()->fillDataObjectFromDropData(selectionData, info, droppingContext->dataObject.get());
     1594    PasteboardHelper::defaultPasteboardHelper()->fillDataObjectFromDropData(selectionData, info, droppingContext->dataObject.get());
    15951595
    15961596    if (droppingContext->pendingDataRequests)
     
    34923492
    34933493    gtk_drag_dest_set(GTK_WIDGET(webView), static_cast<GtkDestDefaults>(0), 0, 0, static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE));
    3494     gtk_drag_dest_set_target_list(GTK_WIDGET(webView), pasteboardHelperInstance()->targetList());
     3494    gtk_drag_dest_set_target_list(GTK_WIDGET(webView), PasteboardHelper::defaultPasteboardHelper()->targetList());
    34953495}
    34963496
     
    35353535    if (webkit_download_get_destination_uri(download))
    35363536        webkit_download_start(download);
    3537 }
    3538 
    3539 bool webkit_web_view_use_primary_for_paste(WebKitWebView* webView)
    3540 {
    3541     return webView->priv->usePrimaryForPaste;
    35423537}
    35433538
     
    43254320GtkTargetList* webkit_web_view_get_copy_target_list(WebKitWebView* webView)
    43264321{
    4327     return pasteboardHelperInstance()->targetList();
     4322    return PasteboardHelper::defaultPasteboardHelper()->targetList();
    43284323}
    43294324
     
    43424337GtkTargetList* webkit_web_view_get_paste_target_list(WebKitWebView* webView)
    43434338{
    4344     return pasteboardHelperInstance()->targetList();
     4339    return PasteboardHelper::defaultPasteboardHelper()->targetList();
    43454340}
    43464341
  • trunk/Source/WebKit/gtk/webkit/webkitwebviewprivate.h

    r86102 r87978  
    8787
    8888    gboolean disposing;
    89     gboolean usePrimaryForPaste;
    9089
    9190#if ENABLE(VIDEO)
     
    122121
    123122WEBKIT_API gchar* webkit_web_view_get_selected_text(WebKitWebView*);
    124 bool webkit_web_view_use_primary_for_paste(WebKitWebView*);
    125123
    126124void webViewEnterFullscreen(WebKitWebView* webView, WebCore::Node*);
Note: See TracChangeset for help on using the changeset viewer.