| OLD | NEW |
| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 void beginListChanged(SMILTime eventTime); | 179 void beginListChanged(SMILTime eventTime); |
| 180 void endListChanged(SMILTime eventTime); | 180 void endListChanged(SMILTime eventTime); |
| 181 | 181 |
| 182 // This represents conditions on elements begin or end list that need to be | 182 // This represents conditions on elements begin or end list that need to be |
| 183 // resolved on runtime, for example | 183 // resolved on runtime, for example |
| 184 // <animate begin="otherElement.begin + 8s; button.click" ... /> | 184 // <animate begin="otherElement.begin + 8s; button.click" ... /> |
| 185 class Condition : public GarbageCollectedFinalized<Condition> { | 185 class Condition : public GarbageCollectedFinalized<Condition> { |
| 186 public: | 186 public: |
| 187 enum Type { EventBase, Syncbase, AccessKey }; | 187 enum Type { EventBase, Syncbase, AccessKey }; |
| 188 | 188 |
| 189 Condition(Type, | |
| 190 BeginOrEnd, | |
| 191 const String& baseID, | |
| 192 const String& name, | |
| 193 SMILTime offset, | |
| 194 int repeat = -1); | |
| 195 static Condition* create(Type type, | 189 static Condition* create(Type type, |
| 196 BeginOrEnd beginOrEnd, | 190 BeginOrEnd beginOrEnd, |
| 197 const String& baseID, | 191 const AtomicString& baseID, |
| 198 const String& name, | 192 const AtomicString& name, |
| 199 SMILTime offset, | 193 SMILTime offset, |
| 200 int repeat = -1) { | 194 int repeat = -1) { |
| 201 return new Condition(type, beginOrEnd, baseID, name, offset, repeat); | 195 return new Condition(type, beginOrEnd, baseID, name, offset, repeat); |
| 202 } | 196 } |
| 203 ~Condition(); | 197 ~Condition(); |
| 204 DECLARE_TRACE(); | 198 DECLARE_TRACE(); |
| 205 | 199 |
| 206 Type getType() const { return m_type; } | 200 Type getType() const { return m_type; } |
| 207 BeginOrEnd getBeginOrEnd() const { return m_beginOrEnd; } | 201 BeginOrEnd getBeginOrEnd() const { return m_beginOrEnd; } |
| 208 String baseID() const { return m_baseID; } | 202 const AtomicString& name() const { return m_name; } |
| 209 String name() const { return m_name; } | |
| 210 SMILTime offset() const { return m_offset; } | 203 SMILTime offset() const { return m_offset; } |
| 211 int repeat() const { return m_repeat; } | 204 int repeat() const { return m_repeat; } |
| 212 SVGSMILElement* syncBase() const { return m_syncBase.get(); } | 205 |
| 213 void setSyncBase(SVGSMILElement* element) { m_syncBase = element; } | 206 void connectSyncBase(SVGSMILElement&); |
| 214 ConditionEventListener* eventListener() const { | 207 void disconnectSyncBase(SVGSMILElement&); |
| 215 return m_eventListener.get(); | 208 bool syncBaseEquals(SVGSMILElement& timedElement) const { |
| 209 return m_syncBase == timedElement; |
| 216 } | 210 } |
| 217 void setEventListener(ConditionEventListener*); | 211 |
| 212 void connectEventBase(SVGSMILElement&); |
| 213 void disconnectEventBase(SVGSMILElement&); |
| 218 | 214 |
| 219 private: | 215 private: |
| 216 Condition(Type, |
| 217 BeginOrEnd, |
| 218 const AtomicString& baseID, |
| 219 const AtomicString& name, |
| 220 SMILTime offset, |
| 221 int repeat); |
| 222 |
| 223 SVGElement* lookupEventBase(SVGSMILElement&) const; |
| 224 |
| 220 Type m_type; | 225 Type m_type; |
| 221 BeginOrEnd m_beginOrEnd; | 226 BeginOrEnd m_beginOrEnd; |
| 222 String m_baseID; | 227 AtomicString m_baseID; |
| 223 String m_name; | 228 AtomicString m_name; |
| 224 SMILTime m_offset; | 229 SMILTime m_offset; |
| 225 int m_repeat; | 230 int m_repeat; |
| 226 Member<SVGSMILElement> m_syncBase; | 231 Member<SVGSMILElement> m_syncBase; |
| 227 Member<ConditionEventListener> m_eventListener; | 232 Member<ConditionEventListener> m_eventListener; |
| 228 }; | 233 }; |
| 229 bool parseCondition(const String&, BeginOrEnd beginOrEnd); | 234 bool parseCondition(const String&, BeginOrEnd beginOrEnd); |
| 230 void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd); | 235 void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd); |
| 231 SVGElement* eventBaseFor(const Condition&); | |
| 232 | 236 |
| 233 void disconnectSyncBaseConditions(); | 237 void disconnectSyncBaseConditions(); |
| 234 void disconnectEventBaseConditions(); | 238 void disconnectEventBaseConditions(); |
| 235 | 239 |
| 236 // Event base timing | 240 // Event base timing |
| 237 void handleConditionEvent(Event*, Condition*); | 241 void handleConditionEvent(Event*, Condition*); |
| 238 | 242 |
| 239 void notifyDependentsIntervalChanged(); | 243 void notifyDependentsIntervalChanged(); |
| 240 void createInstanceTimesFromSyncbase(SVGSMILElement* syncbase); | 244 void createInstanceTimesFromSyncbase(SVGSMILElement& syncbase); |
| 241 void addSyncBaseDependent(SVGSMILElement*); | 245 void addSyncBaseDependent(SVGSMILElement&); |
| 242 void removeSyncBaseDependent(SVGSMILElement*); | 246 void removeSyncBaseDependent(SVGSMILElement&); |
| 243 | 247 |
| 244 enum ActiveState { Inactive, Active, Frozen }; | 248 enum ActiveState { Inactive, Active, Frozen }; |
| 245 | 249 |
| 246 ActiveState determineActiveState(SMILTime elapsed) const; | 250 ActiveState determineActiveState(SMILTime elapsed) const; |
| 247 float calculateAnimationPercentAndRepeat(double elapsed, | 251 float calculateAnimationPercentAndRepeat(double elapsed, |
| 248 unsigned& repeat) const; | 252 unsigned& repeat) const; |
| 249 SMILTime calculateNextProgressTime(double elapsed) const; | 253 SMILTime calculateNextProgressTime(double elapsed) const; |
| 250 | 254 |
| 251 Member<SVGElement> m_targetElement; | 255 Member<SVGElement> m_targetElement; |
| 252 | 256 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 element.hasTagName(SVGNames::animateMotionTag) || | 301 element.hasTagName(SVGNames::animateMotionTag) || |
| 298 element.hasTagName(SVGNames::animateTransformTag) || | 302 element.hasTagName(SVGNames::animateTransformTag) || |
| 299 element.hasTagName((SVGNames::discardTag)); | 303 element.hasTagName((SVGNames::discardTag)); |
| 300 } | 304 } |
| 301 | 305 |
| 302 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement); | 306 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement); |
| 303 | 307 |
| 304 } // namespace blink | 308 } // namespace blink |
| 305 | 309 |
| 306 #endif // SVGSMILElement_h | 310 #endif // SVGSMILElement_h |
| OLD | NEW |