Bug 174376

Summary: REGRESSION(r219045): The <body> element does not get repainted when its background image finishes decoding
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: ImagesAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, cdumez, commit-queue, darin, dbates, japhet, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

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"