Title: [188285] trunk/Source/WebKit2
Revision
188285
Author
bda...@apple.com
Date
2015-08-11 13:36:06 -0700 (Tue, 11 Aug 2015)

Log Message

REGRESSION (r188053): Sometimes unable to save an image from Google Search/
imgur via long press
https://bugs.webkit.org/show_bug.cgi?id=147896

Reviewed by Enrica Casucci.

http://trac.webkit.org/changeset/188053 added code to call cleanupSheet when 
the long press gesture is cancelled. However, the gesture will be called with 
the cancelled state when then user taps an item in the action sheet (such as 
“save image”), and sometimes the “cancel” comes in before the image has been 
saved. That is a problem because we need to avoid cleaning up the sheet until 
after the image is saved. Before that patch, we never cleaned up the sheet on 
cancel, so this patch goes back to that behavior. We also have to remove some 
assertions that assume that everything will be totally cleaned up when a new 
sheet is created, but that is not necessarily true due to interactions 
between the preview gesture and the long press gesture. 

Remove assertions.
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]):
(-[WKActionSheetAssistant showImageSheet]):
(-[WKActionSheetAssistant showLinkSheet]):
(-[WKActionSheetAssistant showDataDetectorsSheet]):

Revert the part of Enrica’s patch that called cleanupSheet when the gesture 
is cancelled.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _longPressRecognized:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (188284 => 188285)


--- trunk/Source/WebKit2/ChangeLog	2015-08-11 20:20:52 UTC (rev 188284)
+++ trunk/Source/WebKit2/ChangeLog	2015-08-11 20:36:06 UTC (rev 188285)
@@ -1,3 +1,34 @@
+2015-08-11  Beth Dakin  <bda...@apple.com>
+
+        REGRESSION (r188053): Sometimes unable to save an image from Google Search/
+        imgur via long press
+        https://bugs.webkit.org/show_bug.cgi?id=147896
+
+        Reviewed by Enrica Casucci.
+
+        http://trac.webkit.org/changeset/188053 added code to call cleanupSheet when 
+        the long press gesture is cancelled. However, the gesture will be called with 
+        the cancelled state when then user taps an item in the action sheet (such as 
+        “save image”), and sometimes the “cancel” comes in before the image has been 
+        saved. That is a problem because we need to avoid cleaning up the sheet until 
+        after the image is saved. Before that patch, we never cleaned up the sheet on 
+        cancel, so this patch goes back to that behavior. We also have to remove some 
+        assertions that assume that everything will be totally cleaned up when a new 
+        sheet is created, but that is not necessarily true due to interactions 
+        between the preview gesture and the long press gesture. 
+
+        Remove assertions.
+        * UIProcess/ios/WKActionSheetAssistant.mm:
+        (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]):
+        (-[WKActionSheetAssistant showImageSheet]):
+        (-[WKActionSheetAssistant showLinkSheet]):
+        (-[WKActionSheetAssistant showDataDetectorsSheet]):
+
+        Revert the part of Enrica’s patch that called cleanupSheet when the gesture 
+        is cancelled.
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _longPressRecognized:]):
+
 2015-08-11  Anders Carlsson  <ander...@apple.com>
 
         Remove unversioned client structs from the C SPI

Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm (188284 => 188285)


--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm	2015-08-11 20:20:52 UTC (rev 188284)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm	2015-08-11 20:36:06 UTC (rev 188285)
@@ -206,7 +206,6 @@
 
 - (void)_createSheetWithElementActions:(NSArray *)actions showLinkTitle:(BOOL)showLinkTitle
 {
-    ASSERT(!_interactionSheet);
     auto delegate = _delegate.get();
     if (!delegate)
         return;
@@ -263,7 +262,6 @@
 
 - (void)showImageSheet
 {
-    ASSERT(!_interactionSheet);
     ASSERT(!_elementInfo);
 
     auto delegate = _delegate.get();
@@ -373,7 +371,6 @@
 
 - (void)showLinkSheet
 {
-    ASSERT(!_interactionSheet);
     ASSERT(!_elementInfo);
 
     auto delegate = _delegate.get();
@@ -406,8 +403,6 @@
 
 - (void)showDataDetectorsSheet
 {
-    ASSERT(!_interactionSheet);
-
     auto delegate = _delegate.get();
     if (!delegate)
         return;

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (188284 => 188285)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-08-11 20:20:52 UTC (rev 188284)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-08-11 20:36:06 UTC (rev 188285)
@@ -1083,22 +1083,13 @@
 
     _lastInteractionLocation = gestureRecognizer.startPoint;
 
-    switch ([gestureRecognizer state]) {
-    case UIGestureRecognizerStateBegan:
-    {
+    if ([gestureRecognizer state] == UIGestureRecognizerStateBegan) {
         SEL action = "" _actionForLongPress];
         if (action) {
             [self performSelector:action];
             [self _cancelLongPressGestureRecognizer];
         }
     }
-        break;
-    case UIGestureRecognizerStateCancelled:
-        [_actionSheetAssistant cleanupSheet];
-        break;
-    default:
-        break;
-    }
 }
 
 - (void)_singleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to