REGRESSION: fast/events/touch/ios/long-press-on-image.html is failing
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Oct 2019 17:22:28 +0000 (17:22 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Oct 2019 17:22:28 +0000 (17:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202845
Source/WebKit:

Reviewed by Antoine Quint.

Update _contentsOfUserInterfaceItem so that it returns more information
on a context menu.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _contentsOfUserInterfaceItem:]):

LayoutTests:

<rdar://51717197>

Reviewed by Antoine Quint.

This test failed because images no longer pop up action sheets, but
instead use context menus.

We no longer need to test the actions in the context menu here, since
it is covered by the TestWebKitAPI/Tests/WebKitCocoa/ContextMenus test.

However, we can still use this test to ensure we are getting a
context menu on the correct element.

* fast/events/touch/ios/long-press-on-image-expected.txt:
* fast/events/touch/ios/long-press-on-image.html:
* platform/iphone-7/fast/events/touch/force-press-on-link.html: This
test currently fails and needs to be rewritten (rdar://problem/52699530),
but at least update it to use the new data from the Internal API.

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

LayoutTests/ChangeLog
LayoutTests/fast/events/touch/ios/long-press-on-image-expected.txt
LayoutTests/fast/events/touch/ios/long-press-on-image.html
LayoutTests/platform/iphone-7/fast/events/touch/force-press-on-link.html
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

index 1d6d660..b10af16 100644 (file)
@@ -1,3 +1,26 @@
+2019-10-11  Dean Jackson  <dino@apple.com>
+
+        REGRESSION: fast/events/touch/ios/long-press-on-image.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=202845
+        <rdar://51717197>
+
+        Reviewed by Antoine Quint.
+
+        This test failed because images no longer pop up action sheets, but
+        instead use context menus.
+
+        We no longer need to test the actions in the context menu here, since
+        it is covered by the TestWebKitAPI/Tests/WebKitCocoa/ContextMenus test.
+
+        However, we can still use this test to ensure we are getting a
+        context menu on the correct element.
+
+        * fast/events/touch/ios/long-press-on-image-expected.txt:
+        * fast/events/touch/ios/long-press-on-image.html:
+        * platform/iphone-7/fast/events/touch/force-press-on-link.html: This
+        test currently fails and needs to be rewritten (rdar://problem/52699530),
+        but at least update it to use the new data from the Internal API.
+
 2019-10-11  Peng Liu  <peng.liu6@apple.com>
 
         Layout Test media/W3C/audio/events/event_progress.html is flaky
index c88708c..6c03958 100644 (file)
@@ -14,7 +14,7 @@
             return `
             (function() {
                 uiController.longPressAtPoint(30, 20, function() {
-                    uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('actionSheet')));
+                    uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('contextMenu')));
                 });
              })();`
         }
             var target = document.getElementById('target');
             if (testRunner.runUIScript) {
                 testRunner.runUIScript(getUIScript(), function(result) {
-                    var actionDictionary = JSON.parse(result);
-                    var actionStrings = actionDictionary.actionSheet;
+                    var results = JSON.parse(result).contextMenu;
                     var output = '';
-                    if (actionStrings[0] == 'Share…' && actionStrings[1] == 'Add to Photos' && actionStrings[2] == 'Copy' && actionStrings[3] == 'Cancel') {
-                        output += 'Available Actions: <br>';
-                        output +=  actionStrings.join('<br>');
-                        output += '<br>';
-                        output += 'PASS';
-                    }
-                    else {
-                        output += 'Available Actions: <br>';
-                        output += actionStrings.join('<br>');
-                        output += '<br>';
-                        output += 'FAIL'
-                    }
+                    if (results.imageURL.includes("dice.png") && results.isImage && !results.isLink)
+                        output += 'PASS: context menu triggered on image';
+                    else
+                        output += 'FAIL: context menu was not triggered on image';
 
                     document.getElementById('target').innerHTML = output;
                     testRunner.notifyDone();
index eda45b1..29c3aa0 100644 (file)
@@ -52,7 +52,7 @@
                 uiController.sendEventStream(JSON.stringify(eventStream), function() {});
              
                 uiController.didShowForcePressPreviewCallback = function() {
-                    uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('linkPreviewPopoverContents')));
+                    uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('contextMenu')));
                 };
              
             })();`
@@ -78,9 +78,8 @@
             
             if (testRunner.runUIScript) {
                 testRunner.runUIScript(getUIScript(), function(result) {
-                    var uiContentsDictionary = JSON.parse(result);
-                    var pageURL = uiContentsDictionary.linkPreviewPopoverContents.pageURL;
-                    if (pageURL = 'http://localhost:54321')
+                    var results = JSON.parse(result).contextMenu;
+                    if (results.url == 'http://localhost:54321' && results.isLink)
                         output += 'PASS: correct page loaded in popover';
                     document.getElementById('target').innerHTML = output;
                                        
index 99dc572..31466cd 100644 (file)
@@ -1,3 +1,16 @@
+2019-10-11  Dean Jackson  <dino@apple.com>
+
+        REGRESSION: fast/events/touch/ios/long-press-on-image.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=202845
+
+        Reviewed by Antoine Quint.
+
+        Update _contentsOfUserInterfaceItem so that it returns more information
+        on a context menu.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _contentsOfUserInterfaceItem:]):
+
 2019-10-11  Alex Christensen  <achristensen@webkit.org>
 
         Use sendWithAsyncReply for cookie getting/clearing functions
index 52cdfa5..7f9a05a 100644 (file)
@@ -7895,12 +7895,22 @@ static WebEventFlags webEventFlagsForUIKeyModifierFlags(UIKeyModifierFlags flags
         return @{ userInterfaceItem: [_actionSheetAssistant currentAvailableActionTitles] };
 
 #if HAVE(LINK_PREVIEW)
-    if ([userInterfaceItem isEqualToString:@"linkPreviewPopoverContents"]) {
+    if ([userInterfaceItem isEqualToString:@"contextMenu"]) {
         if (self._shouldUseContextMenus)
-            return @{ userInterfaceItem: @{ @"pageURL": WTF::userVisibleString(_positionInformation.url) } };
+            return @{ userInterfaceItem: @{
+                @"url": _positionInformation.url.isValid() ? WTF::userVisibleString(_positionInformation.url) : @"",
+                @"isLink": [NSNumber numberWithBool:_positionInformation.isLink],
+                @"isImage": [NSNumber numberWithBool:_positionInformation.isImage],
+                @"imageURL": _positionInformation.imageURL.isValid() ? WTF::userVisibleString(_positionInformation.imageURL) : @""
+            } };
 
         NSString *url = [_previewItemController previewData][UIPreviewDataLink];
-        return @{ userInterfaceItem: @{ @"pageURL": url } };
+        return @{ userInterfaceItem: @{
+            @"url": url,
+            @"isLink": [NSNumber numberWithBool:_positionInformation.isLink],
+            @"isImage": [NSNumber numberWithBool:_positionInformation.isImage],
+            @"imageURL": _positionInformation.imageURL.isValid() ? WTF::userVisibleString(_positionInformation.imageURL) : @""
+        } };
     }
 #endif