Revert r194125 and r194186: We're going to fix this a different way.
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Mar 2016 20:27:26 +0000 (20:27 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Mar 2016 20:27:26 +0000 (20:27 +0000)
* page/EventHandler.cpp:
(WebCore::EventHandler::clear):
* page/EventHandler.h:

* Shared/NativeWebGestureEvent.h:
* Shared/mac/NativeWebGestureEventMac.mm:
(WebKit::pointForEvent):
(WebKit::NativeWebGestureEvent::NativeWebGestureEvent):
(WebKit::distanceForTouches): Deleted.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView selectFindMatch:completionHandler:]):
(-[WKWebView _web_superInputContext]):
(-[WKWebView touchesBeganWithEvent:]): Deleted.
(-[WKWebView touchesMovedWithEvent:]): Deleted.
(-[WKWebView touchesEndedWithEvent:]): Deleted.
(-[WKWebView touchesCancelledWithEvent:]): Deleted.
* UIProcess/API/mac/WKView.mm:
(-[WKView namesOfPromisedFilesDroppedAtDestination:]):
(-[WKView initWithFrame:processPool:configuration:webView:]):
(-[WKView touchesBeganWithEvent:]): Deleted.
(-[WKView touchesMovedWithEvent:]): Deleted.
(-[WKView touchesEndedWithEvent:]): Deleted.
(-[WKView touchesCancelledWithEvent:]): Deleted.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::magnifyWithEvent):
(WebKit::WebViewImpl::smartMagnifyWithEvent):
(WebKit::WebViewImpl::rotateWithEvent):
(WebKit::WebViewImpl::touchesOrderedByAge): Deleted.
(WebKit::WebViewImpl::touchesBeganWithEvent): Deleted.
(WebKit::WebViewImpl::touchesMovedWithEvent): Deleted.
(WebKit::WebViewImpl::touchesEndedWithEvent): Deleted.
(WebKit::WebViewImpl::touchesCancelledWithEvent): Deleted.

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

Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/NativeWebGestureEvent.h
Source/WebKit2/Shared/mac/NativeWebGestureEventMac.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm

index d4507d4..b236d1f 100644 (file)
@@ -1,3 +1,11 @@
+2016-03-14  Tim Horton  <timothy_horton@apple.com>
+
+        Revert r194125 and r194186: We're going to fix this a different way.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::clear):
+        * page/EventHandler.h:
+
 2016-03-14  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         [Fetch API] FetchLoader should check for empty bodies
index 30a26a1..d552f4a 100644 (file)
@@ -427,10 +427,10 @@ void EventHandler::clear()
     m_clickCount = 0;
     m_clickNode = nullptr;
 #if ENABLE(IOS_GESTURE_EVENTS)
+    m_gestureInitialDiameter = GestureUnknown;
     m_gestureInitialRotation = GestureUnknown;
 #endif
 #if ENABLE(IOS_GESTURE_EVENTS) || ENABLE(MAC_GESTURE_EVENTS)
-    m_gestureInitialDiameter = GestureUnknown;
     m_gestureLastDiameter = GestureUnknown;
     m_gestureLastRotation = GestureUnknown;
     m_gestureTargets.clear();
index f666a1b..2435da0 100644 (file)
@@ -512,10 +512,10 @@ private:
     RefPtr<Node> m_clickNode;
 
 #if ENABLE(IOS_GESTURE_EVENTS)
+    float m_gestureInitialDiameter { GestureUnknown };
     float m_gestureInitialRotation { GestureUnknown };
 #endif
 #if ENABLE(IOS_GESTURE_EVENTS) || ENABLE(MAC_GESTURE_EVENTS)
-    float m_gestureInitialDiameter { GestureUnknown };
     float m_gestureLastDiameter { GestureUnknown };
     float m_gestureLastRotation { GestureUnknown };
     EventTargetSet m_gestureTargets;
index 7789e87..584ae29 100644 (file)
@@ -1,3 +1,38 @@
+2016-03-14  Tim Horton  <timothy_horton@apple.com>
+
+        Revert r194125 and r194186: We're going to fix this a different way.
+
+        * Shared/NativeWebGestureEvent.h:
+        * Shared/mac/NativeWebGestureEventMac.mm:
+        (WebKit::pointForEvent):
+        (WebKit::NativeWebGestureEvent::NativeWebGestureEvent):
+        (WebKit::distanceForTouches): Deleted.
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView selectFindMatch:completionHandler:]):
+        (-[WKWebView _web_superInputContext]):
+        (-[WKWebView touchesBeganWithEvent:]): Deleted.
+        (-[WKWebView touchesMovedWithEvent:]): Deleted.
+        (-[WKWebView touchesEndedWithEvent:]): Deleted.
+        (-[WKWebView touchesCancelledWithEvent:]): Deleted.
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
+        (-[WKView initWithFrame:processPool:configuration:webView:]):
+        (-[WKView touchesBeganWithEvent:]): Deleted.
+        (-[WKView touchesMovedWithEvent:]): Deleted.
+        (-[WKView touchesEndedWithEvent:]): Deleted.
+        (-[WKView touchesCancelledWithEvent:]): Deleted.
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::WebViewImpl):
+        (WebKit::WebViewImpl::magnifyWithEvent):
+        (WebKit::WebViewImpl::smartMagnifyWithEvent):
+        (WebKit::WebViewImpl::rotateWithEvent):
+        (WebKit::WebViewImpl::touchesOrderedByAge): Deleted.
+        (WebKit::WebViewImpl::touchesBeganWithEvent): Deleted.
+        (WebKit::WebViewImpl::touchesMovedWithEvent): Deleted.
+        (WebKit::WebViewImpl::touchesEndedWithEvent): Deleted.
+        (WebKit::WebViewImpl::touchesCancelledWithEvent): Deleted.
+
 2016-03-14  Anders Carlsson  <andersca@apple.com>
 
         Fix build.
