Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: Source/core/testing/Internals.cpp

Issue 1120963003: Implements getImageAnimationPolicy() at ImageLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update API name. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698