Bug 226387

Summary: [iOS] Adjust logic when determining whether to enable image extraction actions in the callout bar
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: PlatformAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, bdakin, hi, megan_gardner, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Description Wenson Hsieh 2021-05-28 11:48:37 PDT
rdar://76781788
Comment 1 Wenson Hsieh 2021-05-28 11:52:36 PDT
Created attachment 430036 [details]
Patch
Comment 2 Devin Rousso 2021-05-28 11:55:48 PDT
Comment on attachment 430036 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=430036&action=review

r=me

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3790
> +    if (WebKit::isImageExtractionAction(action))
> +        return editorState.isContentEditable && [super canPerformAction:action withSender:sender];

r=me

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3790
> +        return editorState.isContentEditable && [super canPerformAction:action withSender:sender];

NIT: Seeing as how the next line is also `[super canPerformAction:action withSender:sender]` maybe we can adjust the `if` to avoid repeating it?
```
    if (WebKit::isImageExtractionAction(action) && !editorState.isContentEditable)
        return NO;
```
Comment 3 Wenson Hsieh 2021-05-28 11:58:08 PDT
Comment on attachment 430036 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=430036&action=review

>>> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3790
>>> +        return editorState.isContentEditable && [super canPerformAction:action withSender:sender];
>> 
>> r=me
> 
> NIT: Seeing as how the next line is also `[super canPerformAction:action withSender:sender]` maybe we can adjust the `if` to avoid repeating it?
> ```
>     if (WebKit::isImageExtractionAction(action) && !editorState.isContentEditable)
>         return NO;
> ```

👍🏻
Comment 4 Wenson Hsieh 2021-05-28 12:06:53 PDT
Created attachment 430039 [details]
Patch for landing
Comment 5 EWS 2021-05-28 13:02:36 PDT
Committed r278221 (238259@main): <https://commits.webkit.org/238259@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 430039 [details].