index b032a40..b98b758 100644 (file)
 #include "WebGestureEvent.h"
 
 OBJC_CLASS NSEvent;
-OBJC_CLASS NSTouch;
 
 namespace WebKit {
 
 class NativeWebGestureEvent final : public WebGestureEvent {
 public:
-    explicit NativeWebGestureEvent(NSEvent *, NSView *, Vector<NSTouch *> touches);
+    explicit NativeWebGestureEvent(NSEvent *, NSView *);
 
     NSEvent *nativeEvent() const { return m_nativeEvent.get(); }
 
index 683674f..3b55ce8 100644 (file)
@@ -59,31 +59,16 @@ static NSPoint pointForEvent(NSEvent *event, NSView *windowView)
     return location;
 }
 
-static CGFloat distanceForTouches(Vector<NSTouch *> touches)
-{
-    if (touches.size() < 2)
-        return -1;
-
-    NSPoint firstTouchPosition = touches[0].normalizedPosition;
-    NSPoint secondTouchPosition = touches[1].normalizedPosition;
-
-    CGFloat dx = secondTouchPosition.x - firstTouchPosition.x;
-    CGFloat dy = secondTouchPosition.y - firstTouchPosition.y;
-
-    return sqrtf(dx * dx + dy * dy);
-}
-
-NativeWebGestureEvent::NativeWebGestureEvent(NSEvent *event, NSView *view, Vector<NSTouch *> touches)
+NativeWebGestureEvent::NativeWebGestureEvent(NSEvent *event, NSView *view)
     : WebGestureEvent(
         webEventTypeForNSEvent(event),
         static_cast<Modifiers>(0),
         event.timestamp,
         WebCore::IntPoint(pointForEvent(event, view)),
-        distanceForTouches(touches),
+        event.type == NSEventTypeMagnify ? event.magnification : 0,
         event.type == NSEventTypeRotate ? event.rotation : 0)
     , m_nativeEvent(event)
 {
-
 }
 
 } // namespace WebKit
index 10b189d..f4fc0d2 100644 (file)
@@ -2881,26 +2881,6 @@ WEBCORE_COMMAND(yankAndSelect)
     [[self _ensureTextFinderClient] selectFindMatch:findMatch completionHandler:completionHandler];
 }
 
-- (void)touchesBeganWithEvent:(NSEvent *)event
-{
-    _impl->touchesBeganWithEvent(event);
-}
-
-- (void)touchesMovedWithEvent:(NSEvent *)event
-{
-    _impl->touchesMovedWithEvent(event);
-}
-
-- (void)touchesEndedWithEvent:(NSEvent *)event
-{
-    _impl->touchesEndedWithEvent(event);
-}
-
-- (void)touchesCancelledWithEvent:(NSEvent *)event
-{
-    _impl->touchesCancelledWithEvent(event);
-}
-
 - (NSTextInputContext *)_web_superInputContext
 {
     return [super inputContext];
index 179e025..cdfa150 100644 (file)
@@ -842,26 +842,6 @@ Some other editing-related methods still unimplemented:
     return _data->_impl->namesOfPromisedFilesDroppedAtDestination(dropDestination);
 }
 
-- (void)touchesBeganWithEvent:(NSEvent *)event
-{
-    _data->_impl->touchesBeganWithEvent(event);
-}
-
-- (void)touchesMovedWithEvent:(NSEvent *)event
-{
-    _data->_impl->touchesMovedWithEvent(event);
-}
-
-- (void)touchesEndedWithEvent:(NSEvent *)event
-{
-    _data->_impl->touchesEndedWithEvent(event);
-}
-
-- (void)touchesCancelledWithEvent:(NSEvent *)event
-{
-    _data->_impl->touchesCancelledWithEvent(event);
-}
-
 - (instancetype)initWithFrame:(NSRect)frame processPool:(WebProcessPool&)processPool configuration:(Ref<API::PageConfiguration>&&)configuration webView:(WKWebView *)webView
 {
     self = [super initWithFrame:frame];
index a21d631..947be08 100644 (file)
@@ -418,11 +418,6 @@ public:
     void rotateWithEvent(NSEvent *);
     void smartMagnifyWithEvent(NSEvent *);
 
-    void touchesBeganWithEvent(NSEvent *);
-    void touchesMovedWithEvent(NSEvent *);
-    void touchesEndedWithEvent(NSEvent *);
-    void touchesCancelledWithEvent(NSEvent *);
-
     void setLastMouseDownEvent(NSEvent *);
 
     void gestureEventWasNotHandledByWebCore(NSEvent *);
@@ -516,8 +511,6 @@ private:
     bool mightBeginDragWhileInactive();
     bool mightBeginScrollWhileInactive();
 
-    Vector<NSTouch *> touchesOrderedByAge();
-
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     void handleRequestedCandidates(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates);
     void handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate);
