Remove use of decode() for quickview images.
CL:1345378 changed display of images in quickview to use the decode() API to allow the image to be decoded while the containing content node was detached from the DOM tree in order to avoid visible artifacts during decoding time. The decode() API fails when large image decodes are attempted resulting in nothing being displayed, even when those large images can be viewed from a simple <img src=...> container. Removes the use of decode() and instead, creates an Image object responsible for loading the image and uses the onload handler to reattach the content node to the DOM. Adds an onerror handler that sends an event to the host container in the case of load and/or decode failures. Note, this is in effect creating 2 images - the first is the host node in the content, the second is a temporary 'Image' object that is used to trigger the load/decode and when it's loaded the URL to the object is set on the host image node. That way, the image is already loaded so minimizes flicker when the 'src' is set, and in the error case it doesn't set the 'src' at all. (We call this the Double Image Device:) Bug: 645021, 1043799 Change-Id: Id14e01068c29d7cd373563ba20d2e13d7a4bbfe6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2012368Reviewed-by:Noel Gordon <noel@chromium.org> Commit-Queue: Noel Gordon <noel@chromium.org> Cr-Commit-Position: refs/heads/master@{#734394}
Showing
Please register or sign in to comment