Image does not update after Markup Pane is dismissed.
Created attachment 446773 [details] Patch
Comment on attachment 446773 [details] 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)
Comment on attachment 446773 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446773&action=review >> 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];`? Well, the old SPI is deprecated, so it's probably best to make this separate from that. >> 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); > ... > ``` Well, we don't check about 10 lines down from this in pre-existing code, so if we should we should in both places. >> Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm:247 >> + [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setAttachmentID:m_context.controlledImageAttachmentID()]; > > ``` > [WKSharingServicePickerDelegate.sharedSharingServicePickerDelegate setAttachmentID:m_context.controlledImageAttachmentID()]; > ``` literally every other line in this file that calls something on the shared delegate uses the [] method, I'd prefer it to be consistent.
Created attachment 446806 [details] Patch
Created attachment 446835 [details] Patch for landing
Committed r286886 (245115@main): <https://commits.webkit.org/245115@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 446835 [details].
<rdar://problem/86346270>