⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 248353 in webkit


Ignore:
Timestamp:
Aug 6, 2019, 11:52:47 PM (7 years ago)
Author:
Kocsen Chung
Message:

Cherry-pick r247920. rdar://problem/54017883

Contextual menu does not present when holding an embedded photo but works with link and attachments
https://bugs.webkit.org/show_bug.cgi?id=200239
<rdar://problem/53318733>

Reviewed by Tim Horton.

If the user long-pressed on an image, and the client implemented the new API but did
not provide a configuration, we were not falling back to the default behaviour of
giving a menu allowing the user to copy/share/save the image.

  • UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView continueContextMenuInteraction:]): If we get through the delegates, and the element is an image, return the default configuration.

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

Location:
branches/safari-608.1-branch/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608.1-branch/Source/WebKit/ChangeLog

    r248352 r248353  
     12019-08-06  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r247920. rdar://problem/54017883
     4
     5    Contextual menu does not present when holding an embedded photo but works with link and attachments
     6    https://bugs.webkit.org/show_bug.cgi?id=200239
     7    <rdar://problem/53318733>
     8   
     9    Reviewed by Tim Horton.
     10   
     11    If the user long-pressed on an image, and the client implemented the new API but did
     12    not provide a configuration, we were not falling back to the default behaviour of
     13    giving a menu allowing the user to copy/share/save the image.
     14   
     15    * UIProcess/ios/WKContentViewInteraction.mm:
     16    (-[WKContentView continueContextMenuInteraction:]): If we get through the delegates,
     17    and the element is an image, return the default configuration.
     18   
     19    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     20
     21    2019-07-29  Dean Jackson  <dino@apple.com>
     22
     23            Contextual menu does not present when holding an embedded photo but works with link and attachments
     24            https://bugs.webkit.org/show_bug.cgi?id=200239
     25            <rdar://problem/53318733>
     26
     27            Reviewed by Tim Horton.
     28
     29            If the user long-pressed on an image, and the client implemented the new API but did
     30            not provide a configuration, we were not falling back to the default behaviour of
     31            giving a menu allowing the user to copy/share/save the image.
     32
     33            * UIProcess/ios/WKContentViewInteraction.mm:
     34            (-[WKContentView continueContextMenuInteraction:]): If we get through the delegates,
     35            and the element is an image, return the default configuration.
     36
    1372019-08-06  Kocsen Chung  <kocsen_chung@apple.com>
    238
  • branches/safari-608.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r248352 r248353  
    79537953        }
    79547954
     7955        if (strongSelf->_positionInformation.isImage) {
     7956            ASSERT(strongSelf->_positionInformation.image);
     7957            auto cgImage = strongSelf->_positionInformation.image->makeCGImageCopy();
     7958
     7959            strongSelf->_contextMenuActionProviderDelegateNeedsOverride = NO;
     7960
     7961            auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithInteractionInformationAtPosition:strongSelf->_positionInformation]);
     7962
     7963            UIContextMenuActionProvider actionMenuProvider = [weakSelf, elementInfo] (NSArray<UIMenuElement *> *) -> UIMenu * {
     7964                auto strongSelf = weakSelf.get();
     7965                if (!strongSelf)
     7966                    return nil;
     7967
     7968                RetainPtr<NSArray<_WKElementAction *>> defaultActionsFromAssistant = [strongSelf->_actionSheetAssistant defaultActionsForImageSheet:elementInfo.get()];
     7969                auto actions = menuElementsFromDefaultActions(defaultActionsFromAssistant, elementInfo);
     7970                return [UIMenu menuWithTitle:@"" children:actions];
     7971            };
     7972
     7973            UIContextMenuContentPreviewProvider contentPreviewProvider = [weakSelf, cgImage, elementInfo] () -> UIViewController * {
     7974                auto strongSelf = weakSelf.get();
     7975                if (!strongSelf)
     7976                    return nil;
     7977
     7978                return [[WKImagePreviewViewController alloc] initWithCGImage:cgImage defaultActions:nil elementInfo:elementInfo.get()];
     7979            };
     7980
     7981            return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]);
     7982        }
     7983
    79557984        // At this point we have an object we might want to show a context menu for, but the
    79567985        // client was unable to handle it. Before giving up, we ask DataDetectors.
Note: See TracChangeset for help on using the changeset viewer.