Title: [150340] trunk/Source/WebCore
Revision
150340
Author
[email protected]
Date
2013-05-18 12:09:07 -0700 (Sat, 18 May 2013)

Log Message

Garbage on page background while http://canberraballoons.com.au is loading
https://bugs.webkit.org/show_bug.cgi?id=116384
<rdar://problem/13930328>

Reviewed by Dan Bernstein.

This page loads a large JPEG image as the body background.
ImageSource::frameHasAlphaAtIndex() always claims that JPEG images
are opaque, but this isn't true if the frame is only partially loaded.
However, this would cause FillLayer::hasOpaqueImage() to report that the
background image is opaque, so we'd skip painting the background color.
Unpainted content in an opaque layer results in garbage.

Fix by having ImageSource::frameHasAlphaAtIndex() always return true
for frames that are not complete. When the image load completes, we
recompute metadata and correctly determine that the frame is opaque.

* platform/graphics/cg/ImageSourceCG.cpp:
(WebCore::ImageSource::frameHasAlphaAtIndex):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150339 => 150340)


--- trunk/Source/WebCore/ChangeLog	2013-05-18 16:06:53 UTC (rev 150339)
+++ trunk/Source/WebCore/ChangeLog	2013-05-18 19:09:07 UTC (rev 150340)
@@ -1,3 +1,25 @@
+2013-05-17  Simon Fraser  <[email protected]>
+
+        Garbage on page background while http://canberraballoons.com.au is loading
+        https://bugs.webkit.org/show_bug.cgi?id=116384
+        <rdar://problem/13930328>
+
+        Reviewed by Dan Bernstein.
+
+        This page loads a large JPEG image as the body background.
+        ImageSource::frameHasAlphaAtIndex() always claims that JPEG images
+        are opaque, but this isn't true if the frame is only partially loaded.
+        However, this would cause FillLayer::hasOpaqueImage() to report that the
+        background image is opaque, so we'd skip painting the background color.
+        Unpainted content in an opaque layer results in garbage.
+        
+        Fix by having ImageSource::frameHasAlphaAtIndex() always return true
+        for frames that are not complete. When the image load completes, we
+        recompute metadata and correctly determine that the frame is opaque.
+
+        * platform/graphics/cg/ImageSourceCG.cpp:
+        (WebCore::ImageSource::frameHasAlphaAtIndex):
+
 2013-05-18  Timothy Hatcher  <[email protected]>
 
         Simplify EventLoop::cycle() on Mac.

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp (150339 => 150340)


--- trunk/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp	2013-05-18 16:06:53 UTC (rev 150339)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp	2013-05-18 19:09:07 UTC (rev 150340)
@@ -361,11 +361,14 @@
     return duration;
 }
 
-bool ImageSource::frameHasAlphaAtIndex(size_t)
+bool ImageSource::frameHasAlphaAtIndex(size_t index)
 {
     if (!m_decoder)
-        return false;
+        return false; // FIXME: why doesn't this return true?
 
+    if (!frameIsCompleteAtIndex(index))
+        return true;
+
     CFStringRef imageType = CGImageSourceGetType(m_decoder);
 
     // Return false if there is no image type or the image type is JPEG, because
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to