- Revision
- 218549
- Author
- [email protected]
- Date
- 2017-06-20 00:04:24 -0700 (Tue, 20 Jun 2017)
Log Message
Merge r218106 - [GTK] Stop dismissing menus attached to the web view for every injected event
https://bugs.webkit.org/show_bug.cgi?id=172708
Reviewed by Alex Christensen.
Source/WebKit2:
To actually simulate a right-click event we should also send the button release after the press, and let the page
handle the events in addition to sending the event to the context menu controller, like we do with normal
events. So, this is mostly the same as a real right-click event but without actually showing the menu.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::contextMenuAtPointInWindow):
Tools:
It's a workaround we added in r184015 that has worked so far for the context menu, but doesn't really work now
that we also attach popup menus to the web view. We really need to be able to show a popup menu, and then send
events while the menu is open.
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::contextClick): Use WKBundlePageCopyContextMenuAtPointInWindow() also in GTK+ port.
* WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
(WTR::EventSenderProxy::dispatchEvent): Stop calling PlatformWebView::dismissAllPopupMenus().
LayoutTests:
* editing/selection/5354455-1.html: No need to click on editable area to focus it, contextClick already focuses
it, we even have another test to ensure it. Those fast clicks were causing a double click in GTK+ port which
selected the whole line. We don't need to dismiss the context menu either, because contextClick() doesn't really
show the menu.
* fast/events/context-activated-by-key-event.html: Dismiss the context menu every time we show it.
* fast/events/mouse-click-events.html: Dimiss the context menu when testing right click events.
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog 2017-06-20 07:04:24 UTC (rev 218549)
@@ -1,3 +1,17 @@
+2017-06-12 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Stop dismissing menus attached to the web view for every injected event
+ https://bugs.webkit.org/show_bug.cgi?id=172708
+
+ Reviewed by Alex Christensen.
+
+ * editing/selection/5354455-1.html: No need to click on editable area to focus it, contextClick already focuses
+ it, we even have another test to ensure it. Those fast clicks were causing a double click in GTK+ port which
+ selected the whole line. We don't need to dismiss the context menu either, because contextClick() doesn't really
+ show the menu.
+ * fast/events/context-activated-by-key-event.html: Dismiss the context menu every time we show it.
+ * fast/events/mouse-click-events.html: Dimiss the context menu when testing right click events.
+
2017-05-30 Adrian Perez de Castro <[email protected]>
[GTK] Test cases for typehead in form menu lists should start from known state
Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/editing/selection/5354455-1.html (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/LayoutTests/editing/selection/5354455-1.html 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/editing/selection/5354455-1.html 2017-06-20 07:04:24 UTC (rev 218549)
@@ -16,14 +16,9 @@
x = paragraph.offsetParent.offsetLeft + paragraph.offsetLeft + paragraph.offsetWidth + 10;
y = paragraph.offsetParent.offsetTop + paragraph.offsetTop + paragraph.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
- // Give the editable region focus.
- eventSender.mouseDown();
- eventSender.mouseUp();
// Right click on the paragraph break to select it.
eventSender.contextClick();
- // esc key to kill the context menu.
- eventSender.keyDown(String.fromCharCode(0x001B), null);
-
+
document.getElementById(result).innerHTML = window.getSelection().type;
}
Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/context-activated-by-key-event.html (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/context-activated-by-key-event.html 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/context-activated-by-key-event.html 2017-06-20 07:04:24 UTC (rev 218549)
@@ -13,6 +13,13 @@
document.getElementById('result').appendChild(document.createElement("br"));
}
+function dismissContextMenu() {
+ if (window.eventSender) {
+ // esc key to kill the context menu.
+ eventSender.keyDown(String.fromCharCode(0x001B), null);
+ }
+}
+
function onWindowContextMenu(event) {
log('PASS WINDOW');
event.stopPropagation();
@@ -35,6 +42,7 @@
if (window.testRunner) {
eventSender.keyDown('menu');
+ dismissContextMenu();
var rect = document.getElementById('contenteditable').getBoundingClientRect();
var x = rect.left + rect.width / 2;
@@ -43,12 +51,15 @@
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.keyDown('menu');
+ dismissContextMenu();
document.getElementById('link').focus();
eventSender.keyDown('menu');
+ dismissContextMenu();
window.getSelection().selectAllChildren(document.getElementById('contenteditable'));
eventSender.keyDown('menu');
+ dismissContextMenu();
testRunner.dumpAsText();
}
Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/script-tests/mouse-click-events.js (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/script-tests/mouse-click-events.js 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/script-tests/mouse-click-events.js 2017-06-20 07:04:24 UTC (rev 218549)
@@ -19,6 +19,13 @@
eventLog = "";
}
+function dismissContextMenu() {
+ if (window.eventSender) {
+ // esc key to kill the context menu.
+ eventSender.keyDown(String.fromCharCode(0x001B), null);
+ }
+}
+
div.addEventListener("click", appendEventLog, false);
div.addEventListener("dblclick", appendEventLog, false);
div.addEventListener("mousedown", appendEventLog, false);
@@ -34,8 +41,12 @@
return;
}
eventSender.mouseDown(button);
+ if (button == 2)
+ dismissContextMenu();
eventSender.mouseUp(button);
eventSender.mouseDown(button);
+ if (button == 2)
+ dismissContextMenu();
eventSender.mouseUp(button);
// could test dragging here too
}
Modified: releases/WebKitGTK/webkit-2.16/Source/WebKit2/ChangeLog (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/Source/WebKit2/ChangeLog 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/Source/WebKit2/ChangeLog 2017-06-20 07:04:24 UTC (rev 218549)
@@ -1,3 +1,17 @@
+2017-06-12 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Stop dismissing menus attached to the web view for every injected event
+ https://bugs.webkit.org/show_bug.cgi?id=172708
+
+ Reviewed by Alex Christensen.
+
+ To actually simulate a right-click event we should also send the button release after the press, and let the page
+ handle the events in addition to sending the event to the context menu controller, like we do with normal
+ events. So, this is mostly the same as a real right-click event but without actually showing the menu.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::contextMenuAtPointInWindow):
+
2017-04-11 Adrian Perez de Castro <[email protected]>
[GTK] Attach popup menu to web view widget
Modified: releases/WebKitGTK/webkit-2.16/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-06-20 07:04:24 UTC (rev 218549)
@@ -2058,14 +2058,16 @@
WebContextMenu* WebPage::contextMenuAtPointInWindow(const IntPoint& point)
{
corePage()->contextMenuController().clearContextMenu();
-
+
// Simulate a mouse click to generate the correct menu.
- PlatformMouseEvent mouseEvent(point, point, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
- bool handled = corePage()->userInputBridge().handleContextMenuEvent(mouseEvent, &corePage()->mainFrame());
- if (!handled)
- return 0;
+ PlatformMouseEvent mousePressEvent(point, point, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
+ corePage()->userInputBridge().handleMousePressEvent(mousePressEvent);
+ bool handled = corePage()->userInputBridge().handleContextMenuEvent(mousePressEvent, &corePage()->mainFrame());
+ auto* menu = handled ? contextMenu() : nullptr;
+ PlatformMouseEvent mouseReleaseEvent(point, point, RightButton, PlatformEvent::MouseReleased, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
+ corePage()->userInputBridge().handleMouseReleaseEvent(mouseReleaseEvent);
- return contextMenu();
+ return menu;
}
#endif
Modified: releases/WebKitGTK/webkit-2.16/Tools/ChangeLog (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/Tools/ChangeLog 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/Tools/ChangeLog 2017-06-20 07:04:24 UTC (rev 218549)
@@ -1,3 +1,19 @@
+2017-06-12 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Stop dismissing menus attached to the web view for every injected event
+ https://bugs.webkit.org/show_bug.cgi?id=172708
+
+ Reviewed by Alex Christensen.
+
+ It's a workaround we added in r184015 that has worked so far for the context menu, but doesn't really work now
+ that we also attach popup menus to the web view. We really need to be able to show a popup menu, and then send
+ events while the menu is open.
+
+ * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+ (WTR::EventSendingController::contextClick): Use WKBundlePageCopyContextMenuAtPointInWindow() also in GTK+ port.
+ * WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
+ (WTR::EventSenderProxy::dispatchEvent): Stop calling PlatformWebView::dismissAllPopupMenus().
+
2017-04-10 Adrian Perez de Castro <[email protected]>
[GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup()
Modified: releases/WebKitGTK/webkit-2.16/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2017-06-20 07:04:24 UTC (rev 218549)
@@ -547,14 +547,7 @@
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
#if ENABLE(CONTEXT_MENUS)
-#if PLATFORM(GTK) || PLATFORM(EFL)
- // Do mouse context click.
- mouseDown(2, 0);
- mouseUp(2, 0);
- WKRetainPtr<WKArrayRef> menuEntries = adoptWK(WKBundlePageCopyContextMenuItems(page));
-#else
WKRetainPtr<WKArrayRef> menuEntries = adoptWK(WKBundlePageCopyContextMenuAtPointInWindow(page, m_position));
-#endif
JSValueRef arrayResult = JSObjectMakeArray(context, 0, 0, 0);
if (!menuEntries)
return arrayResult;
Modified: releases/WebKitGTK/webkit-2.16/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp (218548 => 218549)
--- releases/WebKitGTK/webkit-2.16/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp 2017-06-20 07:04:13 UTC (rev 218548)
+++ releases/WebKitGTK/webkit-2.16/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp 2017-06-20 07:04:24 UTC (rev 218549)
@@ -167,14 +167,6 @@
void EventSenderProxy::dispatchEvent(GdkEvent* event)
{
ASSERT(m_testController->mainWebView());
-
- // If we are sending an escape key to the WebView, this has the side-effect of dismissing
- // any current popups anyway. Chances are that the test is doing this to dismiss the popup
- // anyway. Not all tests properly dismiss popup menus, so we still need to do it manually
- // if this isn't an escape key press.
- if (event->type != GDK_KEY_PRESS || event->key.keyval != GDK_KEY_Escape)
- m_testController->mainWebView()->dismissAllPopupMenus();
-
gtk_main_do_event(event);
gdk_event_free(event);
}