@@ -633,9 +626,6 @@ private:
     RetainPtr<NSEvent> m_keyDownEventBeingResent;
     Vector<WebCore::KeypressCommand>* m_collectedKeypressCommands { nullptr };
 
-    Vector<RetainPtr<id <NSObject, NSCopying>>> m_activeTouchIdentities;
-    RetainPtr<NSArray> m_lastTouches;
-
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     String m_lastStringForCandidateRequest;
 #endif
index 65a62f8..6c8287b 100644 (file)
@@ -486,7 +486,6 @@ WebViewImpl::WebViewImpl(NSView <WebViewImplDelegate> *view, WKWebView *outerWeb
     registerDraggedTypes();
 
     m_view.wantsLayer = YES;
-    m_view.acceptsTouchEvents = YES;
 
     // Explicitly set the layer contents placement so AppKit will make sure that our layer has masksToBounds set to YES.
     m_view.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft;
@@ -3259,7 +3258,7 @@ void WebViewImpl::magnifyWithEvent(NSEvent *event)
 {
     if (!m_allowsMagnification) {
 #if ENABLE(MAC_GESTURE_EVENTS)
-        NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view, touchesOrderedByAge());
+        NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
         m_page->handleGestureEvent(webEvent);
 #endif
         [m_view _web_superMagnifyWithEvent:event];
@@ -3276,67 +3275,13 @@ void WebViewImpl::magnifyWithEvent(NSEvent *event)
         return;
     }
 
-    NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view, touchesOrderedByAge());
+    NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
     m_page->handleGestureEvent(webEvent);
 #else
     gestureController.handleMagnificationGestureEvent(event, [m_view convertPoint:event.locationInWindow fromView:nil]);
 #endif
 }
 
-Vector<NSTouch *> WebViewImpl::touchesOrderedByAge()
-{
-    Vector<NSTouch *> touches;
-
-    for (auto& touchIdentity : m_activeTouchIdentities) {
-        for (NSTouch *touch in m_lastTouches.get()) {
-            if (![touch.identity isEqual:touchIdentity.get()])
-                continue;
-            touches.append(touch);
-            break;
-        }
-    }
-
-    return touches;
-}
-
-void WebViewImpl::touchesBeganWithEvent(NSEvent *event)
-{
-    m_lastTouches = [event touchesMatchingPhase:NSTouchPhaseAny inView:m_view].allObjects;
-    for (NSTouch *touch in [event touchesMatchingPhase:NSTouchPhaseBegan inView:m_view])
-        m_activeTouchIdentities.append(touch.identity);
-}
-
-void WebViewImpl::touchesMovedWithEvent(NSEvent *event)
-{
-    m_lastTouches = [event touchesMatchingPhase:NSTouchPhaseAny inView:m_view].allObjects;
-}
-
-void WebViewImpl::touchesEndedWithEvent(NSEvent *event)
-{
-    m_lastTouches = [event touchesMatchingPhase:NSTouchPhaseAny inView:m_view].allObjects;
-    for (NSTouch *touch in [event touchesMatchingPhase:NSTouchPhaseEnded inView:m_view]) {
-        for (size_t i = 0; i < m_activeTouchIdentities.size(); i++) {
-            if ([m_activeTouchIdentities[i] isEqual:touch.identity]) {
-                m_activeTouchIdentities.remove(i);
-                break;
-            }
-        }
-    }
-}
-
-void WebViewImpl::touchesCancelledWithEvent(NSEvent *event)
-{
-    m_lastTouches = [event touchesMatchingPhase:NSTouchPhaseAny inView:m_view].allObjects;
-    for (NSTouch *touch in [event touchesMatchingPhase:NSTouchPhaseCancelled inView:m_view]) {
-        for (size_t i = 0; i < m_activeTouchIdentities.size(); i++) {
-            if ([m_activeTouchIdentities[i] isEqual:touch.identity]) {
-                m_activeTouchIdentities.remove(i);
-                break;
-            }
-        }
-    }
-}
-
 void WebViewImpl::smartMagnifyWithEvent(NSEvent *event)
 {
     if (!m_allowsMagnification) {
@@ -3365,7 +3310,7 @@ void WebViewImpl::setLastMouseDownEvent(NSEvent *event)
 #if ENABLE(MAC_GESTURE_EVENTS)
 void WebViewImpl::rotateWithEvent(NSEvent *event)
 {
-    NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view, touchesOrderedByAge());
+    NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
     m_page->handleGestureEvent(webEvent);
 }
 #endif