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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 506 |
507 SVGElement* SVGSMILElement::targetElement() | 507 SVGElement* SVGSMILElement::targetElement() |
508 { | 508 { |
509 if (m_targetElement) | 509 if (m_targetElement) |
510 return m_targetElement; | 510 return m_targetElement; |
511 | 511 |
512 String href = xlinkHref(); | 512 String href = xlinkHref(); |
513 ContainerNode* target = href.isEmpty() ? parentNode() : SVGURIReference::tar
getElementFromIRIString(href, document()); | 513 ContainerNode* target = href.isEmpty() ? parentNode() : SVGURIReference::tar
getElementFromIRIString(href, document()); |
514 if (!target || !target->isSVGElement()) | 514 if (!target || !target->isSVGElement()) |
515 return 0; | 515 return 0; |
516 | 516 |
517 m_targetElement = static_cast<SVGElement*>(target); | 517 m_targetElement = static_cast<SVGElement*>(target); |
518 document()->accessSVGExtensions()->addAnimationElementToTarget(this, m_targe
tElement); | 518 document()->accessSVGExtensions()->addAnimationElementToTarget(this, m_targe
tElement); |
| 519 |
| 520 targetElementDidChange(m_targetElement); |
| 521 |
519 return m_targetElement; | 522 return m_targetElement; |
520 } | 523 } |
521 | 524 |
522 SMILTime SVGSMILElement::elapsed() const | 525 void SVGSMILElement::resetTargetElement() |
| 526 { |
| 527 m_targetElement = 0; |
| 528 |
| 529 // Force the animation to recompute values that are only calculated when an
animation becomes active. |
| 530 // Failing to do this means that a target reset and change during active ani
mation may result in |
| 531 // invalid state. |
| 532 m_activeState = Inactive; |
| 533 |
| 534 targetElementDidChange(0); |
| 535 } |
| 536 |
| 537 SMILTime SVGSMILElement::elapsed() const |
523 { | 538 { |
524 return m_timeContainer ? m_timeContainer->elapsed() : 0; | 539 return m_timeContainer ? m_timeContainer->elapsed() : 0; |
525 } | 540 } |
526 | 541 |
527 bool SVGSMILElement::isInactive() const | 542 bool SVGSMILElement::isInactive() const |
528 { | 543 { |
529 return m_activeState == Inactive; | 544 return m_activeState == Inactive; |
530 } | 545 } |
531 | 546 |
532 bool SVGSMILElement::isFrozen() const | 547 bool SVGSMILElement::isFrozen() const |
533 { | 548 { |
534 return m_activeState == Frozen; | 549 return m_activeState == Frozen; |
535 } | 550 } |
536 | 551 |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 | 1053 |
1039 void SVGSMILElement::beginByLinkActivation() | 1054 void SVGSMILElement::beginByLinkActivation() |
1040 { | 1055 { |
1041 SMILTime elapsed = this->elapsed(); | 1056 SMILTime elapsed = this->elapsed(); |
1042 addBeginTime(elapsed, elapsed); | 1057 addBeginTime(elapsed, elapsed); |
1043 } | 1058 } |
1044 | 1059 |
1045 } | 1060 } |
1046 | 1061 |
1047 #endif | 1062 #endif |
OLD | NEW |