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

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

Issue 206033005: Rewind the timeline for SVG-in-<img> when resetAnimation() is called (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 view->paint(context, enclosingIntRect(srcRect)); 276 view->paint(context, enclosingIntRect(srcRect));
277 277
278 if (requiresTransparencyLayer) 278 if (requiresTransparencyLayer)
279 context->endLayer(); 279 context->endLayer();
280 280
281 stateSaver.restore(); 281 stateSaver.restore();
282 282
283 if (imageObserver()) 283 if (imageObserver())
284 imageObserver()->didDraw(this); 284 imageObserver()->didDraw(this);
285
286 startAnimation();
kouhei (in TOK) 2014/03/20 15:27:29 This line took me a while to understand. This call
fs 2014/03/20 17:02:17 Added a comment to that effect.
285 } 287 }
286 288
287 RenderBox* SVGImage::embeddedContentBox() const 289 RenderBox* SVGImage::embeddedContentBox() const
288 { 290 {
289 if (!m_page) 291 if (!m_page)
290 return 0; 292 return 0;
291 LocalFrame* frame = m_page->mainFrame(); 293 LocalFrame* frame = m_page->mainFrame();
292 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ; 294 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ;
293 if (!rootElement) 295 if (!rootElement)
294 return 0; 296 return 0;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), float ValueForLength(intrinsicHeight, 0)); 346 intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), float ValueForLength(intrinsicHeight, 0));
345 } 347 }
346 348
347 // FIXME: support catchUpIfNecessary. 349 // FIXME: support catchUpIfNecessary.
348 void SVGImage::startAnimation(bool /* catchUpIfNecessary */) 350 void SVGImage::startAnimation(bool /* catchUpIfNecessary */)
349 { 351 {
350 if (!m_page) 352 if (!m_page)
351 return; 353 return;
352 LocalFrame* frame = m_page->mainFrame(); 354 LocalFrame* frame = m_page->mainFrame();
353 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ; 355 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ;
354 if (!rootElement) 356 if (!rootElement || !rootElement->animationsPaused())
355 return; 357 return;
356 rootElement->unpauseAnimations(); 358 rootElement->unpauseAnimations();
357 rootElement->setCurrentTime(0);
358 } 359 }
359 360
360 void SVGImage::stopAnimation() 361 void SVGImage::stopAnimation()
361 { 362 {
362 if (!m_page) 363 if (!m_page)
363 return; 364 return;
364 LocalFrame* frame = m_page->mainFrame(); 365 LocalFrame* frame = m_page->mainFrame();
365 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ; 366 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ;
366 if (!rootElement) 367 if (!rootElement)
367 return; 368 return;
368 rootElement->pauseAnimations(); 369 rootElement->pauseAnimations();
369 } 370 }
370 371
371 void SVGImage::resetAnimation() 372 void SVGImage::resetAnimation()
372 { 373 {
373 stopAnimation(); 374 if (!m_page)
375 return;
376 LocalFrame* frame = m_page->mainFrame();
377 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ;
378 if (!rootElement)
379 return;
380 rootElement->pauseAnimations();
381 rootElement->setCurrentTime(0);
374 } 382 }
375 383
376 bool SVGImage::hasAnimations() const 384 bool SVGImage::hasAnimations() const
377 { 385 {
378 if (!m_page) 386 if (!m_page)
379 return false; 387 return false;
380 LocalFrame* frame = m_page->mainFrame(); 388 LocalFrame* frame = m_page->mainFrame();
381 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ; 389 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement() ;
382 if (!rootElement) 390 if (!rootElement)
383 return false; 391 return false;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 438
431 return m_page; 439 return m_page;
432 } 440 }
433 441
434 String SVGImage::filenameExtension() const 442 String SVGImage::filenameExtension() const
435 { 443 {
436 return "svg"; 444 return "svg";
437 } 445 }
438 446
439 } 447 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698