RESOLVED FIXED 236628
[macOS] Add a "Markup Image" item to the sharing services picker context menu
https://bugs.webkit.org/show_bug.cgi?id=236628
Summary [macOS] Add a "Markup Image" item to the sharing services picker context menu
Wenson Hsieh
Reported 2022-02-14 18:28:58 PST
Attachments
Patch (29.21 KB, patch)
2022-02-14 22:53 PST, Wenson Hsieh
no flags
Rebase on trunk (29.21 KB, patch)
2022-02-15 14:58 PST, Wenson Hsieh
ews-feeder: commit-queue-
Fix Big Sur build (29.30 KB, patch)
2022-02-15 15:13 PST, Wenson Hsieh
no flags
For landing (29.52 KB, patch)
2022-02-15 18:25 PST, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2022-02-14 22:53:01 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 2 2022-02-15 14:58:34 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 3 2022-02-15 15:13:05 PST
Created attachment 452098 [details] Fix Big Sur build
Darin Adler
Comment 4 2022-02-15 15:44:56 PST
Comment on attachment 452098 [details] Fix Big Sur build View in context: https://bugs.webkit.org/attachment.cgi?id=452098&action=review > Source/WebCore/dom/mac/ImageControlsMac.cpp:144 > if (ImageControlsMac::isImageControlsButtonElement(node)) { > - auto shadowHost = node.shadowHost(); > + RefPtr shadowHost = node.shadowHost(); > if (!is<HTMLImageElement>(*shadowHost)) > return false; > if (auto* image = imageFromImageElementNode(*shadowHost)) { This mix of early return and nested if doesn’t seem logical. Either 3 nested if statements or 3 early returns would be better than 2 and 1.
Wenson Hsieh
Comment 5 2022-02-15 17:32:53 PST
Comment on attachment 452098 [details] Fix Big Sur build View in context: https://bugs.webkit.org/attachment.cgi?id=452098&action=review Thanks for the review! >> Source/WebCore/dom/mac/ImageControlsMac.cpp:144 >> if (auto* image = imageFromImageElementNode(*shadowHost)) { > > This mix of early return and nested if doesn’t seem logical. Either 3 nested if statements or 3 early returns would be better than 2 and 1. Good point! Replaced the `if (auto* image = …)` with an early return. (Also changed this to use the `dynamicDowncast<HTMLImageElement>(…)` idiom here instead of having separate `is<>/downcast<>` calls).
Darin Adler
Comment 6 2022-02-15 17:47:45 PST
Comment on attachment 452098 [details] Fix Big Sur build View in context: https://bugs.webkit.org/attachment.cgi?id=452098&action=review >>> Source/WebCore/dom/mac/ImageControlsMac.cpp:144 >>> if (auto* image = imageFromImageElementNode(*shadowHost)) { >> >> This mix of early return and nested if doesn’t seem logical. Either 3 nested if statements or 3 early returns would be better than 2 and 1. > > Good point! Replaced the `if (auto* image = …)` with an early return. > > (Also changed this to use the `dynamicDowncast<HTMLImageElement>(…)` idiom here instead of having separate `is<>/downcast<>` calls). Even though I didn't say anything, I was hoping you would consider that. Making Chris Dumez’s day.
Wenson Hsieh
Comment 7 2022-02-15 18:25:56 PST
Created attachment 452121 [details] For landing
EWS
Comment 8 2022-02-16 01:21:09 PST
Committed r289882 (247320@main): <https://commits.webkit.org/247320@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452121 [details].
Note You need to log in before you can comment on or make changes to this bug.