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

Side by Side Diff: third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h

Issue 2712343004: Tidy up instance time handling in SVGSMILElement (Closed)
Patch Set: Created 3 years, 9 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 void scheduleEvent(const AtomicString& eventType); 121 void scheduleEvent(const AtomicString& eventType);
122 void scheduleRepeatEvents(unsigned); 122 void scheduleRepeatEvents(unsigned);
123 void dispatchPendingEvent(const AtomicString& eventType); 123 void dispatchPendingEvent(const AtomicString& eventType);
124 124
125 virtual bool isSVGDiscardElement() const { return false; } 125 virtual bool isSVGDiscardElement() const { return false; }
126 126
127 DECLARE_VIRTUAL_TRACE(); 127 DECLARE_VIRTUAL_TRACE();
128 128
129 protected: 129 protected:
130 void addBeginTime( 130 enum BeginOrEnd { Begin, End };
131 SMILTime eventTime, 131
132 SMILTime endTime, 132 void addInstanceTime(
133 SMILTimeWithOrigin::Origin = SMILTimeWithOrigin::ParserOrigin); 133 BeginOrEnd,
134 void addEndTime( 134 SMILTime,
135 SMILTime eventTime,
136 SMILTime endTime,
137 SMILTimeWithOrigin::Origin = SMILTimeWithOrigin::ParserOrigin); 135 SMILTimeWithOrigin::Origin = SMILTimeWithOrigin::ParserOrigin);
138 136
139 void setInactive() { m_activeState = Inactive; } 137 void setInactive() { m_activeState = Inactive; }
140 138
141 // Sub-classes may need to take action when the target is changed. 139 // Sub-classes may need to take action when the target is changed.
142 virtual void setTargetElement(SVGElement*); 140 virtual void setTargetElement(SVGElement*);
143 141
144 void schedule(); 142 void schedule();
145 void unscheduleIfScheduled(); 143 void unscheduleIfScheduled();
146 144
147 QualifiedName m_attributeName; 145 QualifiedName m_attributeName;
148 146
149 private: 147 private:
150 void buildPendingResource() override; 148 void buildPendingResource() override;
151 void clearResourceAndEventBaseReferences(); 149 void clearResourceAndEventBaseReferences();
152 void clearConditions(); 150 void clearConditions();
153 151
154 virtual void startedActiveInterval() = 0; 152 virtual void startedActiveInterval() = 0;
155 void endedActiveInterval(); 153 void endedActiveInterval();
156 virtual void updateAnimation(float percent, 154 virtual void updateAnimation(float percent,
157 unsigned repeat, 155 unsigned repeat,
158 SVGSMILElement* resultElement) = 0; 156 SVGSMILElement* resultElement) = 0;
159 157
160 bool layoutObjectIsNeeded(const ComputedStyle&) override { return false; } 158 bool layoutObjectIsNeeded(const ComputedStyle&) override { return false; }
161 159
162 enum BeginOrEnd { Begin, End };
163
164 SMILTime findInstanceTime(BeginOrEnd, 160 SMILTime findInstanceTime(BeginOrEnd,
165 SMILTime minimumTime, 161 SMILTime minimumTime,
166 bool equalsMinimumOK) const; 162 bool equalsMinimumOK) const;
167 163
168 enum IntervalSelector { FirstInterval, NextInterval }; 164 enum IntervalSelector { FirstInterval, NextInterval };
169 165
170 SMILInterval resolveInterval(IntervalSelector) const; 166 SMILInterval resolveInterval(IntervalSelector) const;
171 void resolveFirstInterval(); 167 void resolveFirstInterval();
172 bool resolveNextInterval(); 168 bool resolveNextInterval();
173 SMILTime resolveActiveEnd(SMILTime resolvedBegin, SMILTime resolvedEnd) const; 169 SMILTime resolveActiveEnd(SMILTime resolvedBegin, SMILTime resolvedEnd) const;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 int m_repeat; 226 int m_repeat;
231 Member<SVGSMILElement> m_syncBase; 227 Member<SVGSMILElement> m_syncBase;
232 Member<ConditionEventListener> m_eventListener; 228 Member<ConditionEventListener> m_eventListener;
233 }; 229 };
234 bool parseCondition(const String&, BeginOrEnd beginOrEnd); 230 bool parseCondition(const String&, BeginOrEnd beginOrEnd);
235 void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd); 231 void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd);
236 232
237 void disconnectSyncBaseConditions(); 233 void disconnectSyncBaseConditions();
238 void disconnectEventBaseConditions(); 234 void disconnectEventBaseConditions();
239 235
240 // Event base timing
241 void handleConditionEvent(Event*, Condition*);
242
243 void notifyDependentsIntervalChanged(); 236 void notifyDependentsIntervalChanged();
244 void createInstanceTimesFromSyncbase(SVGSMILElement& syncbase); 237 void createInstanceTimesFromSyncbase(SVGSMILElement& syncbase);
245 void addSyncBaseDependent(SVGSMILElement&); 238 void addSyncBaseDependent(SVGSMILElement&);
246 void removeSyncBaseDependent(SVGSMILElement&); 239 void removeSyncBaseDependent(SVGSMILElement&);
247 240
248 enum ActiveState { Inactive, Active, Frozen }; 241 enum ActiveState { Inactive, Active, Frozen };
249 242
250 ActiveState determineActiveState(SMILTime elapsed) const; 243 ActiveState determineActiveState(SMILTime elapsed) const;
251 float calculateAnimationPercentAndRepeat(double elapsed, 244 float calculateAnimationPercentAndRepeat(double elapsed,
252 unsigned& repeat) const; 245 unsigned& repeat) const;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 element.hasTagName(SVGNames::animateMotionTag) || 294 element.hasTagName(SVGNames::animateMotionTag) ||
302 element.hasTagName(SVGNames::animateTransformTag) || 295 element.hasTagName(SVGNames::animateTransformTag) ||
303 element.hasTagName((SVGNames::discardTag)); 296 element.hasTagName((SVGNames::discardTag));
304 } 297 }
305 298
306 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement); 299 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement);
307 300
308 } // namespace blink 301 } // namespace blink
309 302
310 #endif // SVGSMILElement_h 303 #endif // SVGSMILElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698