| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 { | 100 { |
| 101 DEFINE_STATIC_LOCAL(SMILEventSender, sender, (AtomicString("repeatn", Atomic
String::ConstructFromLiteral))); | 101 DEFINE_STATIC_LOCAL(SMILEventSender, sender, (AtomicString("repeatn", Atomic
String::ConstructFromLiteral))); |
| 102 return sender; | 102 return sender; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // This is used for duration type time values that can't be negative. | 105 // This is used for duration type time values that can't be negative. |
| 106 static const double invalidCachedTime = -1.; | 106 static const double invalidCachedTime = -1.; |
| 107 | 107 |
| 108 class ConditionEventListener final : public EventListener { | 108 class ConditionEventListener final : public EventListener { |
| 109 public: | 109 public: |
| 110 static PassRefPtr<ConditionEventListener> create(SVGSMILElement* animation,
SVGSMILElement::Condition* condition) | 110 static PassRefPtrWillBeRawPtr<ConditionEventListener> create(SVGSMILElement*
animation, SVGSMILElement::Condition* condition) |
| 111 { | 111 { |
| 112 return adoptRef(new ConditionEventListener(animation, condition)); | 112 return adoptRefWillBeNoop(new ConditionEventListener(animation, conditio
n)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 static const ConditionEventListener* cast(const EventListener* listener) | 115 static const ConditionEventListener* cast(const EventListener* listener) |
| 116 { | 116 { |
| 117 return listener->type() == ConditionEventListenerType | 117 return listener->type() == ConditionEventListenerType |
| 118 ? static_cast<const ConditionEventListener*>(listener) | 118 ? static_cast<const ConditionEventListener*>(listener) |
| 119 : nullptr; | 119 : nullptr; |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool operator==(const EventListener& other) override; | 122 bool operator==(const EventListener& other) override; |
| 123 | 123 |
| 124 void disconnectAnimation() | 124 void disconnectAnimation() |
| 125 { | 125 { |
| 126 m_animation = nullptr; | 126 m_animation = nullptr; |
| 127 } | 127 } |
| 128 | 128 |
| 129 DEFINE_INLINE_VIRTUAL_TRACE() |
| 130 { |
| 131 visitor->trace(m_animation); |
| 132 EventListener::trace(visitor); |
| 133 } |
| 134 |
| 129 private: | 135 private: |
| 130 ConditionEventListener(SVGSMILElement* animation, SVGSMILElement::Condition*
condition) | 136 ConditionEventListener(SVGSMILElement* animation, SVGSMILElement::Condition*
condition) |
| 131 : EventListener(ConditionEventListenerType) | 137 : EventListener(ConditionEventListenerType) |
| 132 , m_animation(animation) | 138 , m_animation(animation) |
| 133 , m_condition(condition) | 139 , m_condition(condition) |
| 134 { | 140 { |
| 135 } | 141 } |
| 136 | 142 |
| 137 void handleEvent(ExecutionContext*, Event*) override; | 143 void handleEvent(ExecutionContext*, Event*) override; |
| 138 | 144 |
| 139 SVGSMILElement* m_animation; | 145 RawPtrWillBeMember<SVGSMILElement> m_animation; |
| 140 SVGSMILElement::Condition* m_condition; | 146 SVGSMILElement::Condition* m_condition; |
| 141 }; | 147 }; |
| 142 | 148 |
| 143 bool ConditionEventListener::operator==(const EventListener& listener) | 149 bool ConditionEventListener::operator==(const EventListener& listener) |
| 144 { | 150 { |
| 145 if (const ConditionEventListener* conditionEventListener = ConditionEventLis
tener::cast(&listener)) | 151 if (const ConditionEventListener* conditionEventListener = ConditionEventLis
tener::cast(&listener)) |
| 146 return m_animation == conditionEventListener->m_animation && m_condition
== conditionEventListener->m_condition; | 152 return m_animation == conditionEventListener->m_animation && m_condition
== conditionEventListener->m_condition; |
| 147 return false; | 153 return false; |
| 148 } | 154 } |
| 149 | 155 |
| 150 void ConditionEventListener::handleEvent(ExecutionContext*, Event* event) | 156 void ConditionEventListener::handleEvent(ExecutionContext*, Event* event) |
| 151 { | 157 { |
| 152 if (!m_animation) | 158 if (!m_animation) |
| 153 return; | 159 return; |
| 154 m_animation->handleConditionEvent(event, m_condition); | 160 m_animation->handleConditionEvent(event, m_condition); |
| 155 } | 161 } |
| 156 | 162 |
| 157 void SVGSMILElement::Condition::setEventListener(PassRefPtr<ConditionEventListen
er> eventListener) | 163 void SVGSMILElement::Condition::setEventListener(PassRefPtrWillBeRawPtr<Conditio
nEventListener> eventListener) |
| 158 { | 164 { |
| 159 m_eventListener = eventListener; | 165 m_eventListener = eventListener; |
| 160 } | 166 } |
| 161 | 167 |
| 162 SVGSMILElement::Condition::Condition(Type type, BeginOrEnd beginOrEnd, const Str
ing& baseID, const String& name, SMILTime offset, int repeat) | 168 SVGSMILElement::Condition::Condition(Type type, BeginOrEnd beginOrEnd, const Str
ing& baseID, const String& name, SMILTime offset, int repeat) |
| 163 : m_type(type) | 169 : m_type(type) |
| 164 , m_beginOrEnd(beginOrEnd) | 170 , m_beginOrEnd(beginOrEnd) |
| 165 , m_baseID(baseID) | 171 , m_baseID(baseID) |
| 166 , m_name(name) | 172 , m_name(name) |
| 167 , m_offset(offset) | 173 , m_offset(offset) |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 m_isScheduled = false; | 1345 m_isScheduled = false; |
| 1340 } | 1346 } |
| 1341 | 1347 |
| 1342 SVGSMILElement::Condition::~Condition() | 1348 SVGSMILElement::Condition::~Condition() |
| 1343 { | 1349 { |
| 1344 } | 1350 } |
| 1345 | 1351 |
| 1346 DEFINE_TRACE(SVGSMILElement::Condition) | 1352 DEFINE_TRACE(SVGSMILElement::Condition) |
| 1347 { | 1353 { |
| 1348 visitor->trace(m_syncBase); | 1354 visitor->trace(m_syncBase); |
| 1355 visitor->trace(m_eventListener); |
| 1349 } | 1356 } |
| 1350 | 1357 |
| 1351 DEFINE_TRACE(SVGSMILElement) | 1358 DEFINE_TRACE(SVGSMILElement) |
| 1352 { | 1359 { |
| 1353 #if ENABLE(OILPAN) | 1360 #if ENABLE(OILPAN) |
| 1354 visitor->trace(m_targetElement); | 1361 visitor->trace(m_targetElement); |
| 1355 visitor->trace(m_timeContainer); | 1362 visitor->trace(m_timeContainer); |
| 1356 visitor->trace(m_conditions); | 1363 visitor->trace(m_conditions); |
| 1357 visitor->trace(m_syncBaseDependents); | 1364 visitor->trace(m_syncBaseDependents); |
| 1358 #endif | 1365 #endif |
| 1359 SVGElement::trace(visitor); | 1366 SVGElement::trace(visitor); |
| 1360 SVGTests::trace(visitor); | 1367 SVGTests::trace(visitor); |
| 1361 } | 1368 } |
| 1362 | 1369 |
| 1363 } // namespace blink | 1370 } // namespace blink |
| OLD | NEW |