Title: [255032] branches/safari-609-branch/Source/WebKit
Revision
255032
Author
[email protected]
Date
2020-01-23 13:44:49 -0800 (Thu, 23 Jan 2020)

Log Message

Cherry-pick r254874. rdar://problem/58816330

    macCatalyst: Two-finger click is dispatched to DOM as left click
    https://bugs.webkit.org/show_bug.cgi?id=206549

    Reviewed by Simon Fraser.

    * UIProcess/ios/WKMouseGestureRecognizer.mm:
    (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]):
    (-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
    (-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
    (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
    (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
    (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
    (-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
    (-[WKMouseGestureRecognizer createMouseEventWithType:]): Deleted.
    We correctly say button=2 for ctrl-click, but not for secondary-button click.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254874 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (255031 => 255032)


--- branches/safari-609-branch/Source/WebKit/ChangeLog	2020-01-23 21:44:47 UTC (rev 255031)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog	2020-01-23 21:44:49 UTC (rev 255032)
@@ -1,5 +1,46 @@
 2020-01-23  Russell Epstein  <[email protected]>
 
+        Cherry-pick r254874. rdar://problem/58816330
+
+    macCatalyst: Two-finger click is dispatched to DOM as left click
+    https://bugs.webkit.org/show_bug.cgi?id=206549
+    
+    Reviewed by Simon Fraser.
+    
+    * UIProcess/ios/WKMouseGestureRecognizer.mm:
+    (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]):
+    (-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
+    (-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
+    (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
+    (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
+    (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
+    (-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
+    (-[WKMouseGestureRecognizer createMouseEventWithType:]): Deleted.
+    We correctly say button=2 for ctrl-click, but not for secondary-button click.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254874 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-21  Tim Horton  <[email protected]>
+
+            macCatalyst: Two-finger click is dispatched to DOM as left click
+            https://bugs.webkit.org/show_bug.cgi?id=206549
+
+            Reviewed by Simon Fraser.
+
+            * UIProcess/ios/WKMouseGestureRecognizer.mm:
+            (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]):
+            (-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
+            (-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
+            (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
+            (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
+            (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
+            (-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
+            (-[WKMouseGestureRecognizer createMouseEventWithType:]): Deleted.
+            We correctly say button=2 for ctrl-click, but not for secondary-button click.
+
+2020-01-23  Russell Epstein  <[email protected]>
+
         Cherry-pick r254711. rdar://problem/58816343
 
     Regression(r253224) No longer able to prevent a tab from closing via the beforeunload prompt

Modified: branches/safari-609-branch/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm (255031 => 255032)


--- branches/safari-609-branch/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm	2020-01-23 21:44:47 UTC (rev 255031)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm	2020-01-23 21:44:49 UTC (rev 255032)
@@ -119,15 +119,15 @@
     return NO;
 }
 
-- (std::unique_ptr<WebKit::NativeWebMouseEvent>)createMouseEventWithType:(WebKit::WebEvent::Type)type
+- (std::unique_ptr<WebKit::NativeWebMouseEvent>)createMouseEventWithType:(WebKit::WebEvent::Type)type forEvent:(UIEvent *)uiEvent
 {
     auto modifiers = webEventModifiersForUIKeyModifierFlags(self.modifierFlags);
-    BOOL hasControlModifier = modifiers.contains(WebKit::WebEvent::Modifier::ControlKey);
+    BOOL isRightButton = modifiers.contains(WebKit::WebEvent::Modifier::ControlKey) || ([uiEvent _buttonMask] & UIEventButtonMaskSecondary);
 
     auto button = [&] {
         if (!_touching || type == WebKit::WebEvent::Type::MouseUp)
             return WebKit::WebMouseEvent::NoButton;
-        if (hasControlModifier)
+        if (isRightButton)
             return WebKit::WebMouseEvent::RightButton;
         return WebKit::WebMouseEvent::LeftButton;
     }();
@@ -135,7 +135,7 @@
     auto buttons = [&] {
         if (!_touching)
             return 0;
-        if (hasControlModifier)
+        if (isRightButton)
             return 2;
         return 1;
     }();
@@ -151,7 +151,7 @@
 {
     _touching = YES;
 
-    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseDown];
+    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseDown forEvent:event];
     _lastLocation = [self locationInView:self.view];
 
     self.state = UIGestureRecognizerStateChanged;
@@ -159,7 +159,7 @@
 
 - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
 {
-    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseMove];
+    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseMove forEvent:event];
     _lastLocation = [self locationInView:self.view];
 
     self.state = UIGestureRecognizerStateChanged;
@@ -169,7 +169,7 @@
 {
     _touching = NO;
 
-    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseUp];
+    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseUp forEvent:event];
     _lastLocation = [self locationInView:self.view];
 
     self.state = UIGestureRecognizerStateChanged;
@@ -182,7 +182,7 @@
 
 - (void)_hoverEntered:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
 {
-    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseMove];
+    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseMove forEvent:event];
 
     if (_currentHoverEvent == nil && touches.count == 1 && [event isKindOfClass:NSClassFromString(@"UIHoverEvent")]) {
         _currentHoverEvent = (UIHoverEvent *)event;
@@ -201,7 +201,7 @@
         return;
     }
 
-    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseMove];
+    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseMove forEvent:event];
     _lastLocation = [self locationInView:self.view];
 
     if (_currentHoverEvent == event && [touches containsObject:_currentTouch.get()])
@@ -212,7 +212,7 @@
 
 - (void)_hoverExited:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
 {
-    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseMove];
+    _lastEvent = [self createMouseEventWithType:WebKit::WebEvent::MouseMove forEvent:event];
     _lastLocation = [self locationInView:self.view];
 
     if (_currentHoverEvent == event) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to