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

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

Issue 2737403003: Use IdTargetObserver in SVGSMILElement (Closed)
Patch Set: Rebase; always attempt to unobserve 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 20 matching lines...) Expand all
31 #include "core/svg/SVGElement.h" 31 #include "core/svg/SVGElement.h"
32 #include "core/svg/SVGTests.h" 32 #include "core/svg/SVGTests.h"
33 #include "core/svg/animation/SMILTime.h" 33 #include "core/svg/animation/SMILTime.h"
34 #include "platform/heap/Handle.h" 34 #include "platform/heap/Handle.h"
35 #include "wtf/HashMap.h" 35 #include "wtf/HashMap.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class ConditionEventListener; 39 class ConditionEventListener;
40 class SMILTimeContainer; 40 class SMILTimeContainer;
41 class IdTargetObserver;
41 class SVGSMILElement; 42 class SVGSMILElement;
42 43
43 // This class implements SMIL interval timing model as needed for SVG animation. 44 // This class implements SMIL interval timing model as needed for SVG animation.
44 class CORE_EXPORT SVGSMILElement : public SVGElement, public SVGTests { 45 class CORE_EXPORT SVGSMILElement : public SVGElement, public SVGTests {
45 USING_GARBAGE_COLLECTED_MIXIN(SVGSMILElement); 46 USING_GARBAGE_COLLECTED_MIXIN(SVGSMILElement);
46 47
47 public: 48 public:
48 SVGSMILElement(const QualifiedName&, Document&); 49 SVGSMILElement(const QualifiedName&, Document&);
49 ~SVGSMILElement() override; 50 ~SVGSMILElement() override;
50 51
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 void disconnectEventBase(SVGSMILElement&); 210 void disconnectEventBase(SVGSMILElement&);
210 211
211 private: 212 private:
212 Condition(Type, 213 Condition(Type,
213 BeginOrEnd, 214 BeginOrEnd,
214 const AtomicString& baseID, 215 const AtomicString& baseID,
215 const AtomicString& name, 216 const AtomicString& name,
216 SMILTime offset, 217 SMILTime offset,
217 int repeat); 218 int repeat);
218 219
219 SVGElement* lookupEventBase(SVGSMILElement&) const;
220
221 Type m_type; 220 Type m_type;
222 BeginOrEnd m_beginOrEnd; 221 BeginOrEnd m_beginOrEnd;
223 AtomicString m_baseID; 222 AtomicString m_baseID;
224 AtomicString m_name; 223 AtomicString m_name;
225 SMILTime m_offset; 224 SMILTime m_offset;
226 int m_repeat; 225 int m_repeat;
227 Member<SVGElement> m_baseElement; 226 Member<SVGElement> m_baseElement;
227 Member<IdTargetObserver> m_baseIdObserver;
228 Member<ConditionEventListener> m_eventListener; 228 Member<ConditionEventListener> m_eventListener;
229 }; 229 };
230 bool parseCondition(const String&, BeginOrEnd beginOrEnd); 230 bool parseCondition(const String&, BeginOrEnd beginOrEnd);
231 void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd); 231 void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd);
232 232
233 void disconnectSyncBaseConditions(); 233 void disconnectSyncBaseConditions();
234 void disconnectEventBaseConditions(); 234 void disconnectEventBaseConditions();
235 235
236 void notifyDependentsIntervalChanged(); 236 void notifyDependentsIntervalChanged();
237 void createInstanceTimesFromSyncbase(SVGSMILElement& syncbase); 237 void createInstanceTimesFromSyncbase(SVGSMILElement& syncbase);
238 void addSyncBaseDependent(SVGSMILElement&); 238 void addSyncBaseDependent(SVGSMILElement&);
239 void removeSyncBaseDependent(SVGSMILElement&); 239 void removeSyncBaseDependent(SVGSMILElement&);
240 240
241 enum ActiveState { Inactive, Active, Frozen }; 241 enum ActiveState { Inactive, Active, Frozen };
242 242
243 ActiveState determineActiveState(SMILTime elapsed) const; 243 ActiveState determineActiveState(SMILTime elapsed) const;
244 float calculateAnimationPercentAndRepeat(double elapsed, 244 float calculateAnimationPercentAndRepeat(double elapsed,
245 unsigned& repeat) const; 245 unsigned& repeat) const;
246 SMILTime calculateNextProgressTime(double elapsed) const; 246 SMILTime calculateNextProgressTime(double elapsed) const;
247 247
248 Member<SVGElement> m_targetElement; 248 Member<SVGElement> m_targetElement;
249 Member<IdTargetObserver> m_targetIdObserver;
249 250
250 HeapVector<Member<Condition>> m_conditions; 251 HeapVector<Member<Condition>> m_conditions;
251 bool m_syncBaseConditionsConnected; 252 bool m_syncBaseConditionsConnected;
252 bool m_hasEndEventConditions; 253 bool m_hasEndEventConditions;
253 254
254 bool m_isWaitingForFirstInterval; 255 bool m_isWaitingForFirstInterval;
255 bool m_isScheduled; 256 bool m_isScheduled;
256 257
257 using TimeDependentSet = HeapHashSet<Member<SVGSMILElement>>; 258 using TimeDependentSet = HeapHashSet<Member<SVGSMILElement>>;
258 TimeDependentSet m_syncBaseDependents; 259 TimeDependentSet m_syncBaseDependents;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 element.hasTagName(SVGNames::animateMotionTag) || 295 element.hasTagName(SVGNames::animateMotionTag) ||
295 element.hasTagName(SVGNames::animateTransformTag) || 296 element.hasTagName(SVGNames::animateTransformTag) ||
296 element.hasTagName((SVGNames::discardTag)); 297 element.hasTagName((SVGNames::discardTag));
297 } 298 }
298 299
299 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement); 300 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement);
300 301
301 } // namespace blink 302 } // namespace blink
302 303
303 #endif // SVGSMILElement_h 304 #endif // SVGSMILElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698