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

Changeset 247920 in webkit


Ignore:
Timestamp:
Jul 29, 2019, 2:19:41 PM (7 years ago)
Author:
dino@apple.com
Message:

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.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r247918 r247920  
     12019-07-29  Dean Jackson  <dino@apple.com>
     2
     3        Contextual menu does not present when holding an embedded photo but works with link and attachments
     4        https://bugs.webkit.org/show_bug.cgi?id=200239
     5        <rdar://problem/53318733>
     6
     7        Reviewed by Tim Horton.
     8
     9        If the user long-pressed on an image, and the client implemented the new API but did
     10        not provide a configuration, we were not falling back to the default behaviour of
     11        giving a menu allowing the user to copy/share/save the image.
     12
     13        * UIProcess/ios/WKContentViewInteraction.mm:
     14        (-[WKContentView continueContextMenuInteraction:]): If we get through the delegates,
     15        and the element is an image, return the default configuration.
     16
    1172019-07-29  Chris Dumez  <cdumez@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r247914 r247920  
    79647964        }
    79657965
     7966        if (strongSelf->_positionInformation.isImage) {
     7967            ASSERT(strongSelf->_positionInformation.image);
     7968            auto cgImage = strongSelf->_positionInformation.image->makeCGImageCopy();
     7969
     7970            strongSelf->_contextMenuActionProviderDelegateNeedsOverride = NO;
     7971
     7972            auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithInteractionInformationAtPosition:strongSelf->_positionInformation]);
     7973
     7974            UIContextMenuActionProvider actionMenuProvider = [weakSelf, elementInfo] (NSArray<UIMenuElement *> *) -> UIMenu * {
     7975                auto strongSelf = weakSelf.get();
     7976                if (!strongSelf)
     7977                    return nil;
     7978
     7979                RetainPtr<NSArray<_WKElementAction *>> defaultActionsFromAssistant = [strongSelf->_actionSheetAssistant defaultActionsForImageSheet:elementInfo.get()];
     7980                auto actions = menuElementsFromDefaultActions(defaultActionsFromAssistant, elementInfo);
     7981                return [UIMenu menuWithTitle:@"" children:actions];
     7982            };
     7983
     7984            UIContextMenuContentPreviewProvider contentPreviewProvider = [weakSelf, cgImage, elementInfo] () -> UIViewController * {
     7985                auto strongSelf = weakSelf.get();
     7986                if (!strongSelf)
     7987                    return nil;
     7988
     7989                return [[WKImagePreviewViewController alloc] initWithCGImage:cgImage defaultActions:nil elementInfo:elementInfo.get()];
     7990            };
     7991
     7992            return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]);
     7993        }
     7994
    79667995        // At this point we have an object we might want to show a context menu for, but the
    79677996        // client was unable to handle it. Before giving up, we ask DataDetectors.
Note: See TracChangeset for help on using the changeset viewer.