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

Side by Side Diff: Source/core/svg/animation/SVGSMILElement.cpp

Issue 102353003: [SVG] Refactoring the logic to handle eventBase dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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) 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 , m_name(name) 154 , m_name(name)
155 , m_offset(offset) 155 , m_offset(offset)
156 , m_repeat(repeat) 156 , m_repeat(repeat)
157 { 157 {
158 } 158 }
159 159
160 SVGSMILElement::SVGSMILElement(const QualifiedName& tagName, Document& doc) 160 SVGSMILElement::SVGSMILElement(const QualifiedName& tagName, Document& doc)
161 : SVGElement(tagName, doc) 161 : SVGElement(tagName, doc)
162 , m_attributeName(anyQName()) 162 , m_attributeName(anyQName())
163 , m_targetElement(0) 163 , m_targetElement(0)
164 , m_conditionsConnected(false) 164 , m_syncBaseConditionsConnected(false)
165 , m_hasEndEventConditions(false) 165 , m_hasEndEventConditions(false)
166 , m_isWaitingForFirstInterval(true) 166 , m_isWaitingForFirstInterval(true)
167 , m_intervalBegin(SMILTime::unresolved()) 167 , m_intervalBegin(SMILTime::unresolved())
168 , m_intervalEnd(SMILTime::unresolved()) 168 , m_intervalEnd(SMILTime::unresolved())
169 , m_previousIntervalBegin(SMILTime::unresolved()) 169 , m_previousIntervalBegin(SMILTime::unresolved())
170 , m_activeState(Inactive) 170 , m_activeState(Inactive)
171 , m_lastPercent(0) 171 , m_lastPercent(0)
172 , m_lastRepeat(0) 172 , m_lastRepeat(0)
173 , m_nextProgressTime(0) 173 , m_nextProgressTime(0)
174 , m_documentOrderIndex(0) 174 , m_documentOrderIndex(0)
175 , m_cachedDur(invalidCachedTime) 175 , m_cachedDur(invalidCachedTime)
176 , m_cachedRepeatDur(invalidCachedTime) 176 , m_cachedRepeatDur(invalidCachedTime)
177 , m_cachedRepeatCount(invalidCachedTime) 177 , m_cachedRepeatCount(invalidCachedTime)
178 , m_cachedMin(invalidCachedTime) 178 , m_cachedMin(invalidCachedTime)
179 , m_cachedMax(invalidCachedTime) 179 , m_cachedMax(invalidCachedTime)
180 { 180 {
181 resolveFirstInterval(); 181 resolveFirstInterval();
182 } 182 }
183 183
184 SVGSMILElement::~SVGSMILElement() 184 SVGSMILElement::~SVGSMILElement()
185 { 185 {
186 clearResourceReferences(); 186 clearResourceReferences();
187 smilEndEventSender().cancelEvent(this); 187 smilEndEventSender().cancelEvent(this);
188 smilBeginEventSender().cancelEvent(this); 188 smilBeginEventSender().cancelEvent(this);
189 smilRepeatEventSender().cancelEvent(this); 189 smilRepeatEventSender().cancelEvent(this);
190 smilRepeatNEventSender().cancelEvent(this); 190 smilRepeatNEventSender().cancelEvent(this);
191 disconnectConditions(); 191 disconnectSyncBaseConditions();
192 disconnectEventBaseConditions();
192 if (m_timeContainer && m_targetElement && hasValidAttributeName()) 193 if (m_timeContainer && m_targetElement && hasValidAttributeName())
193 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); 194 m_timeContainer->unschedule(this, m_targetElement, m_attributeName);
194 } 195 }
195 196
196 void SVGSMILElement::clearResourceReferences() 197 void SVGSMILElement::clearResourceReferences()
197 { 198 {
198 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); 199 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this);
pdr. 2014/01/07 00:25:28 This will also clear the event base conditions we
pavane 2014/01/07 18:20:58 Done.
199 } 200 }
200 201
201 void SVGSMILElement::buildPendingResource() 202 void SVGSMILElement::buildPendingResource()
202 { 203 {
203 clearResourceReferences(); 204 clearResourceReferences();
204 205
205 if (!inDocument()) { 206 if (!inDocument()) {
206 // Reset the target element if we are no longer in the document. 207 // Reset the target element if we are no longer in the document.
207 setTargetElement(0); 208 setTargetElement(0);
208 return; 209 return;
(...skipping 21 matching lines...) Expand all
230 231
231 if (!id.isEmpty()) { 232 if (!id.isEmpty()) {
232 document().accessSVGExtensions()->addPendingResource(id, this); 233 document().accessSVGExtensions()->addPendingResource(id, this);
233 ASSERT(hasPendingResources()); 234 ASSERT(hasPendingResources());
234 } 235 }
235 } else { 236 } else {
236 // Register us with the target in the dependencies map. Any change of hr efElement 237 // Register us with the target in the dependencies map. Any change of hr efElement
237 // that leads to relayout/repainting now informs us, so we can react to it. 238 // that leads to relayout/repainting now informs us, so we can react to it.
238 document().accessSVGExtensions()->addElementReferencingTarget(this, svgT arget); 239 document().accessSVGExtensions()->addElementReferencingTarget(this, svgT arget);
239 } 240 }
241 connectEventBaseConditions();
240 } 242 }
241 243
242 static inline QualifiedName constructQualifiedName(const SVGElement* svgElement, const AtomicString& attributeName) 244 static inline QualifiedName constructQualifiedName(const SVGElement* svgElement, const AtomicString& attributeName)
243 { 245 {
244 ASSERT(svgElement); 246 ASSERT(svgElement);
245 if (attributeName.isEmpty()) 247 if (attributeName.isEmpty())
246 return anyQName(); 248 return anyQName();
247 if (!attributeName.contains(':')) 249 if (!attributeName.contains(':'))
248 return QualifiedName(nullAtom, attributeName, nullAtom); 250 return QualifiedName(nullAtom, attributeName, nullAtom);
249 251
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 314
313 buildPendingResource(); 315 buildPendingResource();
314 316
315 return InsertionDone; 317 return InsertionDone;
316 } 318 }
317 319
318 void SVGSMILElement::removedFrom(ContainerNode* rootParent) 320 void SVGSMILElement::removedFrom(ContainerNode* rootParent)
319 { 321 {
320 if (rootParent->inDocument()) { 322 if (rootParent->inDocument()) {
321 clearResourceReferences(); 323 clearResourceReferences();
322 disconnectConditions(); 324 disconnectSyncBaseConditions();
325 disconnectEventBaseConditions();
323 setTargetElement(0); 326 setTargetElement(0);
324 setAttributeName(anyQName()); 327 setAttributeName(anyQName());
325 animationAttributeChanged(); 328 animationAttributeChanged();
326 m_timeContainer = 0; 329 m_timeContainer = 0;
327 } 330 }
328 331
329 SVGElement::removedFrom(rootParent); 332 SVGElement::removedFrom(rootParent);
330 } 333 }
331 334
332 bool SVGSMILElement::hasValidAttributeName() 335 bool SVGSMILElement::hasValidAttributeName()
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 supportedAttributes.add(SVGNames::attributeNameAttr); 497 supportedAttributes.add(SVGNames::attributeNameAttr);
495 supportedAttributes.add(XLinkNames::hrefAttr); 498 supportedAttributes.add(XLinkNames::hrefAttr);
496 } 499 }
497 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 500 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
498 } 501 }
499 502
500 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 503 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
501 { 504 {
502 if (name == SVGNames::beginAttr) { 505 if (name == SVGNames::beginAttr) {
503 if (!m_conditions.isEmpty()) { 506 if (!m_conditions.isEmpty()) {
504 disconnectConditions(); 507 disconnectSyncBaseConditions();
pdr. 2014/01/07 00:25:28 Why disconnect sync base but not disconnect event
pavane 2014/01/07 18:20:58 event base functionality is based on adding event
505 m_conditions.clear(); 508 m_conditions.clear();
506 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End); 509 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End);
507 } 510 }
508 parseBeginOrEnd(value.string(), Begin); 511 parseBeginOrEnd(value.string(), Begin);
509 if (inDocument()) 512 if (inDocument())
510 connectConditions(); 513 connectSyncBaseConditions();
511 } else if (name == SVGNames::endAttr) { 514 } else if (name == SVGNames::endAttr) {
512 if (!m_conditions.isEmpty()) { 515 if (!m_conditions.isEmpty()) {
513 disconnectConditions(); 516 disconnectSyncBaseConditions();
514 m_conditions.clear(); 517 m_conditions.clear();
515 parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin); 518 parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin);
516 } 519 }
517 parseBeginOrEnd(value.string(), End); 520 parseBeginOrEnd(value.string(), End);
518 if (inDocument()) 521 if (inDocument())
519 connectConditions(); 522 connectSyncBaseConditions();
520 } else 523 } else
521 SVGElement::parseAttribute(name, value); 524 SVGElement::parseAttribute(name, value);
522 } 525 }
523 526
524 void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName) 527 void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName)
525 { 528 {
526 if (!isSupportedAttribute(attrName)) { 529 if (!isSupportedAttribute(attrName)) {
527 SVGElement::svgAttributeChanged(attrName); 530 SVGElement::svgAttributeChanged(attrName);
528 return; 531 return;
529 } 532 }
(...skipping 23 matching lines...) Expand all
553 } 556 }
554 557
555 animationAttributeChanged(); 558 animationAttributeChanged();
556 } 559 }
557 560
558 inline Element* SVGSMILElement::eventBaseFor(const Condition& condition) 561 inline Element* SVGSMILElement::eventBaseFor(const Condition& condition)
559 { 562 {
560 return condition.m_baseID.isEmpty() ? targetElement() : treeScope().getEleme ntById(AtomicString(condition.m_baseID)); 563 return condition.m_baseID.isEmpty() ? targetElement() : treeScope().getEleme ntById(AtomicString(condition.m_baseID));
561 } 564 }
562 565
563 void SVGSMILElement::connectConditions() 566 void SVGSMILElement::connectSyncBaseConditions()
564 { 567 {
565 if (m_conditionsConnected) 568 if (m_syncBaseConditionsConnected)
566 disconnectConditions(); 569 disconnectSyncBaseConditions();
567 m_conditionsConnected = true; 570 m_syncBaseConditionsConnected = true;
568 for (unsigned n = 0; n < m_conditions.size(); ++n) { 571 for (unsigned n = 0; n < m_conditions.size(); ++n) {
569 Condition& condition = m_conditions[n]; 572 Condition& condition = m_conditions[n];
570 if (condition.m_type == Condition::EventBase) { 573 if (condition.m_type == Condition::Syncbase) {
571 ASSERT(!condition.m_syncbase);
572 Element* eventBase = eventBaseFor(condition);
573 if (!eventBase)
574 continue;
575 ASSERT(!condition.m_eventListener);
576 condition.m_eventListener = ConditionEventListener::create(this, &co ndition);
577 eventBase->addEventListener(AtomicString(condition.m_name), conditio n.m_eventListener, false);
578 } else if (condition.m_type == Condition::Syncbase) {
579 ASSERT(!condition.m_baseID.isEmpty()); 574 ASSERT(!condition.m_baseID.isEmpty());
580 condition.m_syncbase = treeScope().getElementById(AtomicString(condi tion.m_baseID)); 575 condition.m_syncbase = treeScope().getElementById(AtomicString(condi tion.m_baseID));
581 if (!condition.m_syncbase || !isSVGSMILElement(*condition.m_syncbase )) { 576 if (!condition.m_syncbase || !isSVGSMILElement(*condition.m_syncbase )) {
582 condition.m_syncbase = 0; 577 condition.m_syncbase = 0;
583 continue; 578 continue;
584 } 579 }
585 toSVGSMILElement(condition.m_syncbase.get())->addTimeDependent(this) ; 580 toSVGSMILElement(condition.m_syncbase.get())->addSyncBaseDependent(t his);
586 } 581 }
587 } 582 }
588 } 583 }
589 584
590 void SVGSMILElement::disconnectConditions() 585 void SVGSMILElement::disconnectSyncBaseConditions()
591 { 586 {
592 if (!m_conditionsConnected) 587 if (!m_syncBaseConditionsConnected)
593 return; 588 return;
594 m_conditionsConnected = false; 589 m_syncBaseConditionsConnected = false;
590 for (unsigned n = 0; n < m_conditions.size(); ++n) {
591 Condition& condition = m_conditions[n];
592 if (condition.m_type == Condition::Syncbase) {
593 if (condition.m_syncbase)
594 toSVGSMILElement(condition.m_syncbase.get())->removeSyncBaseDepe ndent(this);
595 condition.m_syncbase = 0;
596 }
597 }
598 }
599
600 void SVGSMILElement::connectEventBaseConditions()
601 {
602 disconnectEventBaseConditions();
595 for (unsigned n = 0; n < m_conditions.size(); ++n) { 603 for (unsigned n = 0; n < m_conditions.size(); ++n) {
596 Condition& condition = m_conditions[n]; 604 Condition& condition = m_conditions[n];
597 if (condition.m_type == Condition::EventBase) { 605 if (condition.m_type == Condition::EventBase) {
606 ASSERT(!condition.m_syncbase);
607 Element* eventBase = eventBaseFor(condition);
608 if (!eventBase) {
pdr. 2014/01/07 00:25:28 Can you add an assert here that we don't add a pen
pavane 2014/01/07 18:20:58 Done.
609 document().accessSVGExtensions()->addPendingResource(condition.m _baseID, this);
pdr. 2014/01/07 00:25:28 Can you assert that m_baseID is not empty?
pavane 2014/01/07 18:20:58 Done.
610 continue;
611 }
612 ASSERT(!condition.m_eventListener);
613 condition.m_eventListener = ConditionEventListener::create(this, &co ndition);
614 eventBase->addEventListener(AtomicString(condition.m_name), conditio n.m_eventListener, false);
615 document().accessSVGExtensions()->addElementReferencingTarget(this, toSVGElement(eventBase));
pdr. 2014/01/07 00:25:28 Here you add an element referencing a target but n
pavane 2014/01/07 18:20:58 I think it is handled already. We are calling disc
616 }
617 }
618 }
619
620 void SVGSMILElement::disconnectEventBaseConditions()
621 {
622 for (unsigned n = 0; n < m_conditions.size(); ++n) {
623 Condition& condition = m_conditions[n];
624 if (condition.m_type == Condition::EventBase) {
598 ASSERT(!condition.m_syncbase); 625 ASSERT(!condition.m_syncbase);
599 if (!condition.m_eventListener) 626 if (!condition.m_eventListener)
600 continue; 627 continue;
601 // Note: It's a memory optimization to try to remove our condition 628 // Note: It's a memory optimization to try to remove our condition
602 // event listener, but it's not guaranteed to work, since we have 629 // event listener, but it's not guaranteed to work, since we have
603 // no guarantee that eventBaseFor() will be able to find our conditi on's 630 // no guarantee that eventBaseFor() will be able to find our conditi on's
604 // original eventBase. So, we also have to disconnect ourselves from 631 // original eventBase. So, we also have to disconnect ourselves from
605 // our condition event listener, in case it later fires. 632 // our condition event listener, in case it later fires.
606 Element* eventBase = eventBaseFor(condition); 633 Element* eventBase = eventBaseFor(condition);
607 if (eventBase) 634 if (eventBase)
608 eventBase->removeEventListener(AtomicString(condition.m_name), c ondition.m_eventListener.get(), false); 635 eventBase->removeEventListener(AtomicString(condition.m_name), c ondition.m_eventListener.get(), false);
609 condition.m_eventListener->disconnectAnimation(); 636 condition.m_eventListener->disconnectAnimation();
610 condition.m_eventListener = 0; 637 condition.m_eventListener = 0;
611 } else if (condition.m_type == Condition::Syncbase) {
612 if (condition.m_syncbase)
613 toSVGSMILElement(condition.m_syncbase.get())->removeTimeDependen t(this);
614 } 638 }
615 condition.m_syncbase = 0;
616 } 639 }
617 } 640 }
618 641
619 void SVGSMILElement::setAttributeName(const QualifiedName& attributeName) 642 void SVGSMILElement::setAttributeName(const QualifiedName& attributeName)
620 { 643 {
621 if (m_timeContainer && m_targetElement && m_attributeName != attributeName) { 644 if (m_timeContainer && m_targetElement && m_attributeName != attributeName) {
622 if (hasValidAttributeName()) 645 if (hasValidAttributeName())
623 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); 646 m_timeContainer->unschedule(this, m_targetElement, m_attributeName);
624 m_attributeName = attributeName; 647 m_attributeName = attributeName;
625 if (hasValidAttributeName()) 648 if (hasValidAttributeName())
(...skipping 11 matching lines...) Expand all
637 if (m_timeContainer && hasValidAttributeName()) { 660 if (m_timeContainer && hasValidAttributeName()) {
638 if (m_targetElement) 661 if (m_targetElement)
639 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); 662 m_timeContainer->unschedule(this, m_targetElement, m_attributeName);
640 if (target) 663 if (target)
641 m_timeContainer->schedule(this, target, m_attributeName); 664 m_timeContainer->schedule(this, target, m_attributeName);
642 } 665 }
643 666
644 if (m_targetElement) { 667 if (m_targetElement) {
645 // Clear values that may depend on the previous target. 668 // Clear values that may depend on the previous target.
646 clearAnimatedType(m_targetElement); 669 clearAnimatedType(m_targetElement);
647 disconnectConditions(); 670 disconnectSyncBaseConditions();
648 } 671 }
649 672
650 // If the animation state is not Inactive, always reset to a clear state bef ore leaving the old target element. 673 // If the animation state is not Inactive, always reset to a clear state bef ore leaving the old target element.
651 if (m_activeState != Inactive) 674 if (m_activeState != Inactive)
652 endedActiveInterval(); 675 endedActiveInterval();
653 676
654 m_targetElement = target; 677 m_targetElement = target;
655 } 678 }
656 679
657 SMILTime SVGSMILElement::elapsed() const 680 SMILTime SVGSMILElement::elapsed() const
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 // Animation does not contribute during the active time if it is past its re peating duration and has fill=remove. 1111 // Animation does not contribute during the active time if it is past its re peating duration and has fill=remove.
1089 return (m_activeState == Active && (fill() == FillFreeze || elapsed <= m_int ervalBegin + repeatingDuration())) || m_activeState == Frozen; 1112 return (m_activeState == Active && (fill() == FillFreeze || elapsed <= m_int ervalBegin + repeatingDuration())) || m_activeState == Frozen;
1090 } 1113 }
1091 1114
1092 bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b ool seekToTime) 1115 bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b ool seekToTime)
1093 { 1116 {
1094 ASSERT(resultElement); 1117 ASSERT(resultElement);
1095 ASSERT(m_timeContainer); 1118 ASSERT(m_timeContainer);
1096 ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite()); 1119 ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite());
1097 1120
1098 if (!m_conditionsConnected) 1121 if (!m_syncBaseConditionsConnected)
1099 connectConditions(); 1122 connectSyncBaseConditions();
1100 1123
1101 if (!m_intervalBegin.isFinite()) { 1124 if (!m_intervalBegin.isFinite()) {
1102 ASSERT(m_activeState == Inactive); 1125 ASSERT(m_activeState == Inactive);
1103 m_nextProgressTime = SMILTime::unresolved(); 1126 m_nextProgressTime = SMILTime::unresolved();
1104 return false; 1127 return false;
1105 } 1128 }
1106 1129
1107 if (elapsed < m_intervalBegin) { 1130 if (elapsed < m_intervalBegin) {
1108 ASSERT(m_activeState != Active); 1131 ASSERT(m_activeState != Active);
1109 if (m_activeState == Frozen) { 1132 if (m_activeState == Frozen) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 return animationIsContributing; 1208 return animationIsContributing;
1186 } 1209 }
1187 1210
1188 void SVGSMILElement::notifyDependentsIntervalChanged() 1211 void SVGSMILElement::notifyDependentsIntervalChanged()
1189 { 1212 {
1190 ASSERT(m_intervalBegin.isFinite()); 1213 ASSERT(m_intervalBegin.isFinite());
1191 DEFINE_STATIC_LOCAL(HashSet<SVGSMILElement*>, loopBreaker, ()); 1214 DEFINE_STATIC_LOCAL(HashSet<SVGSMILElement*>, loopBreaker, ());
1192 if (!loopBreaker.add(this).isNewEntry) 1215 if (!loopBreaker.add(this).isNewEntry)
1193 return; 1216 return;
1194 1217
1195 TimeDependentSet::iterator end = m_timeDependents.end(); 1218 TimeDependentSet::iterator end = m_syncBaseDependents.end();
1196 for (TimeDependentSet::iterator it = m_timeDependents.begin(); it != end; ++ it) { 1219 for (TimeDependentSet::iterator it = m_syncBaseDependents.begin(); it != end ; ++it) {
1197 SVGSMILElement* dependent = *it; 1220 SVGSMILElement* dependent = *it;
1198 dependent->createInstanceTimesFromSyncbase(this); 1221 dependent->createInstanceTimesFromSyncbase(this);
1199 } 1222 }
1200 1223
1201 loopBreaker.remove(this); 1224 loopBreaker.remove(this);
1202 } 1225 }
1203 1226
1204 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncbase) 1227 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncbase)
1205 { 1228 {
1206 // FIXME: To be really correct, this should handle updating exising interval by changing 1229 // FIXME: To be really correct, this should handle updating exising interval by changing
(...skipping 10 matching lines...) Expand all
1217 time = syncbase->m_intervalEnd + condition.m_offset; 1240 time = syncbase->m_intervalEnd + condition.m_offset;
1218 ASSERT(time.isFinite()); 1241 ASSERT(time.isFinite());
1219 if (condition.m_beginOrEnd == Begin) 1242 if (condition.m_beginOrEnd == Begin)
1220 addBeginTime(elapsed(), time); 1243 addBeginTime(elapsed(), time);
1221 else 1244 else
1222 addEndTime(elapsed(), time); 1245 addEndTime(elapsed(), time);
1223 } 1246 }
1224 } 1247 }
1225 } 1248 }
1226 1249
1227 void SVGSMILElement::addTimeDependent(SVGSMILElement* animation) 1250 void SVGSMILElement::addSyncBaseDependent(SVGSMILElement* animation)
1228 { 1251 {
1229 m_timeDependents.add(animation); 1252 m_syncBaseDependents.add(animation);
1230 if (m_intervalBegin.isFinite()) 1253 if (m_intervalBegin.isFinite())
1231 animation->createInstanceTimesFromSyncbase(this); 1254 animation->createInstanceTimesFromSyncbase(this);
1232 } 1255 }
1233 1256
1234 void SVGSMILElement::removeTimeDependent(SVGSMILElement* animation) 1257 void SVGSMILElement::removeSyncBaseDependent(SVGSMILElement* animation)
1235 { 1258 {
1236 m_timeDependents.remove(animation); 1259 m_syncBaseDependents.remove(animation);
1237 } 1260 }
1238 1261
1239 void SVGSMILElement::handleConditionEvent(Event* event, Condition* condition) 1262 void SVGSMILElement::handleConditionEvent(Event* event, Condition* condition)
1240 { 1263 {
1241 if (event->type() == "repeatn" && toRepeatEvent(event)->repeat() != conditio n->m_repeat) 1264 if (event->type() == "repeatn" && toRepeatEvent(event)->repeat() != conditio n->m_repeat)
1242 return; 1265 return;
1243 1266
1244 SMILTime elapsed = this->elapsed(); 1267 SMILTime elapsed = this->elapsed();
1245 if (condition->m_beginOrEnd == Begin) 1268 if (condition->m_beginOrEnd == Begin)
1246 addBeginTime(elapsed, elapsed + condition->m_offset); 1269 addBeginTime(elapsed, elapsed + condition->m_offset);
(...skipping 27 matching lines...) Expand all
1274 if (eventType == "repeatn") { 1297 if (eventType == "repeatn") {
1275 unsigned repeatEventCount = m_repeatEventCountList.first(); 1298 unsigned repeatEventCount = m_repeatEventCountList.first();
1276 m_repeatEventCountList.remove(0); 1299 m_repeatEventCountList.remove(0);
1277 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); 1300 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount));
1278 } else { 1301 } else {
1279 dispatchEvent(Event::create(eventType)); 1302 dispatchEvent(Event::create(eventType));
1280 } 1303 }
1281 } 1304 }
1282 1305
1283 } 1306 }
OLDNEW
« Source/core/svg/animation/SVGSMILElement.h ('K') | « Source/core/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698