- Revision
- 218106
- Author
- [email protected]
- Date
- 2017-06-12 10:10:54 -0700 (Mon, 12 Jun 2017)
Log Message
[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: trunk/LayoutTests/ChangeLog (218105 => 218106)
--- trunk/LayoutTests/ChangeLog 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/LayoutTests/ChangeLog 2017-06-12 17:10:54 UTC (rev 218106)
@@ -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-06-12 Ryan Haddad <[email protected]>
Mark fast/mediastream/getUserMedia-webaudio.html as flaky on mac-wk2.
Modified: trunk/LayoutTests/editing/selection/5354455-1.html (218105 => 218106)
--- trunk/LayoutTests/editing/selection/5354455-1.html 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/LayoutTests/editing/selection/5354455-1.html 2017-06-12 17:10:54 UTC (rev 218106)
@@ -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: trunk/LayoutTests/fast/events/context-activated-by-key-event.html (218105 => 218106)
--- trunk/LayoutTests/fast/events/context-activated-by-key-event.html 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/LayoutTests/fast/events/context-activated-by-key-event.html 2017-06-12 17:10:54 UTC (rev 218106)
@@ -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: trunk/LayoutTests/fast/events/mouse-click-events.html (218105 => 218106)
--- trunk/LayoutTests/fast/events/mouse-click-events.html 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/LayoutTests/fast/events/mouse-click-events.html 2017-06-12 17:10:54 UTC (rev 218106)
@@ -26,6 +26,14 @@
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);
@@ -41,8 +49,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: trunk/Source/WebKit2/ChangeLog (218105 => 218106)
--- trunk/Source/WebKit2/ChangeLog 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-12 17:10:54 UTC (rev 218106)
@@ -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-06-12 Daewoong Jang <[email protected]>
[CoordinatedGraphics] Behavior change of DrawingAreaImpl after r217779
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (218105 => 218106)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-06-12 17:10:54 UTC (rev 218106)
@@ -2147,14 +2147,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: trunk/Tools/ChangeLog (218105 => 218106)
--- trunk/Tools/ChangeLog 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/Tools/ChangeLog 2017-06-12 17:10:54 UTC (rev 218106)
@@ -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-06-12 Miguel Gomez <[email protected]>
[GTK][WPE] Enable GStreamer GL on development builds
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (218105 => 218106)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2017-06-12 17:10:54 UTC (rev 218106)
@@ -515,14 +515,7 @@
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
#if ENABLE(CONTEXT_MENUS)
-#if PLATFORM(GTK)
- // 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: trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp (218105 => 218106)
--- trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp 2017-06-12 17:02:52 UTC (rev 218105)
+++ trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp 2017-06-12 17:10:54 UTC (rev 218106)
@@ -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);
}