Changeset 77906 in webkit


Ignore:
Timestamp:
Feb 7, 2011 10:59:04 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-02-07 Aparna Nandyal <aparna.nand@wipro.com>

Reviewed by Andreas Kling.

[Qt] - Context menu needs "Copy" as well when the selected text is a link.
https://bugs.webkit.org/show_bug.cgi?id=40983

Added copy option for Qt platform if selection is a link.
Added a test in tst_qwebpage.cpp.

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

2011-02-07 Aparna Nandyal <aparna.nand@wipro.com>

Reviewed by Andreas Kling.

[Qt] - Context menu needs "Copy" as well when the selected text is a link.
https://bugs.webkit.org/show_bug.cgi?id=40983

Added a test case to create a context sensitive menu.
A check is made if it has Copy menu item when user
selects a link and opens context menu.

  • tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::contextMenuCopy):
Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r77905 r77906  
     12011-02-07  Aparna Nandyal  <aparna.nand@wipro.com>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] - Context menu needs "Copy" as well when the selected text is a link.
     6        https://bugs.webkit.org/show_bug.cgi?id=40983
     7
     8        Added copy option for Qt platform if selection is a link.
     9        Added a test in tst_qwebpage.cpp.
     10
     11        * page/ContextMenuController.cpp:
     12        (WebCore::ContextMenuController::populate):
     13
    1142011-02-07  Mike Reed  <reed@google.com>
    215
  • trunk/Source/WebCore/page/ContextMenuController.cpp

    r77892 r77906  
    718718                appendItem(DownloadFileItem, m_contextMenu.get());
    719719            }
     720#if PLATFORM(QT)
     721            if (m_hitTestResult.isSelected())
     722                appendItem(CopyItem, m_contextMenu.get());
     723#endif
    720724            appendItem(CopyLinkItem, m_contextMenu.get());
    721725        }
  • trunk/Source/WebKit/qt/ChangeLog

    r77901 r77906  
     12011-02-07  Aparna Nandyal  <aparna.nand@wipro.com>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] - Context menu needs "Copy" as well when the selected text is a link.
     6        https://bugs.webkit.org/show_bug.cgi?id=40983
     7   
     8        Added a test case to create a context sensitive menu.
     9        A check is made if it has Copy menu item when user
     10        selects a link and opens context menu.
     11
     12        * tests/qwebpage/tst_qwebpage.cpp:
     13        (tst_QWebPage::contextMenuCopy):
     14
    1152011-02-07  Benjamin Poulain  <ikipou@gmail.com>
    216
  • trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r77901 r77906  
    7979    void cleanupTestCase();
    8080
     81    void contextMenuCopy();
    8182    void acceptNavigationRequest();
    8283    void geolocationRequestJS();
     
    27702771#endif
    27712772
     2773void tst_QWebPage::contextMenuCopy()
     2774{
     2775    QWebView view;
     2776
     2777    view.setHtml("<a href=\"http://www.google.com\">You cant miss this</a>");
     2778
     2779    view.page()->triggerAction(QWebPage::SelectAll);
     2780    QVERIFY(!view.page()->selectedText().isEmpty());
     2781
     2782    QWebElement link = view.page()->mainFrame()->findFirstElement("a");
     2783    QPoint pos(link.geometry().center());
     2784    QContextMenuEvent event(QContextMenuEvent::Mouse, pos);
     2785    view.page()->swallowContextMenuEvent(&event);
     2786    view.page()->updatePositionDependentActions(pos);
     2787
     2788    QList<QMenu*> contextMenus = view.findChildren<QMenu*>();
     2789    QVERIFY(!contextMenus.isEmpty());
     2790    QMenu* contextMenu = contextMenus.first();
     2791    QVERIFY(contextMenu);
     2792   
     2793    QList<QAction *> list = contextMenu->actions();
     2794    int index = list.indexOf(view.page()->action(QWebPage::Copy));
     2795    QVERIFY(index != -1);
     2796}
    27722797QTEST_MAIN(tst_QWebPage)
    27732798#include "tst_qwebpage.moc"
Note: See TracChangeset for help on using the changeset viewer.