Title: [216382] releases/WebKitGTK/webkit-2.16
Revision
216382
Author
[email protected]
Date
2017-05-08 04:03:54 -0700 (Mon, 08 May 2017)

Log Message

Merge r215790 - REGRESSION(206450): WebKit2PlatformMouseEvent m_modifierFlags not set
https://bugs.webkit.org/show_bug.cgi?id=171297
<rdar://problem/31530719>

Reviewed by Geoffrey Garen.

Source/WebKit2:

* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):

Tools:

* TestWebKitAPI/PlatformWebView.h:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/EventModifiers.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::mouseDidMoveOverElement):
(TestWebKitAPI::setClients):
(TestWebKitAPI::TEST):
* TestWebKitAPI/mac/PlatformWebViewMac.mm:
(TestWebKitAPI::PlatformWebView::simulateRightClick):
(TestWebKitAPI::PlatformWebView::simulateMouseMove):

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/Source/WebKit2/ChangeLog (216381 => 216382)


--- releases/WebKitGTK/webkit-2.16/Source/WebKit2/ChangeLog	2017-05-08 11:01:17 UTC (rev 216381)
+++ releases/WebKitGTK/webkit-2.16/Source/WebKit2/ChangeLog	2017-05-08 11:03:54 UTC (rev 216382)
@@ -1,3 +1,14 @@
+2017-04-25  Alex Christensen  <[email protected]>
+
+        REGRESSION(206450): WebKit2PlatformMouseEvent m_modifierFlags not set
+        https://bugs.webkit.org/show_bug.cgi?id=171297
+        <rdar://problem/31530719>
+
+        Reviewed by Geoffrey Garen.
+
+        * Shared/WebEventConversion.cpp:
+        (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
+
 2017-04-25  Brent Fulgham  <[email protected]>
 
         Limit allowed size of document.title to avoid locking WebKit clients

Modified: releases/WebKitGTK/webkit-2.16/Source/WebKit2/Shared/WebEventConversion.cpp (216381 => 216382)


--- releases/WebKitGTK/webkit-2.16/Source/WebKit2/Shared/WebEventConversion.cpp	2017-05-08 11:01:17 UTC (rev 216381)
+++ releases/WebKitGTK/webkit-2.16/Source/WebKit2/Shared/WebEventConversion.cpp	2017-05-08 11:03:54 UTC (rev 216382)
@@ -109,6 +109,15 @@
         m_eventNumber = webEvent.eventNumber();
         m_menuTypeForEvent = webEvent.menuTypeForEvent();
 #endif
+        m_modifierFlags = 0;
+        if (webEvent.shiftKey())
+            m_modifierFlags |= WebEvent::ShiftKey;
+        if (webEvent.controlKey())
+            m_modifierFlags |= WebEvent::ControlKey;
+        if (webEvent.altKey())
+            m_modifierFlags |= WebEvent::AltKey;
+        if (webEvent.metaKey())
+            m_modifierFlags |= WebEvent::MetaKey;
     }
 };
 

Modified: releases/WebKitGTK/webkit-2.16/Tools/ChangeLog (216381 => 216382)


--- releases/WebKitGTK/webkit-2.16/Tools/ChangeLog	2017-05-08 11:01:17 UTC (rev 216381)
+++ releases/WebKitGTK/webkit-2.16/Tools/ChangeLog	2017-05-08 11:03:54 UTC (rev 216382)
@@ -1,3 +1,22 @@
+2017-04-25  Alex Christensen  <[email protected]>
+
+        REGRESSION(206450): WebKit2PlatformMouseEvent m_modifierFlags not set
+        https://bugs.webkit.org/show_bug.cgi?id=171297
+        <rdar://problem/31530719>
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/PlatformWebView.h:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/EventModifiers.cpp: Added.
+        (TestWebKitAPI::didFinishLoadForFrame):
+        (TestWebKitAPI::mouseDidMoveOverElement):
+        (TestWebKitAPI::setClients):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/mac/PlatformWebViewMac.mm:
+        (TestWebKitAPI::PlatformWebView::simulateRightClick):
+        (TestWebKitAPI::PlatformWebView::simulateMouseMove):
+
 2017-04-25  Brent Fulgham  <[email protected]>
 
         Limit allowed size of document.title to avoid locking WebKit clients

Modified: releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/PlatformWebView.h (216381 => 216382)


--- releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/PlatformWebView.h	2017-05-08 11:01:17 UTC (rev 216381)
+++ releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/PlatformWebView.h	2017-05-08 11:03:54 UTC (rev 216382)
@@ -72,7 +72,7 @@
     void simulateSpacebarKeyPress();
     void simulateAltKeyPress();
     void simulateRightClick(unsigned x, unsigned y);
