Index: Source/core/testing/Internals.cpp |
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
index 7fbc89d67dfcf5d943216bb5d87024fda3c2792d..33d7de0959972ecace673a31296fdcb5e40c6c9b 100644 |
--- a/Source/core/testing/Internals.cpp |
+++ b/Source/core/testing/Internals.cpp |
@@ -82,6 +82,7 @@ |
#include "core/frame/Settings.h" |
#include "core/html/HTMLContentElement.h" |
#include "core/html/HTMLIFrameElement.h" |
+#include "core/html/HTMLImageElement.h" |
#include "core/html/HTMLInputElement.h" |
#include "core/html/HTMLMediaElement.h" |
#include "core/html/HTMLPlugInElement.h" |
@@ -421,6 +422,34 @@ void Internals::pauseAnimations(double pauseTime, ExceptionState& exceptionState |
frame()->document()->timeline().pauseAnimationsForTesting(pauseTime); |
} |
+void Internals::advanceTimeForImage(Element* image, double deltaTimeInSeconds, ExceptionState& exceptionState) |
+{ |
+ ASSERT(image); |
+ if (deltaTimeInSeconds < 0) { |
+ exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::indexExceedsMinimumBound("deltaTimeInSeconds", deltaTimeInSeconds, 0.0)); |
+ return; |
+ } |
+ |
+ if (!isHTMLImageElement(*image)) { |
+ exceptionState.throwDOMException(InvalidAccessError, "The element provided is not a image element."); |
+ return; |
+ } |
+ |
+ ImageResource* resource = toHTMLImageElement(*image).cachedImage(); |
+ if (!resource || !resource->hasImage()) { |
+ exceptionState.throwDOMException(InvalidAccessError, "The image resource is not available."); |
+ return; |
+ } |
+ |
+ Image* imageData = resource->image(); |
+ if (!imageData->isBitmapImage()) { |
+ exceptionState.throwDOMException(InvalidAccessError, "The image resource is not a BitmapImage type."); |
+ return; |
+ } |
+ |
+ imageData->advanceTime(deltaTimeInSeconds); |
+} |
+ |
bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& exceptionState) const |
{ |
ASSERT(root); |