OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 SVGElement* SVGSMILElement::targetElement() | 492 SVGElement* SVGSMILElement::targetElement() |
493 { | 493 { |
494 if (m_targetElement) | 494 if (m_targetElement) |
495 return m_targetElement; | 495 return m_targetElement; |
496 | 496 |
497 String href = xlinkHref(); | 497 String href = xlinkHref(); |
498 ContainerNode* target = href.isEmpty() ? parentNode() : SVGURIReference::tar
getElementFromIRIString(href, document()); | 498 ContainerNode* target = href.isEmpty() ? parentNode() : SVGURIReference::tar
getElementFromIRIString(href, document()); |
499 if (!target || !target->isSVGElement()) | 499 if (!target || !target->isSVGElement()) |
500 return 0; | 500 return 0; |
501 | 501 |
502 m_targetElement = static_cast<SVGElement*>(target); | 502 m_targetElement = static_cast<SVGElement*>(target); |
503 document()->accessSVGExtensions()->addAnimationElementToTarget(this, m_targe
tElement); | 503 document()->accessSVGExtensions()->addAnimationElementToTarget(this, m_targe
tElement); |
| 504 |
| 505 targetElementDidChange(m_targetElement); |
| 506 |
504 return m_targetElement; | 507 return m_targetElement; |
505 } | 508 } |
506 | 509 |
507 SMILTime SVGSMILElement::elapsed() const | 510 void SVGSMILElement::resetTargetElement() |
| 511 { |
| 512 m_targetElement = 0; |
| 513 |
| 514 // Force the animation to recompute values that are only calculated when an
animation becomes active. |
| 515 // Failing to do this means that a target reset and change during active ani
mation may result in |
| 516 // invalid state. |
| 517 m_activeState = Inactive; |
| 518 |
| 519 targetElementDidChange(0); |
| 520 } |
| 521 |
| 522 SMILTime SVGSMILElement::elapsed() const |
508 { | 523 { |
509 return m_timeContainer ? m_timeContainer->elapsed() : 0; | 524 return m_timeContainer ? m_timeContainer->elapsed() : 0; |
510 } | 525 } |
511 | 526 |
512 bool SVGSMILElement::isInactive() const | 527 bool SVGSMILElement::isInactive() const |
513 { | 528 { |
514 return m_activeState == Inactive; | 529 return m_activeState == Inactive; |
515 } | 530 } |
516 | 531 |
517 bool SVGSMILElement::isFrozen() const | 532 bool SVGSMILElement::isFrozen() const |
518 { | 533 { |
519 return m_activeState == Frozen; | 534 return m_activeState == Frozen; |
520 } | 535 } |
521 | 536 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 | 1032 |
1018 void SVGSMILElement::beginByLinkActivation() | 1033 void SVGSMILElement::beginByLinkActivation() |
1019 { | 1034 { |
1020 SMILTime elapsed = this->elapsed(); | 1035 SMILTime elapsed = this->elapsed(); |
1021 addBeginTime(elapsed, elapsed); | 1036 addBeginTime(elapsed, elapsed); |
1022 } | 1037 } |
1023 | 1038 |
1024 } | 1039 } |
1025 | 1040 |
1026 #endif | 1041 #endif |
OLD | NEW |