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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 1304093006: Add a new API for testing animated images (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase harder Created 5 years, 3 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 505
506 Image* imageData = resource->image(); 506 Image* imageData = resource->image();
507 if (!imageData->isBitmapImage()) { 507 if (!imageData->isBitmapImage()) {
508 exceptionState.throwDOMException(InvalidAccessError, "The image resource is not a BitmapImage type."); 508 exceptionState.throwDOMException(InvalidAccessError, "The image resource is not a BitmapImage type.");
509 return; 509 return;
510 } 510 }
511 511
512 imageData->advanceTime(deltaTimeInSeconds); 512 imageData->advanceTime(deltaTimeInSeconds);
513 } 513 }
514 514
515 void Internals::advanceImageAnimation(Element* image, ExceptionState& exceptionS tate)
516 {
517 ASSERT(image);
518
519 ImageResource* resource = nullptr;
520 if (isHTMLImageElement(*image)) {
521 resource = toHTMLImageElement(*image).cachedImage();
522 } else if (isSVGImageElement(*image)) {
523 resource = toSVGImageElement(*image).cachedImage();
524 } else {
525 exceptionState.throwDOMException(InvalidAccessError, "The element provid ed is not a image element.");
526 return;
527 }
528
529 if (!resource || !resource->hasImage()) {
530 exceptionState.throwDOMException(InvalidAccessError, "The image resource is not available.");
531 return;
532 }
533
534 Image* imageData = resource->image();
535 imageData->advanceAnimationForTesting();
536 }
537
515 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except ionState) const 538 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except ionState) const
516 { 539 {
517 ASSERT(root); 540 ASSERT(root);
518 if (!root->isShadowRoot()) { 541 if (!root->isShadowRoot()) {
519 exceptionState.throwDOMException(InvalidAccessError, "The node argument is not a shadow root."); 542 exceptionState.throwDOMException(InvalidAccessError, "The node argument is not a shadow root.");
520 return false; 543 return false;
521 } 544 }
522 return toShadowRoot(root)->containsShadowElements(); 545 return toShadowRoot(root)->containsShadowElements();
523 } 546 }
524 547
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 2515
2493 return animator->setScrollbarsVisibleForTesting(visible); 2516 return animator->setScrollbarsVisibleForTesting(visible);
2494 } 2517 }
2495 2518
2496 void Internals::forceRestrictIFramePermissions() 2519 void Internals::forceRestrictIFramePermissions()
2497 { 2520 {
2498 RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true); 2521 RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true);
2499 } 2522 }
2500 2523
2501 } // namespace blink 2524 } // 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