Title: [249560] trunk/Source
Revision
249560
Author
[email protected]
Date
2019-09-05 19:38:47 -0700 (Thu, 05 Sep 2019)

Log Message

[Win] Add support for MouseEvent.buttons
https://bugs.webkit.org/show_bug.cgi?id=201445

Reviewed by Brent Fulgham.

Source/WebCore:

Spec: <https://www.w3.org/TR/uievents/#dom-mouseevent-buttons>

* platform/win/GDIUtilities.h:
(buttonsForEvent): Added.
* platform/win/PlatformMouseEventWin.cpp:
(WebCore::PlatformMouseEvent::PlatformMouseEvent):
Set m_buttons.

Source/WebKit:

* Shared/win/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebMouseEvent):
Set m_buttons.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (249559 => 249560)


--- trunk/Source/WebCore/ChangeLog	2019-09-06 01:48:39 UTC (rev 249559)
+++ trunk/Source/WebCore/ChangeLog	2019-09-06 02:38:47 UTC (rev 249560)
@@ -1,5 +1,20 @@
 2019-09-05  Fujii Hironori  <[email protected]>
 
+        [Win] Add support for MouseEvent.buttons
+        https://bugs.webkit.org/show_bug.cgi?id=201445
+
+        Reviewed by Brent Fulgham.
+
+        Spec: <https://www.w3.org/TR/uievents/#dom-mouseevent-buttons>
+
+        * platform/win/GDIUtilities.h:
+        (buttonsForEvent): Added.
+        * platform/win/PlatformMouseEventWin.cpp:
+        (WebCore::PlatformMouseEvent::PlatformMouseEvent):
+        Set m_buttons.
+
+2019-09-05  Fujii Hironori  <[email protected]>
+
         [Win] Support Per-Monitor (V2) DPI Awareness
         https://bugs.webkit.org/show_bug.cgi?id=201450
 

Modified: trunk/Source/WebCore/platform/win/GDIUtilities.h (249559 => 249560)


--- trunk/Source/WebCore/platform/win/GDIUtilities.h	2019-09-06 01:48:39 UTC (rev 249559)
+++ trunk/Source/WebCore/platform/win/GDIUtilities.h	2019-09-06 02:38:47 UTC (rev 249560)
@@ -41,6 +41,18 @@
     return MAKELPARAM(point.x(), point.y());
 }
 
+inline unsigned short buttonsForEvent(WPARAM wparam)
+{
+    unsigned short buttons = 0;
+    if (wparam & MK_LBUTTON)
+        buttons |= 1;
+    if (wparam & MK_MBUTTON)
+        buttons |= 4;
+    if (wparam & MK_RBUTTON)
+        buttons |= 2;
+    return buttons;
+}
+
 } // namespace WebCore
 
 #endif // GDIUtilties_h

Modified: trunk/Source/WebCore/platform/win/PlatformMouseEventWin.cpp (249559 => 249560)


--- trunk/Source/WebCore/platform/win/PlatformMouseEventWin.cpp	2019-09-06 01:48:39 UTC (rev 249559)
+++ trunk/Source/WebCore/platform/win/PlatformMouseEventWin.cpp	2019-09-06 02:38:47 UTC (rev 249560)
@@ -83,6 +83,7 @@
     : PlatformEvent(messageToEventType(message), wParam & MK_SHIFT, wParam & MK_CONTROL, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, WallTime::now())
     , m_position(positionForEvent(hWnd, lParam))
     , m_globalPosition(globalPositionForEvent(hWnd, lParam))
+    , m_buttons(buttonsForEvent(wParam))
     , m_clickCount(0)
     , m_modifierFlags(wParam)
     , m_didActivateWebView(didActivateWebView)

Modified: trunk/Source/WebKit/ChangeLog (249559 => 249560)


--- trunk/Source/WebKit/ChangeLog	2019-09-06 01:48:39 UTC (rev 249559)
+++ trunk/Source/WebKit/ChangeLog	2019-09-06 02:38:47 UTC (rev 249560)
@@ -1,3 +1,14 @@
+2019-09-05  Fujii Hironori  <[email protected]>
+
+        [Win] Add support for MouseEvent.buttons
+        https://bugs.webkit.org/show_bug.cgi?id=201445
+
+        Reviewed by Brent Fulgham.
+
+        * Shared/win/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebMouseEvent):
+        Set m_buttons.
+
 2019-09-05  Chris Dumez  <[email protected]>
 
         REGRESSION: http/tests/adClickAttribution/second-attribution-converted-with-higher-priority.html and http/tests/adClickAttribution/second-attribution-converted-with-lower-priority.html are flaky timeouts

Modified: trunk/Source/WebKit/Shared/win/WebEventFactory.cpp (249559 => 249560)


--- trunk/Source/WebKit/Shared/win/WebEventFactory.cpp	2019-09-06 01:48:39 UTC (rev 249559)
+++ trunk/Source/WebKit/Shared/win/WebEventFactory.cpp	2019-09-06 02:38:47 UTC (rev 249560)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "WebEventFactory.h"
 
+#include <WebCore/GDIUtilities.h>
 #include <WebCore/PlatformKeyboardEvent.h>
 #include <WebCore/PlatformWheelEvent.h>
 #include <WebCore/Scrollbar.h>
@@ -396,8 +397,9 @@
 
     int clickCount = WebKit::clickCount(type, button, position, timestamp);
     auto modifiers = modifiersForEvent(wParam);
+    auto buttons = buttonsForEvent(wParam);
 
-    return WebMouseEvent(type, button, 0, position, globalPosition, 0, 0, 0, clickCount, modifiers, WallTime::now(), didActivateWebView);
+    return WebMouseEvent(type, button, buttons, position, globalPosition, 0, 0, 0, clickCount, modifiers, WallTime::now(), didActivateWebView);
 }
 
 WebWheelEvent WebEventFactory::createWebWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to