Index: Source/core/platform/graphics/ImageSource.cpp |
diff --git a/Source/core/platform/graphics/ImageSource.cpp b/Source/core/platform/graphics/ImageSource.cpp |
index c6395a09f0828fd316edda4dbe8f22a2e9d57c88..4a43d3c685f3d648a7d03c64f24a8af8a90be33a 100644 |
--- a/Source/core/platform/graphics/ImageSource.cpp |
+++ b/Source/core/platform/graphics/ImageSource.cpp |
@@ -156,20 +156,16 @@ PassNativeImagePtr ImageSource::createFrameAtIndex(size_t index) |
return buffer->asNewNativeImage(); |
} |
-float ImageSource::frameDurationAtIndex(size_t index) |
+float ImageSource::frameDurationAtIndex(size_t index) const |
{ |
if (!m_decoder) |
return 0; |
- ImageFrame* buffer = m_decoder->frameBufferAtIndex(index); |
- if (!buffer || buffer->status() == ImageFrame::FrameEmpty) |
- return 0; |
- |
// Many annoying ads specify a 0 duration to make an image flash as quickly as possible. |
// We follow Firefox's behavior and use a duration of 100 ms for any frames that specify |
// a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082> |
// for more information. |
- const float duration = buffer->duration() / 1000.0f; |
+ const float duration = m_decoder->frameDurationAtIndex(index) / 1000.0f; |
if (duration < 0.011f) |
return 0.100f; |
return duration; |
@@ -180,20 +176,14 @@ ImageOrientation ImageSource::orientationAtIndex(size_t) const |
return m_decoder ? m_decoder->orientation() : DefaultImageOrientation; |
} |
-bool ImageSource::frameHasAlphaAtIndex(size_t index) |
+bool ImageSource::frameHasAlphaAtIndex(size_t index) const |
{ |
- if (!m_decoder) |
- return true; |
- return m_decoder->frameHasAlphaAtIndex(index); |
+ return !m_decoder || m_decoder->frameHasAlphaAtIndex(index); |
} |
-bool ImageSource::frameIsCompleteAtIndex(size_t index) |
+bool ImageSource::frameIsCompleteAtIndex(size_t index) const |
{ |
- if (!m_decoder) |
- return false; |
- |
- ImageFrame* buffer = m_decoder->frameBufferAtIndex(index); |
- return buffer && buffer->status() == ImageFrame::FrameComplete; |
+ return m_decoder && m_decoder->frameIsCompleteAtIndex(index); |
} |
unsigned ImageSource::frameBytesAtIndex(size_t index) const |