[webkit-reviews] review granted: [Bug 234162] Image does not update after Markup Pane is dismissed. : [Attachment 446773] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Dec 10 12:09:15 PST 2021


Devin Rousso <drousso at apple.com> has granted Megan Gardner
<megan_gardner at apple.com>'s request for review:
Bug 234162: Image does not update after Markup Pane is dismissed.
https://bugs.webkit.org/show_bug.cgi?id=234162

Attachment 446773: Patch

https://bugs.webkit.org/attachment.cgi?id=446773&action=review




--- Comment #2 from Devin Rousso <drousso at apple.com> ---
Comment on attachment 446773
  --> https://bugs.webkit.org/attachment.cgi?id=446773
Patch

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

r=me

> Source/WebCore/dom/mac/ImageControlsMac.cpp:133
> +	   if (!is<HTMLImageElement>(*shadowHost))

NIT: you can merge this with the above `if (!shadowHost)` since `is` checks for
an invalid pointer
```
    if (!is<HTMLImageElement>(shadowHost))
	return false;
```

> Source/WebCore/dom/mac/ImageControlsMac.cpp:135
> +	   HTMLImageElement& imageElement =
downcast<HTMLImageElement>(*shadowHost);

NIT: Chould we move this inside the `if` since it's not used outside?

> Source/WebCore/page/ChromeClient.h:535
> +    virtual void handleImageServiceClick(const IntPoint&, Image&, bool
/*isEditable*/, const IntRect&, const String&) { }

I'd include the name like `const String& /* attachmentID */` as it's not really
clear otherwise what it's for.

> Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm:153
> +- (void)setData:(NSData *)data newContentType:(NSString *)newContentType

NIT: Do we actually need this?	Can't we just `[attachment setData:data
newContentType:String(NSPasteboardTypeTIFF) newFilename:nil completion:nil];`?

> Source/WebKit/UIProcess/mac/WKSharingServicePickerDelegate.mm:151
> +	   [itemProvider loadDataRepresentationForTypeIdentifier:(NSString
*)kUTTypeData completionHandler:^(NSData *data, NSError *error) {

NIT: Is the `(NSString *)` cast necessary?

> Source/WebKit/UIProcess/mac/WKSharingServicePickerDelegate.mm:155
> +	       auto apiAttachment =
_menuProxy->page()->attachmentForIdentifier(_attachmentID);

Do we need to check that `_menuProxy` and/or `_menuProxy->page()` exist at this
point?
```
    WebPageProxy* page = _menuProxy ? _menyProxy->page() : nullptr;
    if (!page)
	return;

    auto apiAttachment = page->attachmentForIdentifier(_attachmentID);
    ...
```

> Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm:247
> +    [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate]
setAttachmentID:m_context.controlledImageAttachmentID()];

```
    [WKSharingServicePickerDelegate.sharedSharingServicePickerDelegate
setAttachmentID:m_context.controlledImageAttachmentID()];
```

> Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:384
> +    void handleImageServiceClick(const WebCore::IntPoint&, WebCore::Image&,
bool isEditable, const WebCore::IntRect&, const String&) final;

ditto (Source/WebCore/page/ChromeClient.h:535)


More information about the webkit-reviews mailing list