Bug 174376 - REGRESSION(r219045): The <body> element does not get repainted when its background image finishes decoding
Summary: REGRESSION(r219045): The <body> element does not get repainted when its backg...
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:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-11 11:21 PDT by Said Abou-Hallawa
Modified: 2017-07-11 21:27 PDT (History)
9 users (show)

See Also:


Attachments
Patch (5.79 KB, patch)
2017-07-11 11:27 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (6.03 KB, patch)
2017-07-11 12:39 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (5.98 KB, patch)
2017-07-11 13:52 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-07-11 11:21:06 PDT
If the background image of the <body> elements is a large image, it is going to be asynchronously decoded. The problem in this case is, this background image is drawn by the renderer of the <html> element. When requesting the image for decoding, so we add the <html> element renderer to the CachedImage::m_pendingImageDrawingClients even though it's not one of its clients. When the image finishes decoding and CachedImage::imageFrameAvailable() is called, we don't find the renderer of the <html> element in m_clients. So we skip repainting the renderer of the <body> element.
Comment 1 Said Abou-Hallawa 2017-07-11 11:27:56 PDT
Created attachment 315134 [details]
Patch
Comment 2 Said Abou-Hallawa 2017-07-11 11:30:25 PDT
<rdar://problem/33219746>
Comment 3 Said Abou-Hallawa 2017-07-11 11:31:29 PDT
An example of this is the background image in http://browserbench.org/JetStream/
Comment 4 Simon Fraser (smfr) 2017-07-11 11:46:57 PDT
Comment on attachment 315134 [details]
Patch

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

> Source/WebCore/loader/cache/CachedImage.cpp:151
> +        // The <html> element draws the background image of the <body> element. The <body>
> +        // element is a client to this CachedImage but the <html> element is not. In this
> +        // case add all the CachedImage's clients and cancel the repaint optimization we
> +        // do in CachedImage::imageFrameAvailable().

This comment isn't accurate. The <body> background only propagates to the root if the <html> does not have its own background specified. See RenderView::rendererForRootBackground() and code in RenderBox::repaintLayerRectsForImage, and elsewhere.
Comment 5 Said Abou-Hallawa 2017-07-11 12:39:59 PDT
Created attachment 315144 [details]
Patch
Comment 6 Simon Fraser (smfr) 2017-07-11 12:58:13 PDT
Comment on attachment 315144 [details]
Patch

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

> Source/WebCore/loader/cache/CachedImage.cpp:154
> +        CachedResourceClientWalker<CachedImageClient> w(m_clients);

w -> walker

> Source/WebCore/loader/cache/CachedImage.cpp:155
> +        while (CachedImageClient* c = w.next())

while (auto* client = walker.next())
Comment 7 Said Abou-Hallawa 2017-07-11 13:52:49 PDT
Created attachment 315161 [details]
Patch
Comment 8 WebKit Commit Bot 2017-07-11 14:33:22 PDT
Comment on attachment 315161 [details]
Patch

Clearing flags on attachment: 315161

Committed r219364: <http://trac.webkit.org/changeset/219364>
Comment 9 WebKit Commit Bot 2017-07-11 14:33:24 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Darin Adler 2017-07-11 21:27:00 PDT
Comment on attachment 315161 [details]
Patch

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

> Source/WebCore/loader/cache/CachedImage.cpp:148
> +        // If the <html> element does not have its own background sepecfied, painting the root box

"sepecfied"