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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "core/fetch/MemoryCache.h" 75 #include "core/fetch/MemoryCache.h"
76 #include "core/fetch/ResourceFetcher.h" 76 #include "core/fetch/ResourceFetcher.h"
77 #include "core/frame/EventHandlerRegistry.h" 77 #include "core/frame/EventHandlerRegistry.h"
78 #include "core/frame/FrameConsole.h" 78 #include "core/frame/FrameConsole.h"
79 #include "core/frame/FrameView.h" 79 #include "core/frame/FrameView.h"
80 #include "core/frame/LocalDOMWindow.h" 80 #include "core/frame/LocalDOMWindow.h"
81 #include "core/frame/LocalFrame.h" 81 #include "core/frame/LocalFrame.h"
82 #include "core/frame/Settings.h" 82 #include "core/frame/Settings.h"
83 #include "core/html/HTMLContentElement.h" 83 #include "core/html/HTMLContentElement.h"
84 #include "core/html/HTMLIFrameElement.h" 84 #include "core/html/HTMLIFrameElement.h"
85 #include "core/html/HTMLImageElement.h"
85 #include "core/html/HTMLInputElement.h" 86 #include "core/html/HTMLInputElement.h"
86 #include "core/html/HTMLMediaElement.h" 87 #include "core/html/HTMLMediaElement.h"
87 #include "core/html/HTMLPlugInElement.h" 88 #include "core/html/HTMLPlugInElement.h"
88 #include "core/html/HTMLSelectElement.h" 89 #include "core/html/HTMLSelectElement.h"
89 #include "core/html/HTMLTextAreaElement.h" 90 #include "core/html/HTMLTextAreaElement.h"
90 #include "core/html/canvas/CanvasRenderingContext2D.h" 91 #include "core/html/canvas/CanvasRenderingContext2D.h"
91 #include "core/html/forms/FormController.h" 92 #include "core/html/forms/FormController.h"
92 #include "core/html/shadow/PluginPlaceholderElement.h" 93 #include "core/html/shadow/PluginPlaceholderElement.h"
93 #include "core/html/shadow/ShadowElementNames.h" 94 #include "core/html/shadow/ShadowElementNames.h"
94 #include "core/html/shadow/TextControlInnerElements.h" 95 #include "core/html/shadow/TextControlInnerElements.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 { 415 {
415 if (pauseTime < 0) { 416 if (pauseTime < 0) {
416 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: indexExceedsMinimumBound("pauseTime", pauseTime, 0.0)); 417 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: indexExceedsMinimumBound("pauseTime", pauseTime, 0.0));
417 return; 418 return;
418 } 419 }
419 420
420 frame()->view()->updateLayoutAndStyleForPainting(); 421 frame()->view()->updateLayoutAndStyleForPainting();
421 frame()->document()->timeline().pauseAnimationsForTesting(pauseTime); 422 frame()->document()->timeline().pauseAnimationsForTesting(pauseTime);
422 } 423 }
423 424
425 void Internals::advanceTimeForImage(Element* image, double deltaTimeInSeconds, E xceptionState& exceptionState)
426 {
427 ASSERT(image);
428 if (deltaTimeInSeconds < 0) {
429 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: indexExceedsMinimumBound("deltaTimeInSeconds", deltaTimeInSeconds, 0.0));
430 return;
431 }
432
433 if (!isHTMLImageElement(*image)) {
434 exceptionState.throwDOMException(InvalidAccessError, "The element provid ed is not a image element.");
435 return;
436 }
437
438 ImageResource* resource = toHTMLImageElement(*image).cachedImage();
439 if (!resource || !resource->hasImage()) {
440 exceptionState.throwDOMException(InvalidAccessError, "The image resource is not available.");
441 return;
442 }
443
444 Image* imageData = resource->image();
445 if (!imageData->isBitmapImage()) {
446 exceptionState.throwDOMException(InvalidAccessError, "The image resource is not a BitmapImage type.");
447 return;
448 }
449
450 imageData->advanceTime(deltaTimeInSeconds);
451 }
452
424 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except ionState) const 453 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except ionState) const
425 { 454 {
426 ASSERT(root); 455 ASSERT(root);
427 if (!root->isShadowRoot()) { 456 if (!root->isShadowRoot()) {
428 exceptionState.throwDOMException(InvalidAccessError, "The node argument is not a shadow root."); 457 exceptionState.throwDOMException(InvalidAccessError, "The node argument is not a shadow root.");
429 return false; 458 return false;
430 } 459 }
431 return toShadowRoot(root)->containsShadowElements(); 460 return toShadowRoot(root)->containsShadowElements();
432 } 461 }
433 462
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 2342
2314 ClientRectList* Internals::focusRingRects(Element* element) 2343 ClientRectList* Internals::focusRingRects(Element* element)
2315 { 2344 {
2316 Vector<LayoutRect> rects; 2345 Vector<LayoutRect> rects;
2317 if (element && element->layoutObject()) 2346 if (element && element->layoutObject())
2318 element->layoutObject()->addFocusRingRects(rects, LayoutPoint()); 2347 element->layoutObject()->addFocusRingRects(rects, LayoutPoint());
2319 return ClientRectList::create(rects); 2348 return ClientRectList::create(rects);
2320 } 2349 }
2321 2350
2322 } // namespace blink 2351 } // namespace blink
OLDNEW
« 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