Bug 176204 - Implement the attribute HTMLImageElement.async
Summary: Implement the attribute HTMLImageElement.async
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL: https://github.com/whatwg/html/issues...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-08-31 17:30 PDT by Said Abou-Hallawa
Modified: 2017-11-08 10:51 PST (History)
5 users (show)

See Also:


Attachments
Patch (6.60 KB, patch)
2017-08-31 17:35 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (5.26 KB, patch)
2017-09-08 16:04 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2017-08-31 17:30:07 PDT
This will force async decoding for this image all the times regardless weather the image is large or not. Async decoding will be forced even if it causes the image to flicker momentarily.
Comment 1 Said Abou-Hallawa 2017-08-31 17:35:59 PDT
Created attachment 319554 [details]
Patch
Comment 2 Said Abou-Hallawa 2017-08-31 17:39:34 PDT
<rdar://problem/34107641>
Comment 3 Darin Adler 2017-09-03 17:24:38 PDT
Comment on attachment 319554 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=319554&action=review

> Source/WebCore/html/HTMLImageElement.cpp:227
> -    } else {
> +    } else if (name == asyncAttr)
> +        m_async = !value.isNull();

This code isn’t needed. There is no need to store a boolean in a data member just so we can ask the question of an HTMLImageElement. We can find out the correct value at any time by calling hasAttribute(asyncAttr).

> Source/WebCore/html/HTMLImageElement.h:82
> +    bool async() const { return m_async; }

This function isn’t needed. [Reflect] can answer this question without adding a function, and the one caller can just call hasAttribute(asyncAttr).

> Source/WebCore/html/HTMLImageElement.h:146
> +    bool m_async { false };

This data member isn’t needed.

> Source/WebCore/rendering/RenderBoxModelObject.cpp:330
> +    if (is<HTMLImageElement>(element()) && downcast<HTMLImageElement>(*element()).async())

Here we can just write:

    if (is<HTMLImageElement>(element()) && element()->hasAttribute(asyncAttr))
Comment 4 Said Abou-Hallawa 2017-09-08 16:04:53 PDT
Created attachment 320312 [details]
Patch
Comment 5 WebKit Commit Bot 2017-09-08 17:10:48 PDT
Comment on attachment 320312 [details]
Patch

Clearing flags on attachment: 320312

Committed r221803: <http://trac.webkit.org/changeset/221803>
Comment 6 WebKit Commit Bot 2017-09-08 17:10:49 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Simon Fraser (smfr) 2017-11-08 10:51:22 PST
Followup to support the on/off syntax: 179432