Title: [98930] trunk/Source/WebCore
- Revision
- 98930
- Author
- commit-qu...@webkit.org
- Date
- 2011-10-31 18:06:00 -0700 (Mon, 31 Oct 2011)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=70666
BitmapImage::dataChanged() needs to clear all incomplete frames.
Patch by Peter Kasting <pkast...@google.com> on 2011-10-31
Reviewed by James Robinson.
No tests, as I don't know of a way to send an image to the renderer in
small pieces (with script run between pieces no less).
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::dataChanged):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (98929 => 98930)
--- trunk/Source/WebCore/ChangeLog 2011-11-01 01:01:57 UTC (rev 98929)
+++ trunk/Source/WebCore/ChangeLog 2011-11-01 01:06:00 UTC (rev 98930)
@@ -1,3 +1,16 @@
+2011-10-31 Peter Kasting <pkast...@google.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=70666
+ BitmapImage::dataChanged() needs to clear all incomplete frames.
+
+ Reviewed by James Robinson.
+
+ No tests, as I don't know of a way to send an image to the renderer in
+ small pieces (with script run between pieces no less).
+
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::dataChanged):
+
2011-10-31 Levi Weintraub <le...@chromium.org>
Amend missing uses of LayoutUnits in RenderApplet, Button, and DeprecatedFlexibleBox
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (98929 => 98930)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2011-11-01 01:01:57 UTC (rev 98929)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2011-11-01 01:06:00 UTC (rev 98930)
@@ -195,21 +195,39 @@
bool BitmapImage::dataChanged(bool allDataReceived)
{
- // Because we're modifying the current frame, clear its (now possibly
- // inaccurate) metadata as well.
- destroyMetadataAndNotify((!m_frames.isEmpty() && m_frames[m_frames.size() - 1].clear(true)) ? 1 : 0);
+ // Clear all partially-decoded frames. For most image formats, there is only
+ // one frame, but at least GIF and ICO can have more. With GIFs, the frames
+ // come in order and we ask to decode them in order, waiting to request a
+ // subsequent frame until the prior one is complete. Given that we clear
+ // incomplete frames here, this means there is at most one incomplete frame
+ // (even if we use destroyDecodedData() -- since it doesn't reset the
+ // metadata), and it is after all the complete frames.
+ //
+ // With ICOs, on the other hand, we may ask for arbitrary frames at
+ // different times (e.g. because we're displaying a higher-resolution image
+ // in the content area and using a lower-resolution one for the favicon),
+ // and the frames aren't even guaranteed to appear in the file in the same
+ // order as in the directory, so an arbitrary number of the frames might be
+ // incomplete (if we ask for frames for which we've not yet reached the
+ // start of the frame data), and any or none of them might be the particular
+ // frame affected by appending new data here. Thus we have to clear all the
+ // incomplete frames to be safe.
+ int framesCleared = 0;
+ for (size_t i = 0; i < m_frames.size(); ++i) {
+ // NOTE: Don't call frameIsCompleteAtIndex() here, that will try to
+ // decode any uncached (i.e. never-decoded or
+ // cleared-on-a-previous-pass) frames!
+ if (m_frames[i].m_haveMetadata && !m_frames[i].m_isComplete)
+ framesCleared += (m_frames[i].clear(true) ? 1 : 0);
+ }
+ destroyMetadataAndNotify(framesCleared);
// Feed all the data we've seen so far to the image decoder.
m_allDataReceived = allDataReceived;
m_source.setData(data(), allDataReceived);
- // Clear the frame count.
m_haveFrameCount = false;
-
m_hasUniformFrameSize = true;
-
- // Image properties will not be available until the first frame of the file
- // reaches kCGImageStatusIncomplete.
return isSizeAvailable();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes