WKView should stop using endGestureWithEvent
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Apr 2015 01:15:58 +0000 (01:15 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Apr 2015 01:15:58 +0000 (01:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143285
<rdar://problem/20357007>

Reviewed by Simon Fraser.

* UIProcess/API/mac/WKView.mm:
(-[WKView magnifyWithEvent:]):
(-[WKView endGestureWithEvent:]): Deleted.
* UIProcess/mac/ViewGestureController.h:
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::endMagnificationGesture):
(WebKit::ViewGestureController::endActiveGesture): Deleted.
While there is no visible symptom, it is recommended that we check
the phase of normal magnification events instead of using the
special gesture end events.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/mac/ViewGestureController.h
Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm

index a8e7e2b..e5cc9cd 100644 (file)
@@ -1,5 +1,24 @@
 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
 
+        WKView should stop using endGestureWithEvent
+        https://bugs.webkit.org/show_bug.cgi?id=143285
+        <rdar://problem/20357007>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView magnifyWithEvent:]):
+        (-[WKView endGestureWithEvent:]): Deleted.
+        * UIProcess/mac/ViewGestureController.h:
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::endMagnificationGesture):
+        (WebKit::ViewGestureController::endActiveGesture): Deleted.
+        While there is no visible symptom, it is recommended that we check
+        the phase of normal magnification events instead of using the
+        special gesture end events.
+
+2015-03-31  Timothy Horton  <timothy_horton@apple.com>
+
         Swipes occur in the wrong direction in RTL
         https://bugs.webkit.org/show_bug.cgi?id=143257
         <rdar://problem/20300862>
index 1b0257b..8215e70 100644 (file)
@@ -4419,6 +4419,9 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     [self _ensureGestureController];
 
     _data->_gestureController->handleMagnificationGesture(event.magnification, [self convertPoint:event.locationInWindow fromView:nil]);
+
+    if (event.phase == NSEventPhaseEnded || event.phase == NSEventPhaseCancelled)
+        _data->_gestureController->endMagnificationGesture();
 }
 
 - (void)smartMagnifyWithEvent:(NSEvent *)event
@@ -4435,16 +4438,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     _data->_gestureController->handleSmartMagnificationGesture([self convertPoint:event.locationInWindow fromView:nil]);
 }
 
--(void)endGestureWithEvent:(NSEvent *)event
-{
-    if (!_data->_gestureController) {
-        [super endGestureWithEvent:event];
-        return;
-    }
-
-    _data->_gestureController->endActiveGesture();
-}
-
 - (void)setMagnification:(double)magnification centeredAtPoint:(NSPoint)point
 {
     [self _dismissContentRelativeChildWindows];
index 64d8c48..e289bc0 100644 (file)
@@ -94,6 +94,8 @@ public:
     double magnification() const;
 
     void handleMagnificationGesture(double scale, WebCore::FloatPoint origin);
+    void endMagnificationGesture();
+
     void handleSmartMagnificationGesture(WebCore::FloatPoint origin);
 
     bool handleScrollWheelEvent(NSEvent *);
@@ -104,8 +106,6 @@ public:
     WebCore::FloatRect windowRelativeBoundsForCustomSwipeViews() const;
     void setDidMoveSwipeSnapshotCallback(void(^)(CGRect));
 
-    void endActiveGesture();
-
     bool shouldIgnorePinnedState() { return m_shouldIgnorePinnedState; }
     void setShouldIgnorePinnedState(bool ignore) { m_shouldIgnorePinnedState = ignore; }
 
@@ -141,7 +141,6 @@ private:
     void didHitRenderTreeSizeThreshold();
     void removeSwipeSnapshotAfterRepaint();
 
-    void endMagnificationGesture();
     WebCore::FloatPoint scaledMagnificationOrigin(WebCore::FloatPoint origin, double scale);
 
     void trackSwipeGesture(NSEvent *, SwipeDirection);
index 0b373e9..69d2c6b 100644 (file)
@@ -179,7 +179,8 @@ void ViewGestureController::handleMagnificationGesture(double scale, FloatPoint
 
 void ViewGestureController::endMagnificationGesture()
 {
-    ASSERT(m_activeGestureType == ViewGestureType::Magnification);
+    if (m_activeGestureType != ViewGestureType::Magnification)
+        return;
 
     double newMagnification = std::min(std::max(m_magnification, minMagnification), maxMagnification);
 
@@ -191,6 +192,7 @@ void ViewGestureController::endMagnificationGesture()
     }
 
     m_activeGestureType = ViewGestureType::None;
+    m_visibleContentRectIsValid = false;
 }
 
 void ViewGestureController::handleSmartMagnificationGesture(FloatPoint origin)
@@ -787,14 +789,6 @@ void ViewGestureController::removeSwipeSnapshot()
     m_backgroundColorForCurrentSnapshot = Color();
 }
 
-void ViewGestureController::endActiveGesture()
-{
-    if (m_activeGestureType == ViewGestureType::Magnification) {
-        endMagnificationGesture();
-        m_visibleContentRectIsValid = false;
-    }
-}
-
 double ViewGestureController::magnification() const
 {
     if (m_activeGestureType == ViewGestureType::Magnification)