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

Side by Side Diff: Source/core/svg/graphics/SVGImage.cpp

Issue 1304093006: Add a new API for testing animated images (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanup tests 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 389
390 bool SVGImage::hasAnimations() const 390 bool SVGImage::hasAnimations() const
391 { 391 {
392 SVGSVGElement* rootElement = svgRootElement(m_page.get()); 392 SVGSVGElement* rootElement = svgRootElement(m_page.get());
393 if (!rootElement) 393 if (!rootElement)
394 return false; 394 return false;
395 return rootElement->timeContainer()->hasAnimations() || toLocalFrame(m_page- >mainFrame())->document()->timeline().hasPendingUpdates(); 395 return rootElement->timeContainer()->hasAnimations() || toLocalFrame(m_page- >mainFrame())->document()->timeline().hasPendingUpdates();
396 } 396 }
397 397
398 void SVGImage::advanceAnimationForTesting()
399 {
400 if (SVGSVGElement* rootElement = svgRootElement(m_page.get())) {
401 rootElement->timeContainer()->advanceFrameForTesting();
402
403 // The following triggers animation updates which can issue a new draw
404 // but will not perminately change the animation timeline.
fs 2015/09/08 14:50:57 s/perminately/permanently/ ?
pdr. 2015/09/08 22:50:37 Nice catch. Fixed.
405 // TODO(pdr): Actually advance the document timeline so CSS animations
fs 2015/09/08 14:50:57 Doing this would also "advance" the SMILTimeContai
406 // can be properly tested.
407 rootElement->document().page()->animator().serviceScriptedAnimations(roo tElement->getCurrentTime());
408 imageObserver()->animationAdvanced(this);
409 }
410 }
411
398 void SVGImage::updateUseCounters(Document& document) const 412 void SVGImage::updateUseCounters(Document& document) const
399 { 413 {
400 if (SVGSVGElement* rootElement = svgRootElement(m_page.get())) { 414 if (SVGSVGElement* rootElement = svgRootElement(m_page.get())) {
401 if (rootElement->timeContainer()->hasAnimations()) 415 if (rootElement->timeContainer()->hasAnimations())
402 UseCounter::countDeprecation(document, UseCounter::SVGSMILAnimationI nImageRegardlessOfCache); 416 UseCounter::countDeprecation(document, UseCounter::SVGSMILAnimationI nImageRegardlessOfCache);
403 } 417 }
404 } 418 }
405 419
406 bool SVGImage::dataChanged(bool allDataReceived) 420 bool SVGImage::dataChanged(bool allDataReceived)
407 { 421 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 493
480 return m_page; 494 return m_page;
481 } 495 }
482 496
483 String SVGImage::filenameExtension() const 497 String SVGImage::filenameExtension() const
484 { 498 {
485 return "svg"; 499 return "svg";
486 } 500 }
487 501
488 } 502 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698