-    void simulateMouseMove(unsigned x, unsigned y);
+    void simulateMouseMove(unsigned x, unsigned y, WKEventModifiers = 0);
 #if PLATFORM(MAC)
     void simulateButtonClick(WKEventMouseButton, unsigned x, unsigned y, WKEventModifiers);
 #endif

Added: releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/Tests/WebKit2/EventModifiers.cpp (0 => 216382)


--- releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/Tests/WebKit2/EventModifiers.cpp	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/Tests/WebKit2/EventModifiers.cpp	2017-05-08 11:03:54 UTC (rev 216382)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_HAVE_C_SPI
+
+#include "_javascript_Test.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+
+namespace TestWebKitAPI {
+
+static bool didFinishLoad { false };
+static bool mouseMoveCallbackFinished { false };
+
+static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
+{
+    didFinishLoad = true;
+}
+
+static void mouseDidMoveOverElement(WKPageRef, WKHitTestResultRef, WKEventModifiers modifiers, WKTypeRef, const void*)
+{
+    EXPECT_EQ(modifiers, kWKEventModifiersControlKey);
+    mouseMoveCallbackFinished = true;
+}
+
+static void setClients(WKPageRef page)
+{
+    WKPageLoaderClientV0 loaderClient;
+    memset(&loaderClient, 0, sizeof(loaderClient));
+    loaderClient.base.version = 0;
+    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+    WKPageSetPageLoaderClient(page, &loaderClient.base);
+    
+    WKPageUIClientV1 uiClient;
+    memset(&uiClient, 0, sizeof(uiClient));
+    uiClient.base.version = 1;
+    uiClient.mouseDidMoveOverElement = mouseDidMoveOverElement;
+    WKPageSetPageUIClient(page, &uiClient.base);
+}
+
+TEST(WebKit2, EventModifiers)
+{
+    WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate());
+    
+    PlatformWebView webView(context.get());
+    setClients(webView.page());
+    
+    WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
+    WKPageLoadURL(webView.page(), url.get());
+    Util::run(&didFinishLoad);
+    
+    webView.simulateMouseMove(10, 10, kWKEventModifiersControlKey);
+    Util::run(&mouseMoveCallbackFinished);
+}
+
+} // namespace TestWebKitAPI
+
+#endif

Modified: releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp (216381 => 216382)


--- releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp	2017-05-08 11:01:17 UTC (rev 216381)
+++ releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp	2017-05-08 11:03:54 UTC (rev 216382)
@@ -148,7 +148,7 @@
     doMouseButtonEvent(viewWidget, GDK_BUTTON_RELEASE, x, y, 3);
 }
 
-void PlatformWebView::simulateMouseMove(unsigned x, unsigned y)
+void PlatformWebView::simulateMouseMove(unsigned x, unsigned y, WKEventModifiers)
 {
     GUniquePtr<GdkEvent> event(gdk_event_new(GDK_MOTION_NOTIFY));
     event->motion.x = x;

Modified: releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm (216381 => 216382)


--- releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm	2017-05-08 11:01:17 UTC (rev 216381)
+++ releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm	2017-05-08 11:03:54 UTC (rev 216382)
@@ -177,22 +177,6 @@
     [m_view rightMouseUp:event];
 
 }
-    
-void PlatformWebView::simulateMouseMove(unsigned x, unsigned y)
-{   
-    NSEvent *event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
-                               location:NSMakePoint(x, y)
-                          modifierFlags:0
-                              timestamp:GetCurrentEventTime()
-                           windowNumber:[m_window windowNumber]
-                                context:[NSGraphicsContext currentContext]
-                            eventNumber:0
-                             clickCount:0
-                               pressure:0];
-    
-    [m_view mouseMoved:event];
-    
-}
 
 static NSEventType eventTypeForButton(WKEventMouseButton button)
 {
@@ -226,7 +210,13 @@
 
     return returnVal;
 }
-    
+
+void PlatformWebView::simulateMouseMove(unsigned x, unsigned y, WKEventModifiers modifiers)
+{
+    NSEvent *event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved location:NSMakePoint(x, y) modifierFlags:modifierFlagsForWKModifiers(modifiers) timestamp:GetCurrentEventTime() windowNumber:[m_window windowNumber] context:[NSGraphicsContext currentContext] eventNumber:0 clickCount:0 pressure:0];
+    [m_view mouseMoved:event];
+}
+
 void PlatformWebView::simulateButtonClick(WKEventMouseButton button, unsigned x, unsigned y, WKEventModifiers modifiers)
 {
     NSEvent *event = [NSEvent mouseEventWithType:eventTypeForButton(button)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to