| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2014 Google, Inc. | 5 * Copyright (C) 2014 Google, Inc. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 return new LayoutSVGViewportContainer(this); | 547 return new LayoutSVGViewportContainer(this); |
| 548 } | 548 } |
| 549 | 549 |
| 550 Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode* ro
otParent) | 550 Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode* ro
otParent) |
| 551 { | 551 { |
| 552 if (rootParent->inDocument()) { | 552 if (rootParent->inDocument()) { |
| 553 UseCounter::count(document(), UseCounter::SVGSVGElementInDocument); | 553 UseCounter::count(document(), UseCounter::SVGSVGElementInDocument); |
| 554 if (rootParent->document().isXMLDocument()) | 554 if (rootParent->document().isXMLDocument()) |
| 555 UseCounter::count(document(), UseCounter::SVGSVGElementInXMLDocument
); | 555 UseCounter::count(document(), UseCounter::SVGSVGElementInXMLDocument
); |
| 556 | 556 |
| 557 document().accessSVGExtensions().addTimeContainer(this); | 557 if (RuntimeEnabledFeatures::smilEnabled()) { |
| 558 document().accessSVGExtensions().addTimeContainer(this); |
| 558 | 559 |
| 559 // Animations are started at the end of document parsing and after firin
g the load event, | 560 // Animations are started at the end of document parsing and after f
iring the load event, |
| 560 // but if we miss that train (deferred programmatic element insertion fo
r example) we need | 561 // but if we miss that train (deferred programmatic element insertio
n for example) we need |
| 561 // to initialize the time container here. | 562 // to initialize the time container here. |
| 562 if (!document().parsing() && !document().processingLoadEvent() && docume
nt().loadEventFinished() && !timeContainer()->isStarted()) | 563 if (!document().parsing() && !document().processingLoadEvent() && do
cument().loadEventFinished() && !timeContainer()->isStarted()) |
| 563 timeContainer()->begin(); | 564 timeContainer()->begin(); |
| 565 } |
| 564 } | 566 } |
| 565 return SVGGraphicsElement::insertedInto(rootParent); | 567 return SVGGraphicsElement::insertedInto(rootParent); |
| 566 } | 568 } |
| 567 | 569 |
| 568 void SVGSVGElement::removedFrom(ContainerNode* rootParent) | 570 void SVGSVGElement::removedFrom(ContainerNode* rootParent) |
| 569 { | 571 { |
| 570 if (rootParent->inDocument()) { | 572 if (rootParent->inDocument()) { |
| 571 SVGDocumentExtensions& svgExtensions = document().accessSVGExtensions(); | 573 SVGDocumentExtensions& svgExtensions = document().accessSVGExtensions(); |
| 572 svgExtensions.removeTimeContainer(this); | 574 svgExtensions.removeTimeContainer(this); |
| 573 svgExtensions.removeSVGRootWithRelativeLengthDescendents(this); | 575 svgExtensions.removeSVGRootWithRelativeLengthDescendents(this); |
| 574 } | 576 } |
| 575 | 577 |
| 576 SVGGraphicsElement::removedFrom(rootParent); | 578 SVGGraphicsElement::removedFrom(rootParent); |
| 577 } | 579 } |
| 578 | 580 |
| 579 void SVGSVGElement::pauseAnimations() | 581 void SVGSVGElement::pauseAnimations() |
| 580 { | 582 { |
| 583 ASSERT(RuntimeEnabledFeatures::smilEnabled()); |
| 581 if (!m_timeContainer->isPaused()) | 584 if (!m_timeContainer->isPaused()) |
| 582 m_timeContainer->pause(); | 585 m_timeContainer->pause(); |
| 583 } | 586 } |
| 584 | 587 |
| 585 void SVGSVGElement::unpauseAnimations() | 588 void SVGSVGElement::unpauseAnimations() |
| 586 { | 589 { |
| 590 ASSERT(RuntimeEnabledFeatures::smilEnabled()); |
| 587 if (m_timeContainer->isPaused()) | 591 if (m_timeContainer->isPaused()) |
| 588 m_timeContainer->resume(); | 592 m_timeContainer->resume(); |
| 589 } | 593 } |
| 590 | 594 |
| 591 bool SVGSVGElement::animationsPaused() const | 595 bool SVGSVGElement::animationsPaused() const |
| 592 { | 596 { |
| 597 ASSERT(RuntimeEnabledFeatures::smilEnabled()); |
| 593 return m_timeContainer->isPaused(); | 598 return m_timeContainer->isPaused(); |
| 594 } | 599 } |
| 595 | 600 |
| 596 float SVGSVGElement::getCurrentTime() const | 601 float SVGSVGElement::getCurrentTime() const |
| 597 { | 602 { |
| 603 ASSERT(RuntimeEnabledFeatures::smilEnabled()); |
| 598 return narrowPrecisionToFloat(m_timeContainer->elapsed().value()); | 604 return narrowPrecisionToFloat(m_timeContainer->elapsed().value()); |
| 599 } | 605 } |
| 600 | 606 |
| 601 void SVGSVGElement::setCurrentTime(float seconds) | 607 void SVGSVGElement::setCurrentTime(float seconds) |
| 602 { | 608 { |
| 609 ASSERT(RuntimeEnabledFeatures::smilEnabled()); |
| 603 ASSERT(std::isfinite(seconds)); | 610 ASSERT(std::isfinite(seconds)); |
| 604 seconds = max(seconds, 0.0f); | 611 seconds = max(seconds, 0.0f); |
| 605 m_timeContainer->setElapsed(seconds); | 612 m_timeContainer->setElapsed(seconds); |
| 606 } | 613 } |
| 607 | 614 |
| 608 bool SVGSVGElement::selfHasRelativeLengths() const | 615 bool SVGSVGElement::selfHasRelativeLengths() const |
| 609 { | 616 { |
| 610 return m_x->currentValue()->isRelative() | 617 return m_x->currentValue()->isRelative() |
| 611 || m_y->currentValue()->isRelative() | 618 || m_y->currentValue()->isRelative() |
| 612 || m_width->currentValue()->isRelative() | 619 || m_width->currentValue()->isRelative() |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 visitor->trace(m_width); | 788 visitor->trace(m_width); |
| 782 visitor->trace(m_height); | 789 visitor->trace(m_height); |
| 783 visitor->trace(m_translation); | 790 visitor->trace(m_translation); |
| 784 visitor->trace(m_timeContainer); | 791 visitor->trace(m_timeContainer); |
| 785 visitor->trace(m_viewSpec); | 792 visitor->trace(m_viewSpec); |
| 786 SVGGraphicsElement::trace(visitor); | 793 SVGGraphicsElement::trace(visitor); |
| 787 SVGFitToViewBox::trace(visitor); | 794 SVGFitToViewBox::trace(visitor); |
| 788 } | 795 } |
| 789 | 796 |
| 790 } // namespace blink | 797 } // namespace blink |
| OLD | NEW |