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

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

Issue 22385010: [SVG] Handle endEvent for svg animations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 // Animation does not contribute during the active time if it is past its re peating duration and has fill=remove. 1044 // Animation does not contribute during the active time if it is past its re peating duration and has fill=remove.
1045 return (m_activeState == Active && (fill() == FillFreeze || elapsed <= m_int ervalBegin + repeatingDuration())) || m_activeState == Frozen; 1045 return (m_activeState == Active && (fill() == FillFreeze || elapsed <= m_int ervalBegin + repeatingDuration())) || m_activeState == Frozen;
1046 } 1046 }
1047 1047
1048 bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b ool seekToTime) 1048 bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b ool seekToTime)
1049 { 1049 {
1050 ASSERT(resultElement); 1050 ASSERT(resultElement);
1051 ASSERT(m_timeContainer); 1051 ASSERT(m_timeContainer);
1052 ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite()); 1052 ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite());
1053 1053
1054 if (!m_conditionsConnected)
1055 connectConditions();
1056
1057 if (!m_intervalBegin.isFinite()) { 1054 if (!m_intervalBegin.isFinite()) {
1058 ASSERT(m_activeState == Inactive); 1055 ASSERT(m_activeState == Inactive);
1059 m_nextProgressTime = SMILTime::unresolved(); 1056 m_nextProgressTime = SMILTime::unresolved();
1060 return false; 1057 return false;
1061 } 1058 }
1062 1059
1063 if (elapsed < m_intervalBegin) { 1060 if (elapsed < m_intervalBegin) {
1064 ASSERT(m_activeState != Active); 1061 ASSERT(m_activeState != Active);
1065 if (m_activeState == Frozen) { 1062 if (m_activeState == Frozen) {
1066 if (this == resultElement) 1063 if (this == resultElement)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 if (animationIsContributing) { 1100 if (animationIsContributing) {
1104 if (oldActiveState == Inactive) 1101 if (oldActiveState == Inactive)
1105 startedActiveInterval(); 1102 startedActiveInterval();
1106 1103
1107 updateAnimation(percent, repeat, resultElement); 1104 updateAnimation(percent, repeat, resultElement);
1108 m_lastPercent = percent; 1105 m_lastPercent = percent;
1109 m_lastRepeat = repeat; 1106 m_lastRepeat = repeat;
1110 } 1107 }
1111 1108
1112 if (oldActiveState == Active && m_activeState != Active) { 1109 if (oldActiveState == Active && m_activeState != Active) {
1110 dispatchEvent(Event::create("endEvent", false, false));
pdr. 2013/08/29 21:15:06 Unfortunately, synchronously calling dispatchEvent
1113 endedActiveInterval(); 1111 endedActiveInterval();
1114 if (m_activeState != Frozen && this == resultElement) 1112 if (m_activeState != Frozen && this == resultElement)
1115 clearAnimatedType(m_targetElement); 1113 clearAnimatedType(m_targetElement);
1116 } 1114 }
1117 1115
1116 // Triggering all the pending events if the animation timeline is changed.
1117 if (seekToTime) {
1118 if (m_activeState == Inactive || m_activeState == Frozen)
1119 dispatchEvent(Event::create("endEvent", false, false));
pdr. 2013/08/29 21:15:06 ditto here
1120 }
1121
1118 m_nextProgressTime = calculateNextProgressTime(elapsed); 1122 m_nextProgressTime = calculateNextProgressTime(elapsed);
1119 return animationIsContributing; 1123 return animationIsContributing;
1120 } 1124 }
1121 1125
1122 void SVGSMILElement::notifyDependentsIntervalChanged(NewOrExistingInterval newOr Existing) 1126 void SVGSMILElement::notifyDependentsIntervalChanged(NewOrExistingInterval newOr Existing)
1123 { 1127 {
1124 ASSERT(m_intervalBegin.isFinite()); 1128 ASSERT(m_intervalBegin.isFinite());
1125 DEFINE_STATIC_LOCAL(HashSet<SVGSMILElement*>, loopBreaker, ()); 1129 DEFINE_STATIC_LOCAL(HashSet<SVGSMILElement*>, loopBreaker, ());
1126 if (!loopBreaker.add(this).isNewEntry) 1130 if (!loopBreaker.add(this).isNewEntry)
1127 return; 1131 return;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 addBeginTime(elapsed, elapsed); 1189 addBeginTime(elapsed, elapsed);
1186 } 1190 }
1187 1191
1188 void SVGSMILElement::endedActiveInterval() 1192 void SVGSMILElement::endedActiveInterval()
1189 { 1193 {
1190 clearTimesWithDynamicOrigins(m_beginTimes); 1194 clearTimesWithDynamicOrigins(m_beginTimes);
1191 clearTimesWithDynamicOrigins(m_endTimes); 1195 clearTimesWithDynamicOrigins(m_endTimes);
1192 } 1196 }
1193 1197
1194 } 1198 }
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