Bug 221226 - Add scaffolding to request image extraction after a delay when hovering over images
Summary: Add scaffolding to request image extraction after a delay when hovering over ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-01 14:00 PST by Wenson Hsieh
Modified: 2021-02-02 14:26 PST (History)
3 users (show)

See Also:


Attachments
Patch (20.01 KB, patch)
2021-02-01 14:51 PST, Wenson Hsieh
hi: review+
Details | Formatted Diff | Diff
Patch (20.10 KB, patch)
2021-02-02 11:56 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2021-02-01 14:00:24 PST
More work towards image extraction (accessibility).
Comment 1 Wenson Hsieh 2021-02-01 14:51:28 PST
Created attachment 418930 [details]
Patch
Comment 2 Devin Rousso 2021-02-01 17:51:30 PST
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?
Comment 3 Wenson Hsieh 2021-02-01 18:01:44 PST
(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 4 Devin Rousso 2021-02-02 10:25:05 PST
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 5 Wenson Hsieh 2021-02-02 11:03:40 PST
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.
Comment 6 Wenson Hsieh 2021-02-02 11:56:48 PST
Created attachment 419043 [details]
Patch
Comment 7 EWS 2021-02-02 14:25:39 PST
Committed r272236: <https://trac.webkit.org/changeset/272236>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419043 [details].
Comment 8 Radar WebKit Bug Importer 2021-02-02 14:26:15 PST
<rdar://problem/73898785>