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

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

Powered by Google App Engine
This is Rietveld 408576698