Bug 185216 - Hiding then showing an <object> of type image makes the underlaying image disappear
Summary: Hiding then showing an <object> of type image makes the underlaying image dis...
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: 2018-05-02 14:17 PDT by Said Abou-Hallawa
Modified: 2018-05-02 18:18 PDT (History)
11 users (show)

See Also:


Attachments
test case (861 bytes, text/html)
2018-05-02 14:17 PDT, Said Abou-Hallawa
no flags Details
Patch (4.76 KB, patch)
2018-05-02 14:41 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (4.35 KB, patch)
2018-05-02 15:54 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (4.30 KB, patch)
2018-05-02 16:58 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 2018-05-02 14:17:40 PDT
Created attachment 339339 [details]
test case

Open the attached test case.

The test case contains an <object> element of type image. The script hides the <object> then it shows the <object> again.

Result: An outline rectangle is drawn.
Expected: The underlaying image of the <object> element is shown.

The reason for this bug is the following:
-- The ImageLoader and the <object> element stay alive but the RenderImage is destroyed when the element is made hidden. 
-- When the <object> element is shown again, a new RenderImage is created. 
-- ImageLoader::updateFromElement() does not call updateRenderer() or dispatchPendingBeforeLoadEvent() because the image is already loaded i.e. (newImage == oldImage).
-- Therefore we do not set the CachedImage of the RenderImageResource of the RenderImage.
-- When RenderImage::paintReplaced() is called after the image is made visible again, it does not find a CachedImage for its RenderImageResource.
-- So RenderImage::paintReplaced() draws an outline rectangle instead.
Comment 1 Said Abou-Hallawa 2018-05-02 14:18:41 PDT
<rdar://problem/39055630>
Comment 2 Said Abou-Hallawa 2018-05-02 14:41:36 PDT
Created attachment 339343 [details]
Patch
Comment 3 Said Abou-Hallawa 2018-05-02 15:54:54 PDT
Created attachment 339361 [details]
Patch
Comment 4 youenn fablet 2018-05-02 16:11:38 PDT
Comment on attachment 339361 [details]
Patch

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

> Source/WebCore/html/HTMLPlugInImageElement.cpp:235
> +        RenderImageResource& renderImageResource = renderImage.imageResource();

auto&, maybe no need for renderImage variable also.
Comment 5 Said Abou-Hallawa 2018-05-02 16:58:38 PDT
Created attachment 339364 [details]
Patch
Comment 6 WebKit Commit Bot 2018-05-02 18:18:01 PDT
Comment on attachment 339364 [details]
Patch

Clearing flags on attachment: 339364

Committed r231292: <https://trac.webkit.org/changeset/231292>
Comment 7 WebKit Commit Bot 2018-05-02 18:18:02 PDT
All reviewed patches have been landed.  Closing bug.