| 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 28 matching lines...) Expand all Loading... |
| 39 #include "core/svg/animation/SMILTimeContainer.h" | 39 #include "core/svg/animation/SMILTimeContainer.h" |
| 40 #include "platform/FloatConversion.h" | 40 #include "platform/FloatConversion.h" |
| 41 #include "wtf/MathExtras.h" | 41 #include "wtf/MathExtras.h" |
| 42 #include "wtf/StdLibExtras.h" | 42 #include "wtf/StdLibExtras.h" |
| 43 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
| 44 | 44 |
| 45 using namespace std; | 45 using namespace std; |
| 46 | 46 |
| 47 namespace WebCore { | 47 namespace WebCore { |
| 48 | 48 |
| 49 class RepeatEvent : public Event { | 49 class RepeatEvent FINAL : public Event { |
| 50 public: | 50 public: |
| 51 static PassRefPtr<RepeatEvent> create(const AtomicString& type, int repeat) | 51 static PassRefPtr<RepeatEvent> create(const AtomicString& type, int repeat) |
| 52 { | 52 { |
| 53 return adoptRef(new RepeatEvent(type, false, false, repeat)); | 53 return adoptRef(new RepeatEvent(type, false, false, repeat)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 ~RepeatEvent() { } | 56 virtual ~RepeatEvent() { } |
| 57 | 57 |
| 58 int repeat() const { return m_repeat; } | 58 int repeat() const { return m_repeat; } |
| 59 protected: | 59 protected: |
| 60 RepeatEvent(const AtomicString& type, bool canBubble, bool cancelable, int r
epeat = -1) | 60 RepeatEvent(const AtomicString& type, bool canBubble, bool cancelable, int r
epeat = -1) |
| 61 : Event(type, canBubble, cancelable) | 61 : Event(type, canBubble, cancelable) |
| 62 , m_repeat(repeat) | 62 , m_repeat(repeat) |
| 63 { | 63 { |
| 64 } | 64 } |
| 65 private: | 65 private: |
| 66 int m_repeat; | 66 int m_repeat; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 92 | 92 |
| 93 static SMILEventSender& smilRepeatNEventSender() | 93 static SMILEventSender& smilRepeatNEventSender() |
| 94 { | 94 { |
| 95 DEFINE_STATIC_LOCAL(SMILEventSender, sender, ("repeatn")); | 95 DEFINE_STATIC_LOCAL(SMILEventSender, sender, ("repeatn")); |
| 96 return sender; | 96 return sender; |
| 97 } | 97 } |
| 98 | 98 |
| 99 // This is used for duration type time values that can't be negative. | 99 // This is used for duration type time values that can't be negative. |
| 100 static const double invalidCachedTime = -1.; | 100 static const double invalidCachedTime = -1.; |
| 101 | 101 |
| 102 class ConditionEventListener : public EventListener { | 102 class ConditionEventListener FINAL : public EventListener { |
| 103 public: | 103 public: |
| 104 static PassRefPtr<ConditionEventListener> create(SVGSMILElement* animation,
SVGSMILElement::Condition* condition) | 104 static PassRefPtr<ConditionEventListener> create(SVGSMILElement* animation,
SVGSMILElement::Condition* condition) |
| 105 { | 105 { |
| 106 return adoptRef(new ConditionEventListener(animation, condition)); | 106 return adoptRef(new ConditionEventListener(animation, condition)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 static const ConditionEventListener* cast(const EventListener* listener) | 109 static const ConditionEventListener* cast(const EventListener* listener) |
| 110 { | 110 { |
| 111 return listener->type() == ConditionEventListenerType | 111 return listener->type() == ConditionEventListenerType |
| 112 ? static_cast<const ConditionEventListener*>(listener) | 112 ? static_cast<const ConditionEventListener*>(listener) |
| 113 : 0; | 113 : 0; |
| 114 } | 114 } |
| 115 | 115 |
| 116 virtual bool operator==(const EventListener& other); | 116 virtual bool operator==(const EventListener& other) OVERRIDE; |
| 117 | 117 |
| 118 void disconnectAnimation() | 118 void disconnectAnimation() |
| 119 { | 119 { |
| 120 m_animation = 0; | 120 m_animation = 0; |
| 121 } | 121 } |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 ConditionEventListener(SVGSMILElement* animation, SVGSMILElement::Condition*
condition) | 124 ConditionEventListener(SVGSMILElement* animation, SVGSMILElement::Condition*
condition) |
| 125 : EventListener(ConditionEventListenerType) | 125 : EventListener(ConditionEventListenerType) |
| 126 , m_animation(animation) | 126 , m_animation(animation) |
| 127 , m_condition(condition) | 127 , m_condition(condition) |
| 128 { | 128 { |
| 129 } | 129 } |
| 130 | 130 |
| 131 virtual void handleEvent(ExecutionContext*, Event*); | 131 virtual void handleEvent(ExecutionContext*, Event*) OVERRIDE; |
| 132 | 132 |
| 133 SVGSMILElement* m_animation; | 133 SVGSMILElement* m_animation; |
| 134 SVGSMILElement::Condition* m_condition; | 134 SVGSMILElement::Condition* m_condition; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 bool ConditionEventListener::operator==(const EventListener& listener) | 137 bool ConditionEventListener::operator==(const EventListener& listener) |
| 138 { | 138 { |
| 139 if (const ConditionEventListener* conditionEventListener = ConditionEventLis
tener::cast(&listener)) | 139 if (const ConditionEventListener* conditionEventListener = ConditionEventLis
tener::cast(&listener)) |
| 140 return m_animation == conditionEventListener->m_animation && m_condition
== conditionEventListener->m_condition; | 140 return m_animation == conditionEventListener->m_animation && m_condition
== conditionEventListener->m_condition; |
| 141 return false; | 141 return false; |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 if (eventType == "repeatn") { | 1304 if (eventType == "repeatn") { |
| 1305 unsigned repeatEventCount = m_repeatEventCountList.first(); | 1305 unsigned repeatEventCount = m_repeatEventCountList.first(); |
| 1306 m_repeatEventCountList.remove(0); | 1306 m_repeatEventCountList.remove(0); |
| 1307 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); | 1307 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); |
| 1308 } else { | 1308 } else { |
| 1309 dispatchEvent(Event::create(eventType)); | 1309 dispatchEvent(Event::create(eventType)); |
| 1310 } | 1310 } |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 } | 1313 } |
| OLD | NEW |