Title: [167280] trunk/Source/WebKit2
Revision
167280
Author
[email protected]
Date
2014-04-14 16:47:33 -0700 (Mon, 14 Apr 2014)

Log Message

REGRESSION(r166027) Menu is shown and immediately hidden after doubletap gesture.
https://bugs.webkit.org/show_bug.cgi?id=131646
<rdar://problem/16614374>

Reviewed by Benjamin Poulain.

This is a problem with every gesture that changes the selection
We don't need to delay updating the selection if the selection is
being changed with a gesture.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]):
(-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
(-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]):
(-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]):
(-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]):
(-[WKContentView _selectionChanged]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (167279 => 167280)


--- trunk/Source/WebKit2/ChangeLog	2014-04-14 23:22:16 UTC (rev 167279)
+++ trunk/Source/WebKit2/ChangeLog	2014-04-14 23:47:33 UTC (rev 167280)
@@ -1,3 +1,24 @@
+2014-04-14  Enrica Casucci  <[email protected]>
+
+        REGRESSION(r166027) Menu is shown and immediately hidden after doubletap gesture.
+        https://bugs.webkit.org/show_bug.cgi?id=131646
+        <rdar://problem/16614374>
+
+        Reviewed by Benjamin Poulain.
+
+        This is a problem with every gesture that changes the selection
+        We don't need to delay updating the selection if the selection is
+        being changed with a gesture.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]):
+        (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
+        (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]):
+        (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]):
+        (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]):
+        (-[WKContentView _selectionChanged]):
+
 2014-04-14  Dan Bernstein  <[email protected]>
 
         Let the bundle form client know whether a change in a text field was initiated by user typing

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (167279 => 167280)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2014-04-14 23:22:16 UTC (rev 167279)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2014-04-14 23:47:33 UTC (rev 167280)
@@ -115,6 +115,7 @@
     BOOL _hasValidPositionInformation;
     BOOL _isTapHighlightIDValid;
     BOOL _selectionNeedsUpdate;
+    BOOL _usingGestureForSelection;
 }
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (167279 => 167280)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2014-04-14 23:22:16 UTC (rev 167279)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2014-04-14 23:47:33 UTC (rev 167280)
@@ -1241,31 +1241,43 @@
 - (void)_didUpdateBlockSelectionWithTouch:(SelectionTouch)touch withFlags:(SelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold
 {
     [_webSelectionAssistant blockSelectionChangedWithTouch:toUIWKSelectionTouch(touch) withFlags:toUIWKSelectionFlags(flags) growThreshold:growThreshold shrinkThreshold:shrinkThreshold];
+    if (touch != SelectionTouch::Started && touch != SelectionTouch::Moved)
+        _usingGestureForSelection = NO;
 }
 
 - (void)changeSelectionWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)state
 {
-    _page->selectWithGesture(WebCore::IntPoint(point), CharacterGranularity, static_cast<uint32_t>(toGestureType(gestureType)), static_cast<uint32_t>(toGestureRecognizerState(state)), GestureCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) {
+    _usingGestureForSelection = YES;
+    _page->selectWithGesture(WebCore::IntPoint(point), CharacterGranularity, static_cast<uint32_t>(toGestureType(gestureType)), static_cast<uint32_t>(toGestureRecognizerState(state)), GestureCallback::create([self, state](bool error, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) {
         selectionChangedWithGesture(error, self, point, gestureType, gestureState, flags);
+        if (state == UIGestureRecognizerStateEnded || state == UIGestureRecognizerStateCancelled)
+            _usingGestureForSelection = NO;
     }));
 }
 
 - (void)changeSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch baseIsStart:(BOOL)baseIsStart
 {
-    _page->updateSelectionWithTouches(WebCore::IntPoint(point), static_cast<uint32_t>(toSelectionTouch(touch)), baseIsStart, TouchesCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t touch) {
+    _usingGestureForSelection = YES;
+    _page->updateSelectionWithTouches(WebCore::IntPoint(point), static_cast<uint32_t>(toSelectionTouch(touch)), baseIsStart, TouchesCallback::create([self, touch](bool error, const WebCore::IntPoint& point, uint32_t touch) {
         selectionChangedWithTouch(error, self, point, touch);
+        if (touch != UIWKSelectionTouchStarted && touch != UIWKSelectionTouchMoved)
+            _usingGestureForSelection = NO;
     }));
 }
 
 - (void)changeSelectionWithTouchesFrom:(CGPoint)from to:(CGPoint)to withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState
 {
-    _page->selectWithTwoTouches(WebCore::IntPoint(from), WebCore::IntPoint(to), static_cast<uint32_t>(toGestureType(gestureType)), static_cast<uint32_t>(toGestureRecognizerState(gestureState)), GestureCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) {
+    _usingGestureForSelection = YES;
+    _page->selectWithTwoTouches(WebCore::IntPoint(from), WebCore::IntPoint(to), static_cast<uint32_t>(toGestureType(gestureType)), static_cast<uint32_t>(toGestureRecognizerState(gestureState)), GestureCallback::create([self, gestureState](bool error, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) {
         selectionChangedWithGesture(error, self, point, gestureType, gestureState, flags);
+        if (gestureState == UIGestureRecognizerStateEnded || gestureState == UIGestureRecognizerStateCancelled)
+            _usingGestureForSelection = NO;
     }));
 }
 
 - (void)changeBlockSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch forHandle:(UIWKHandlePosition)handle
 {
+    _usingGestureForSelection = YES;
     _page->updateBlockSelectionWithTouch(WebCore::IntPoint(point), static_cast<uint32_t>(toSelectionTouch(touch)), static_cast<uint32_t>(toSelectionHandlePosition(handle)));
 }
 
@@ -2001,6 +2013,10 @@
 - (void)_selectionChanged
 {
     _selectionNeedsUpdate = YES;
+    // If we are changing the selection with a gesture there is no need
+    // to wait to paint the selection.
+    if (_usingGestureForSelection)
+        [self _updateChangedSelection];
 }
 
 - (void)_updateChangedSelection
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to