Changeset 135595 in webkit


Ignore:
Timestamp:
Nov 23, 2012 4:55:45 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[WK2][WKTR] WebKitTestRunner needs eventSender.contextClick()
https://bugs.webkit.org/show_bug.cgi?id=86881

Patch by Wojciech Bielawski <w.bielawski@samsung.com> on 2012-11-23
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

InjectedBundle API extended to retrieve contextMenu entries names.
WebContextMenu exteded with function to retrieve menu items.
This API is required by layout tests.
Common code in WebContextMenu.cpp moved to separate method menuItemsWithUserData().
Behaviour of dependend methods is unchanged.

  • WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:

(WKBundlePageGetContextMenuEntriesNames):

  • WebProcess/InjectedBundle/API/c/WKBundlePage.h:
  • WebProcess/WebPage/WebContextMenu.cpp:

(WebKit::WebContextMenu::items):
(WebKit):

  • WebProcess/WebPage/WebContextMenu.h:

(WebContextMenu):

Tools:

eventSender object extended with contextClick() method in WebKitTestRunner.
contextClick() method returns an array of menu items objects with field 'title' containing title of single
context menu entry. According to some tests menu items objects shall also support 'click()' method, but it's not
delivered in this patch.

  • WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
  • WebKitTestRunner/InjectedBundle/EventSendingController.cpp:

(WTR::EventSendingController::contextClick):
(WTR):

  • WebKitTestRunner/InjectedBundle/EventSendingController.h:

(EventSendingController):

LayoutTests:

Added expected results for two tests for EFL platform. Test expectations changed
for EFL WK1/WK2 and GTK platforms

  • platform/efl/TestExpectations:
  • platform/efl-wk1/TestExpectations:
  • platform/efl-wk2/TestExpectations:
  • platform/gkt-wk2/TestExpectations:
  • platform/gtk/editing/selection/5354455-2-expected.txt:
  • platform/efl/editing/selection/5354455-2-expected.txt: Added.
  • platform/efl/fast/events/context-no-deselect-expected.txt: Added.
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r135590 r135595  
     12012-11-23  Wojciech Bielawski  <w.bielawski@samsung.com>
     2
     3        [WK2][WKTR] WebKitTestRunner needs eventSender.contextClick()
     4        https://bugs.webkit.org/show_bug.cgi?id=86881
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Added expected results for two tests for EFL platform. Test expectations changed
     9        for EFL WK1/WK2 and GTK platforms
     10
     11        * platform/efl/TestExpectations:
     12        * platform/efl-wk1/TestExpectations:
     13        * platform/efl-wk2/TestExpectations:
     14        * platform/gkt-wk2/TestExpectations:
     15        * platform/gtk/editing/selection/5354455-2-expected.txt:
     16        * platform/efl/editing/selection/5354455-2-expected.txt: Added.
     17        * platform/efl/fast/events/context-no-deselect-expected.txt: Added.
     18
    1192012-11-23  Sudarsana Nagineni  <sudarsana.nagineni@intel.com>
    220
  • trunk/LayoutTests/platform/efl-wk1/TestExpectations

    r135348 r135595  
    279279webkit.org/b/102517 css3/device-adapt/opera/syntax-002.xhtml [ Failure ]
    280280webkit.org/b/102517 css3/device-adapt/opera/syntax-003.xhtml [ Failure ]
     281
     282# ESC key does not cancel context menu in EFL port
     283Bug(EFL) editing/selection/5354455-1.html [ Failure ]
  • trunk/LayoutTests/platform/efl-wk2/TestExpectations

    r135590 r135595  
    280280webkit.org/b/98739 plugins/npruntime/embed-property-equality.html [ Failure ]
    281281
    282 # WebKitTestRunner needs an implementation for eventSender.contextClick
    283 webkit.org/b/86881 editing/pasteboard/copy-standalone-image-crash.html [ Failure ]
    284 webkit.org/b/86881 editing/selection/5354455-1.html [ Failure ]
    285 webkit.org/b/86881 editing/selection/5354455-2.html [ Failure ]
    286 webkit.org/b/86881 editing/selection/button-right-click.html [ Failure ]
    287 webkit.org/b/86881 editing/selection/context-menu-on-text.html [ Failure ]
    288 webkit.org/b/86881 editing/selection/context-menu-text-selection.html [ Failure ]
    289 webkit.org/b/86881 editing/selection/empty-cell-right-click.html [ Failure ]
    290 webkit.org/b/86881 editing/shadow/rightclick-on-meter-in-shadow-crash.html [ Failure ]
    291 webkit.org/b/86881 editing/spelling/context-menu-suggestions.html [ Failure ]
    292 webkit.org/b/86881 fast/events/context-no-deselect.html [ Failure ]
     282# EFL's EventSender contextClick should return objects that implements click() method
     283webkit.org/b/98410 editing/pasteboard/copy-standalone-image-crash.html [ Failure ]
     284webkit.org/b/98410 media/context-menu-actions.html [ Failure ]
    293285webkit.org/b/86881 fast/events/context-nodrag.html [ Failure ]
    294 webkit.org/b/86881 fast/events/context-onmousedown-event.html [ Failure ]
    295 webkit.org/b/86881 fast/events/contextmenu-scrolled-page-with-frame.html [ Failure ]
    296 webkit.org/b/86881 fast/events/right-click-focus.html [ Failure ]
    297 webkit.org/b/86881 fast/events/selectstart-prevent-selection-on-right-click.html [ Failure ]
    298 webkit.org/b/86881 media/context-menu-actions.html [ Failure ]
    299 webkit.org/b/86881 media/controls-right-click-on-timebar.html [ Failure ]
    300286
    301287webkit.org/b/102201 fast/dom/Window/window-resize.html [ Failure ]
  • trunk/LayoutTests/platform/efl/TestExpectations

    r135590 r135595  
    15641564Bug(EFL) media/context-menu-actions.html [ Failure ]
    15651565
    1566 # ESC key does not cancel context menu in EFL port
    1567 Bug(EFL) editing/selection/5354455-1.html [ Failure ]
    1568 
    15691566# Tests that create an extra graphics layer
    15701567webkit.org/b/102697 compositing/overflow/overflow-auto-with-touch-no-overflow.html [ Failure ]
     
    16921689
    16931690webkit.org/b/103109 fast/dom/shadow/host-wrapper-reclaimed.html [ Failure ]
     1691
     1692# Start of media player causes timeout.
     1693Bug(EFL) media/controls-right-click-on-timebar.html [ Failure ]
     1694
     1695# No spellcheck suggestions in context menu
     1696Bug(EFL) editing/spelling/context-menu-suggestions.html [ Failure ]
  • trunk/LayoutTests/platform/gtk-wk2/TestExpectations

    r135273 r135595  
    132132# WebKit2 needs textInputController.selectedRange
    133133Bug(GTK) editing/selection/mixed-editability-10.html [ Failure ]
    134 
    135 # Implement eventSender.contextClick
    136 Bug(GTK) editing/pasteboard/copy-standalone-image-crash.html [ Failure ]
    137 Bug(GTK) editing/selection/empty-cell-right-click.html [ Failure ]
    138 Bug(GTK) editing/selection/button-right-click.html [ Failure ]
    139 Bug(GTK) editing/selection/context-menu-on-text.html [ Failure ]
    140 Bug(GTK) editing/selection/empty-cell-right-click.html [ Failure ]
    141 Bug(GTK) fast/events/selectstart-prevent-selection-on-right-click.html [ Failure ]
    142 Bug(GTK) fast/events/context-no-deselect.html [ Failure ]
    143 Bug(GTK) fast/events/contextmenu-scrolled-page-with-frame.html [ Failure ]
    144 Bug(GTK) fast/events/context-onmousedown-event.html [ Failure ]
    145 Bug(GTK) media/controls-right-click-on-timebar.html [ Failure ]
    146 Bug(GTK) svg/custom/use-events-crash.svg [ Failure ]
    147134
    148135# Implement PageClientImpl::registerEditCommand and handling commands functions
     
    593580#////////////////////////////////////////////////////////////////////////////////////////
    594581
     582
     583# Selection doesn't work properly.
     584Bug(GTK) editing/selection/context-menu-text-selection.html [ Failure Pass ]
     585Bug(GTK) editing/selection/empty-cell-right-click.html [ Failure ]
     586Bug(GTK) editing/spelling/context-menu-suggestions.html [ Failure ]
     587
     588# EventSender's contextClick should return objects that implements click() method
     589webkit.org/b/98410 editing/pasteboard/copy-standalone-image-crash.html [ Failure ]
     590webkit.org/b/98410 media/context-menu-actions.html [ Failure ]
     591
     592# An oncontextmenu attribute is not called.
     593Bug(GTK) editing/spelling/spellcheck-input-search-crash.html [ Failure ]
     594Bug(GTK) fast/events/contextmenu-scrolled-page-with-frame.html [ Failure ]
     595
     596# An onmousedown attribute is not called.
     597Bug(GTK) fast/events/context-onmousedown-event.html [ Failure ]
     598
     599# An onselectstart attribute is not called.
     600Bug(GTK) fast/events/selectstart-prevent-selection-on-right-click.html [ Failure ]
     601
     602# Start of media player causes timeout
     603Bug(GTK) media/controls-right-click-on-timebar.html [ Failure ]
  • trunk/Source/WebKit2/ChangeLog

    r135575 r135595  
     12012-11-23  Wojciech Bielawski  <w.bielawski@samsung.com>
     2
     3        [WK2][WKTR] WebKitTestRunner needs eventSender.contextClick()
     4        https://bugs.webkit.org/show_bug.cgi?id=86881
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        InjectedBundle API extended to retrieve contextMenu entries names.
     9        WebContextMenu exteded with function to retrieve menu items.
     10        This API is required by layout tests.
     11        Common code in WebContextMenu.cpp moved to separate method menuItemsWithUserData().
     12        Behaviour of dependend methods is unchanged.
     13
     14        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     15        (WKBundlePageGetContextMenuEntriesNames):
     16        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
     17        * WebProcess/WebPage/WebContextMenu.cpp:
     18        (WebKit::WebContextMenu::items):
     19        (WebKit):
     20        * WebProcess/WebPage/WebContextMenu.h:
     21        (WebContextMenu):
     22
    1232012-11-22  Pierre Rossi  <pierre.rossi@gmail.com>
    224
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r129924 r135595  
    3131#include "InjectedBundleNodeHandle.h"
    3232#include "WKAPICast.h"
     33#include "WKArray.h"
    3334#include "WKBundleAPICast.h"
     35#include "WKRetainPtr.h"
     36#include "WKString.h"
     37#include "WebContextMenu.h"
     38#include "WebContextMenuItem.h"
    3439#include "WebFrame.h"
    3540#include "WebFullScreenManager.h"
     
    3843#include "WebRenderLayer.h"
    3944#include "WebRenderObject.h"
     45#include "WebString.h"
    4046#include "WebURL.h"
    4147#include "WebURLRequest.h"
     
    146152}
    147153
     154WKArrayRef WKBundlePageCopyContextMenuItemTitles(WKBundlePageRef pageRef)
     155{
     156#if ENABLE(CONTEXT_MENUS)
     157    WebContextMenu* contextMenu = toImpl(pageRef)->contextMenu();
     158    const Vector<WebContextMenuItemData> &items = contextMenu->items();
     159    size_t arrayLength = items.size();
     160    OwnArrayPtr<WKTypeRef> itemNames = adoptArrayPtr(new WKTypeRef[arrayLength]);
     161    for (size_t i = 0; i < arrayLength; ++i)
     162        itemNames[i] = WKStringCreateWithUTF8CString(items[i].title().utf8().data());
     163
     164    return WKArrayCreateAdoptingValues(itemNames.get(), arrayLength);
     165#else
     166    return 0;
     167#endif
     168}
     169
    148170void* WKAccessibilityRootObject(WKBundlePageRef pageRef)
    149171{
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h

    r129556 r135595  
    7878WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef);
    7979
     80WK_EXPORT WKArrayRef WKBundlePageCopyContextMenuItemTitles(WKBundlePageRef);
     81
    8082#ifdef __cplusplus
    8183}
  • trunk/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp

    r135405 r135595  
    6767        return;
    6868
     69    Vector<WebContextMenuItemData> menuItems;
     70    RefPtr<APIObject> userData;
     71    menuItemsWithUserData(menuItems, userData);
     72    WebHitTestResult::Data webHitTestResultData(controller->hitTestResult());
     73
     74    // Mark the WebPage has having a shown context menu then notify the UIProcess.
     75    m_page->contextMenuShowing();
     76    m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().roundedPointInInnerNodeFrame()), webHitTestResultData, menuItems, InjectedBundleUserMessageEncoder(userData.get())));
     77}
     78
     79void WebContextMenu::itemSelected(const WebContextMenuItemData& item)
     80{
     81    ContextMenuItem coreItem(ActionType, static_cast<ContextMenuAction>(item.action()), item.title());
     82    m_page->corePage()->contextMenuController()->contextMenuItemSelected(&coreItem);
     83}
     84
     85void WebContextMenu::menuItemsWithUserData(Vector<WebContextMenuItemData> &menuItems, RefPtr<APIObject>& userData) const
     86{
     87    ContextMenuController* controller = m_page->corePage()->contextMenuController();
     88    if (!controller)
     89        return;
     90
     91    ContextMenu* menu = controller->contextMenu();
     92    if (!menu)
     93        return;
     94
    6995    // Give the bundle client a chance to process the menu.
    7096#if USE(CROSS_PLATFORM_CONTEXT_MENUS)
     
    75101    Vector<WebContextMenuItemData> proposedMenu = kitItems(coreItems, menu);
    76102    Vector<WebContextMenuItemData> newMenu;
    77     RefPtr<APIObject> userData;
    78103    RefPtr<InjectedBundleHitTestResult> hitTestResult = InjectedBundleHitTestResult::create(controller->hitTestResult());
    79104    if (m_page->injectedBundleContextMenuClient().getCustomMenuFromDefaultItems(m_page, hitTestResult.get(), proposedMenu, newMenu, userData))
    80105        proposedMenu = newMenu;
    81 
    82     WebHitTestResult::Data webHitTestResultData(controller->hitTestResult());
    83 
    84     // Mark the WebPage has having a shown context menu then notify the UIProcess.
    85     m_page->contextMenuShowing();
    86     m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().roundedPointInInnerNodeFrame()), webHitTestResultData, proposedMenu, InjectedBundleUserMessageEncoder(userData.get())));
     106    menuItems = proposedMenu;
    87107}
    88108
    89 void WebContextMenu::itemSelected(const WebContextMenuItemData& item)
     109Vector<WebContextMenuItemData> WebContextMenu::items() const
    90110{
    91     ContextMenuItem coreItem(ActionType, static_cast<ContextMenuAction>(item.action()), item.title());
    92     m_page->corePage()->contextMenuController()->contextMenuItemSelected(&coreItem);
     111    Vector<WebContextMenuItemData> menuItems;
     112    RefPtr<APIObject> userData;
     113    menuItemsWithUserData(menuItems, userData);
     114    return menuItems;
    93115}
    94116
  • trunk/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h

    r114367 r135595  
    4444    void show();
    4545    void itemSelected(const WebContextMenuItemData&);
     46    Vector<WebContextMenuItemData> items() const;
    4647
    4748private:
    4849    WebContextMenu(WebPage*);
    49    
     50    void menuItemsWithUserData(Vector<WebContextMenuItemData>&, RefPtr<APIObject>&) const;
     51
    5052    WebPage* m_page;
    5153};
  • trunk/Tools/ChangeLog

    r135585 r135595  
     12012-11-23  Wojciech Bielawski  <w.bielawski@samsung.com>
     2
     3        [WK2][WKTR] WebKitTestRunner needs eventSender.contextClick()
     4        https://bugs.webkit.org/show_bug.cgi?id=86881
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        eventSender object extended with contextClick() method in WebKitTestRunner.
     9        contextClick() method returns an array of menu items objects with field 'title' containing title of single
     10        context menu entry. According to some tests menu items objects shall also support 'click()' method, but it's not
     11        delivered in this patch.
     12
     13        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
     14        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
     15        (WTR::EventSendingController::contextClick):
     16        (WTR):
     17        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
     18        (EventSendingController):
     19
    1202012-11-23  Simon Hausmann  <simon.hausmann@digia.com>
    221
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl

    r131145 r135595  
    3030    void mouseScrollBy(in long x, in long y);
    3131    void continuousMouseScrollBy(in long x, in long y, in [Optional] boolean paged);
     32    object contextClick();
    3233    void scheduleAsynchronousClick();
    3334
  • trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp

    r129220 r135595  
    320320}
    321321
     322JSValueRef EventSendingController::contextClick()
     323{
     324    WKBundlePageRef page = InjectedBundle::shared().page()->page();
     325    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
     326    JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
     327#if ENABLE(CONTEXT_MENUS)
     328    // Do mouse context click.
     329    mouseDown(2, 0);
     330    mouseUp(2, 0);
     331
     332    WKRetainPtr<WKArrayRef> entriesNames = adoptWK(WKBundlePageCopyContextMenuItemTitles(page));
     333    JSRetainPtr<JSStringRef> jsPropertyName(Adopt, JSStringCreateWithUTF8CString("title"));
     334    size_t entriesSize = WKArrayGetSize(entriesNames.get());
     335    OwnArrayPtr<JSValueRef> jsValuesArray = adoptArrayPtr(new JSValueRef[entriesSize]);
     336    for (size_t i = 0; i < entriesSize; ++i) {
     337        ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(entriesNames.get(), i)) == WKStringGetTypeID());
     338
     339        WKStringRef wkEntryName = static_cast<WKStringRef>(WKArrayGetItemAtIndex(entriesNames.get(), i));
     340        JSObjectRef jsItemObject = JSObjectMake(context, /* JSClassRef */0, /* privData */0);
     341        JSRetainPtr<JSStringRef> jsNameCopy(Adopt, WKStringCopyJSString(wkEntryName));
     342        JSValueRef jsEntryName = JSValueMakeString(context, jsNameCopy.get());
     343        JSObjectSetProperty(context, jsItemObject, jsPropertyName.get(), jsEntryName, kJSPropertyAttributeReadOnly, 0);
     344        jsValuesArray[i] = jsItemObject;
     345    }
     346
     347    return JSObjectMakeArray(context, entriesSize, jsValuesArray.get(), 0);
     348#else
     349    return JSValueMakeUndefined(context);
     350#endif
     351}
     352
    322353#ifdef USE_WEBPROCESS_EVENT_SIMULATION
    323354void EventSendingController::updateClickCount(WKEventMouseButton button)
  • trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h

    r129220 r135595  
    5353    void mouseScrollBy(int x, int y);
    5454    void continuousMouseScrollBy(int x, int y, bool paged);
     55    JSValueRef contextClick();
    5556    void leapForward(int milliseconds);
    5657    void scheduleAsynchronousClick();
Note: See TracChangeset for help on using the changeset viewer.