| Summary: | Add scaffolding to request image extraction after a delay when hovering over images | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Wenson Hsieh <wenson_hsieh> | ||||||
| Component: | Platform | Assignee: | Wenson Hsieh <wenson_hsieh> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | hi, thorton, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Attachments: |
|
||||||||
|
Description
Wenson Hsieh
2021-02-01 14:00:24 PST
Created attachment 418930 [details]
Patch
Comment on attachment 418930 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418930&action=review > Source/WebKit/WebProcess/WebPage/WebPage.cpp:7141 > + m_elementsWithExtractedImages.add(element); When are items removed (other than page navigation)? What would happen if I hover over the same element twice? (In reply to Devin Rousso from comment #2) > Comment on attachment 418930 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=418930&action=review > > > Source/WebKit/WebProcess/WebPage/WebPage.cpp:7141 > > + m_elementsWithExtractedImages.add(element); > > When are items removed (other than page navigation)? What would happen if I > hover over the same element twice? This is answered in the ChangeLog (essentially, we won't attempt to re-request image extraction when hovering over an element again). Comment on attachment 418930 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418930&action=review r=me > Source/WebCore/page/EventHandler.cpp:1884 > + if (m_imageExtractionTimer.isActive()) > + m_imageExtractionTimer.restart(); As we discussed offline, we should probably not start the timer for synthetic mouse events (such as on iOS). > Source/WebCore/page/EventHandler.cpp:2515 > + if (targetElement && is<RenderImage>(targetElement->renderer())) NIT: i usually prefer to use member variables instead of parameters once the parameter is assigned to the member variable. >>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:7141 >>> + m_elementsWithExtractedImages.add(element); >> >> When are items removed (other than page navigation)? What would happen if I hover over the same element twice? > > This is answered in the ChangeLog (essentially, we won't attempt to re-request image extraction when hovering over an element again). My apologies I totally missed that 😅 Comment on attachment 418930 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418930&action=review Thanks for the review! >> Source/WebCore/page/EventHandler.cpp:1884 >> + m_imageExtractionTimer.restart(); > > As we discussed offline, we should probably not start the timer for synthetic mouse events (such as on iOS). 👍🏻 Will guard the two timer activations with checks for `syntheticClickType() == NoTap`. >> Source/WebCore/page/EventHandler.cpp:2515 >> + if (targetElement && is<RenderImage>(targetElement->renderer())) > > NIT: i usually prefer to use member variables instead of parameters once the parameter is assigned to the member variable. Sounds good — changed to check `m_elementUnderMouse` instead. Created attachment 419043 [details]
Patch
Committed r272236: <https://trac.webkit.org/changeset/272236> All reviewed patches have been landed. Closing bug and clearing flags on attachment 419043 [details]. |