RESOLVED FIXED 236842
[Live Text] Add a mechanism to inject images into image overlays
https://bugs.webkit.org/show_bug.cgi?id=236842
Summary [Live Text] Add a mechanism to inject images into image overlays
Wenson Hsieh
Reported 2022-02-18 09:23:18 PST
.
Attachments
For EWS (24.70 KB, patch)
2022-02-18 10:06 PST, Wenson Hsieh
ews-feeder: commit-queue-
Fix watchOS build (24.72 KB, patch)
2022-02-18 10:11 PST, Wenson Hsieh
ews-feeder: commit-queue-
Fix Big Sur build (24.63 KB, patch)
2022-02-18 10:18 PST, Wenson Hsieh
ews-feeder: commit-queue-
Fix non-internal iOS build (24.65 KB, patch)
2022-02-18 10:35 PST, Wenson Hsieh
ews-feeder: commit-queue-
Fix watchOS build (again) (24.92 KB, patch)
2022-02-18 10:51 PST, Wenson Hsieh
no flags
Patch for landing (25.02 KB, patch)
2022-02-18 13:00 PST, Wenson Hsieh
no flags
Patch for landing (26.42 KB, patch)
2022-02-18 13:44 PST, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2022-02-18 10:06:54 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 2 2022-02-18 10:11:47 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 3 2022-02-18 10:18:48 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 4 2022-02-18 10:35:04 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 5 2022-02-18 10:51:18 PST
Created attachment 452545 [details] Fix watchOS build (again)
Aditya Keerthi
Comment 6 2022-02-18 12:18:01 PST
Comment on attachment 452545 [details] Fix watchOS build (again) View in context: https://bugs.webkit.org/attachment.cgi?id=452545&action=review > Source/WebCore/dom/ImageOverlay.cpp:227 > +static void installStyleSheet(ShadowRoot& shadowRoot) Consider renaming to `installImageOverlayStyleSheet`. > Source/WebCore/dom/ImageOverlay.cpp:679 > + RefPtr imageOverlayRoot = dynamicDowncast<HTMLDivElement>(static_cast<TreeScope&>(shadowRoot.get()).getElementById(imageOverlayElementIdentifier())); Is the static cast to `TreeScope` necessary? > Source/WebCore/dom/ImageOverlay.h:28 > +#include "FloatRect.h" Can this be forward declared?
Wenson Hsieh
Comment 7 2022-02-18 12:47:48 PST
Comment on attachment 452545 [details] Fix watchOS build (again) View in context: https://bugs.webkit.org/attachment.cgi?id=452545&action=review Thanks for the review! >> Source/WebCore/dom/ImageOverlay.cpp:227 >> +static void installStyleSheet(ShadowRoot& shadowRoot) > > Consider renaming to `installImageOverlayStyleSheet`. Makes sense! Renamed. >> Source/WebCore/dom/ImageOverlay.cpp:679 >> + RefPtr imageOverlayRoot = dynamicDowncast<HTMLDivElement>(static_cast<TreeScope&>(shadowRoot.get()).getElementById(imageOverlayElementIdentifier())); > > Is the static cast to `TreeScope` necessary? That's a good question…the issue is that `getElementById(const AtomString&)` exists on both TreeScope and DocumentFragment, so the compiler doesn't know which one to pick :/ I tried to work around this by initializing a String and using the `const String&` version, but that didn't seem to alleviate the issue from above. I think I'll keep it as is (though, maybe there's a cleaner way to avoid this?) >> Source/WebCore/dom/ImageOverlay.h:28 >> +#include "FloatRect.h" > > Can this be forward declared? Good catch — fixed!
Wenson Hsieh
Comment 8 2022-02-18 13:00:43 PST
Created attachment 452567 [details] Patch for landing
Aditya Keerthi
Comment 9 2022-02-18 13:19:56 PST
(In reply to Wenson Hsieh from comment #7) > Comment on attachment 452545 [details] > Fix watchOS build (again) > > View in context: > https://bugs.webkit.org/attachment.cgi?id=452545&action=review > > Thanks for the review! > > >> Source/WebCore/dom/ImageOverlay.cpp:227 > >> +static void installStyleSheet(ShadowRoot& shadowRoot) > > > > Consider renaming to `installImageOverlayStyleSheet`. > > Makes sense! Renamed. > > >> Source/WebCore/dom/ImageOverlay.cpp:679 > >> + RefPtr imageOverlayRoot = dynamicDowncast<HTMLDivElement>(static_cast<TreeScope&>(shadowRoot.get()).getElementById(imageOverlayElementIdentifier())); > > > > Is the static cast to `TreeScope` necessary? > > That's a good question…the issue is that `getElementById(const AtomString&)` > exists on both TreeScope and DocumentFragment, so the compiler doesn't know > which one to pick :/ > > I tried to work around this by initializing a String and using the `const > String&` version, but that didn't seem to alleviate the issue from above. I > think I'll keep it as is (though, maybe there's a cleaner way to avoid this?) I think we can solve this by adding `using TreeScope::getElementById;` in `ShadowRoot.h`. Note that the `DocumentFragment` implementation already calls into the `TreeScope` implementation for shadow roots. > >> Source/WebCore/dom/ImageOverlay.h:28 > >> +#include "FloatRect.h" > > > > Can this be forward declared? > > Good catch — fixed!
Wenson Hsieh
Comment 10 2022-02-18 13:39:16 PST
Comment on attachment 452545 [details] Fix watchOS build (again) View in context: https://bugs.webkit.org/attachment.cgi?id=452545&action=review >>>> Source/WebCore/dom/ImageOverlay.cpp:227 >>>> +static void installStyleSheet(ShadowRoot& shadowRoot) >>> >>> Consider renaming to `installImageOverlayStyleSheet`. >> >> Makes sense! Renamed. > > I think we can solve this by adding `using TreeScope::getElementById;` in `ShadowRoot.h`. > > Note that the `DocumentFragment` implementation already calls into the `TreeScope` implementation for shadow roots. Thanks! That works — and it also looks like we do something similar already for `rootNode()` on ShadowRoot, so there's precedent. I'll add that, and replace all the static_casts to TreeScope here.
Wenson Hsieh
Comment 11 2022-02-18 13:44:41 PST
Created attachment 452577 [details] Patch for landing
EWS
Comment 12 2022-02-18 15:51:49 PST
Committed r290178 (247508@main): <https://commits.webkit.org/247508@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452577 [details].
Radar WebKit Bug Importer
Comment 13 2022-02-18 15:52:23 PST
Note You need to log in before you can comment on or make changes to this bug.