Changeset 75047 in webkit


Ignore:
Timestamp:
Jan 4, 2011 10:24:55 PM (13 years ago)
Author:
benjamin.poulain@nokia.com
Message:

2011-01-04 Benjamin Poulain <benjamin.poulain@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] [WK2] Add support for non-trivial context menu action
https://bugs.webkit.org/show_bug.cgi?id=51902

Fix the preprocessor guard for ContextMenuItemTagSelectAll in
the implementation of ContextMenuController::contextMenuItemSelected(). The guard was
inconsistent with what is defined in ContextMenuItem.h.

  • page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected):

2011-01-04 Benjamin Poulain <benjamin.poulain@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] [WK2] Add support for non-trivial context menu action
https://bugs.webkit.org/show_bug.cgi?id=51902

Implement a call back from the QAction triggered in the UIProcess to the
action in WebProcess.

A few basic actions have been implemented based on this feature.

  • UIProcess/API/qt/qwkpage.cpp: (contextMenuActionForWebAction): (QWKPage::triggerAction): (QWKPage::action):
  • UIProcess/API/qt/qwkpage.h:
  • UIProcess/qt/WebContextMenuProxyQt.cpp: (WebKit::webActionForContextMenuAction):
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r75045 r75047  
     12011-01-04  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] [WK2] Add support for non-trivial context menu action
     6        https://bugs.webkit.org/show_bug.cgi?id=51902
     7
     8        Fix the preprocessor guard for ContextMenuItemTagSelectAll in
     9        the implementation of ContextMenuController::contextMenuItemSelected(). The guard was
     10        inconsistent with what is defined in ContextMenuItem.h.
     11
     12        * page/ContextMenuController.cpp:
     13        (WebCore::ContextMenuController::contextMenuItemSelected):
     14
    1152011-01-04  Tony Gentilcore  <tonyg@chromium.org>
    216
  • trunk/WebCore/page/ContextMenuController.cpp

    r74941 r75047  
    263263        frame->editor()->performDelete();
    264264        break;
     265#endif
     266#if PLATFORM(GTK) || PLATFORM(QT)
    265267    case ContextMenuItemTagSelectAll:
    266268        frame->editor()->command("SelectAll").execute();
  • trunk/WebKit2/ChangeLog

    r75046 r75047  
     12011-01-04  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] [WK2] Add support for non-trivial context menu action
     6        https://bugs.webkit.org/show_bug.cgi?id=51902
     7
     8        Implement a call back from the QAction triggered in the UIProcess to the
     9        action in WebProcess.
     10
     11        A few basic actions have been implemented based on this feature.
     12
     13        * UIProcess/API/qt/qwkpage.cpp:
     14        (contextMenuActionForWebAction):
     15        (QWKPage::triggerAction):
     16        (QWKPage::action):
     17        * UIProcess/API/qt/qwkpage.h:
     18        * UIProcess/qt/WebContextMenuProxyQt.cpp:
     19        (WebKit::webActionForContextMenuAction):
     20
    1212011-01-04  Siddharth Mathur  <siddharth.mathur@nokia.com>
    222
  • trunk/WebKit2/UIProcess/API/qt/qwkpage.cpp

    r74964 r75047  
    5353using namespace WebKit;
    5454using namespace WebCore;
     55
     56static WebCore::ContextMenuAction contextMenuActionForWebAction(QWKPage::WebAction action)
     57{
     58    switch (action) {
     59    case QWKPage::OpenLink:
     60        return WebCore::ContextMenuItemTagOpenLink;
     61    case QWKPage::OpenLinkInNewWindow:
     62        return WebCore::ContextMenuItemTagOpenLinkInNewWindow;
     63    case QWKPage::CopyLinkToClipboard:
     64        return WebCore::ContextMenuItemTagCopyLinkToClipboard;
     65    case QWKPage::OpenImageInNewWindow:
     66        return WebCore::ContextMenuItemTagOpenImageInNewWindow;
     67    case QWKPage::Cut:
     68        return WebCore::ContextMenuItemTagCut;
     69    case QWKPage::Copy:
     70        return WebCore::ContextMenuItemTagCopy;
     71    case QWKPage::Paste:
     72        return WebCore::ContextMenuItemTagPaste;
     73    case QWKPage::SelectAll:
     74        return WebCore::ContextMenuItemTagSelectAll;
     75    default:
     76        ASSERT(false);
     77        break;
     78    }
     79    return WebCore::ContextMenuItemTagNoAction;
     80}
    5581
    5682QWKPagePrivate::QWKPagePrivate(QWKPage* qq, QWKContext* c)
     
    557583
    558584#ifndef QT_NO_ACTION
    559 void QWKPage::triggerAction(WebAction action, bool)
    560 {
    561     switch (action) {
     585void QWKPage::triggerAction(WebAction webAction, bool)
     586{
     587    switch (webAction) {
    562588    case Back:
    563589        d->page->goBack();
    564         break;
     590        return;
    565591    case Forward:
    566592        d->page->goForward();
    567         break;
     593        return;
    568594    case Stop:
    569595        d->page->stopLoading();
    570         break;
     596        return;
    571597    case Reload:
    572598        d->page->reload(/* reloadFromOrigin */ true);
    573         break;
     599        return;
    574600    default:
    575601        break;
    576602    }
     603
     604    QAction* qtAction = action(webAction);
     605    WebKit::WebContextMenuItemData menuItemData(ActionType, contextMenuActionForWebAction(webAction), qtAction->text(), qtAction->isEnabled(), qtAction->isChecked());
     606    d->page->contextMenuItemSelected(menuItemData);
    577607}
    578608#endif // QT_NO_ACTION
     
    593623
    594624    switch (action) {
     625    case OpenLink:
     626        text = contextMenuItemTagOpenLink();
     627        break;
     628    case OpenLinkInNewWindow:
     629        text = contextMenuItemTagOpenLinkInNewWindow();
     630        break;
     631    case CopyLinkToClipboard:
     632        text = contextMenuItemTagCopyLinkToClipboard();
     633        break;
     634    case OpenImageInNewWindow:
     635        text = contextMenuItemTagOpenImageInNewWindow();
     636        break;
    595637    case Back:
    596638        text = contextMenuItemTagGoBack();
     
    608650        text = contextMenuItemTagReload();
    609651        icon = style->standardIcon(QStyle::SP_BrowserReload);
     652        break;
     653    case Cut:
     654        text = contextMenuItemTagCut();
     655        break;
     656    case Copy:
     657        text = contextMenuItemTagCopy();
     658        break;
     659    case Paste:
     660        text = contextMenuItemTagPaste();
     661        break;
     662    case SelectAll:
     663        text = contextMenuItemTagSelectAll();
    610664        break;
    611665    default:
  • trunk/WebKit2/UIProcess/API/qt/qwkpage.h

    r74964 r75047  
    2929        NoWebAction = - 1,
    3030
     31        OpenLink,
     32        OpenLinkInNewWindow,
     33        CopyLinkToClipboard,
     34        OpenImageInNewWindow,
     35
    3136        Back,
    3237        Forward,
    3338        Stop,
    3439        Reload,
     40
     41        Cut,
     42        Copy,
     43        Paste,
     44        SelectAll,
    3545
    3646        WebActionCount
  • trunk/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp

    r74964 r75047  
    3939{
    4040    switch (action) {
     41    case WebCore::ContextMenuItemTagOpenLink:
     42        return QWKPage::OpenLink;
     43    case WebCore::ContextMenuItemTagOpenLinkInNewWindow:
     44        return QWKPage::OpenLinkInNewWindow;
     45    case WebCore::ContextMenuItemTagCopyLinkToClipboard:
     46        return QWKPage::CopyLinkToClipboard;
     47    case WebCore::ContextMenuItemTagOpenImageInNewWindow:
     48        return QWKPage::OpenImageInNewWindow;
    4149    case WebCore::ContextMenuItemTagGoBack:
    4250        return QWKPage::Back;
     
    4755    case WebCore::ContextMenuItemTagReload:
    4856        return QWKPage::Reload;
     57    case WebCore::ContextMenuItemTagCut:
     58        return QWKPage::Cut;
     59    case WebCore::ContextMenuItemTagCopy:
     60        return QWKPage::Copy;
     61    case WebCore::ContextMenuItemTagPaste:
     62        return QWKPage::Paste;
     63    case WebCore::ContextMenuItemTagSelectAll:
     64        return QWKPage::SelectAll;
    4965    default:
    5066        break;
Note: See TracChangeset for help on using the changeset viewer.