-
commit-queue@webkit.org authored
https://bugs.webkit.org/show_bug.cgi?id=78239 Patch by Sami Kyostila <skyostil@chromium.org> on 2012-03-05 Reviewed by Kenneth Russell. Source/WebCore: While a JPEG image is loading, the area outside the decoded region should be fully transparent. Since currently all JPEG frames are marked as opaque, a renderer respecting this flag will draw the partially loaded image with garbage outside the valid image region. Hence, a partially loaded JPEG image should be marked as having an alpha channel while decoding is in progress. For performance reasons we mark the image opaque after decoding has finished. Graphics corruption caused by this bug was recently observed on Chromium (http://code.google.com/p/chromium/issues/detail?id=113171). A recent Skia change (r3036) changed SkBitmap::extractSubset() to produce a bitmap with the same opaqueness flag as the parent. This meant that the renderer was now seeing an opaque image from the JPEG decoder, and drawing it appropriately resulted in garbage outside the decoded region. Test: http/tests/incremental/partial-jpeg.html * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: (WebCore::JPEGImageDecoder::outputScanlines): (WebCore::JPEGImageDecoder::jpegComplete): LayoutTests: While a JPEG image is being loaded, the parts which have not been decoded yet should show whatever is behind the image. This tests verifies this by displaying a JPEG which never fully completes loading. This is achieved by serving the JPEG from a PHP script that strips the end of image marker (ff d9) from the data. The test image is 32x32 pixels, so compresses to 4x4 JPEG MCU blocks. The expected result is that the final row of MCU blocks (32x4 pixels) never finishes loading due to the missing end of image marker and the indicator div is shown through this area. * http/tests/incremental/partial-jpeg-expected.png: Added. * http/tests/incremental/partial-jpeg-expected.txt: Added. * http/tests/incremental/partial-jpeg.html: Added. * http/tests/incremental/resources/checkerboard.jpg: Added. * http/tests/incremental/resources/partial-jpeg.php: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@109779 268f45cc-cd09-0410-ab3c-d52691b4dbfc
d857257e