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 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "core/svg/animation/SVGSMILElement.h" | 26 #include "core/svg/animation/SVGSMILElement.h" |
27 | 27 |
28 #include "bindings/core/v8/ScriptEventListener.h" | 28 #include "bindings/core/v8/ScriptEventListener.h" |
29 #include "core/XLinkNames.h" | 29 #include "core/XLinkNames.h" |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 #include "core/dom/TaskRunnerHelper.h" | 31 #include "core/dom/TaskRunnerHelper.h" |
32 #include "core/events/Event.h" | 32 #include "core/events/Event.h" |
33 #include "core/events/EventListener.h" | 33 #include "core/events/EventListener.h" |
34 #include "core/svg/SVGDocumentExtensions.h" | |
35 #include "core/svg/SVGSVGElement.h" | 34 #include "core/svg/SVGSVGElement.h" |
| 35 #include "core/svg/SVGTreeScopeResources.h" |
36 #include "core/svg/SVGURIReference.h" | 36 #include "core/svg/SVGURIReference.h" |
37 #include "core/svg/animation/SMILTimeContainer.h" | 37 #include "core/svg/animation/SMILTimeContainer.h" |
38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
39 #include "wtf/MathExtras.h" | 39 #include "wtf/MathExtras.h" |
40 #include "wtf/StdLibExtras.h" | 40 #include "wtf/StdLibExtras.h" |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 #include <algorithm> | 42 #include <algorithm> |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 target && target->isSVGElement() ? toSVGElement(target) : nullptr; | 201 target && target->isSVGElement() ? toSVGElement(target) : nullptr; |
202 | 202 |
203 if (svgTarget && !svgTarget->isConnected()) | 203 if (svgTarget && !svgTarget->isConnected()) |
204 svgTarget = nullptr; | 204 svgTarget = nullptr; |
205 | 205 |
206 if (svgTarget != targetElement()) | 206 if (svgTarget != targetElement()) |
207 setTargetElement(svgTarget); | 207 setTargetElement(svgTarget); |
208 | 208 |
209 if (!svgTarget) { | 209 if (!svgTarget) { |
210 // Do not register as pending if we are already pending this resource. | 210 // Do not register as pending if we are already pending this resource. |
211 if (document().accessSVGExtensions().isElementPendingResource(this, id)) | 211 if (treeScope().ensureSVGTreeScopedResources().isElementPendingResource( |
| 212 this, id)) |
212 return; | 213 return; |
213 | |
214 if (!id.isEmpty()) { | 214 if (!id.isEmpty()) { |
215 document().accessSVGExtensions().addPendingResource(id, this); | 215 treeScope().ensureSVGTreeScopedResources().addPendingResource(id, this); |
216 ASSERT(hasPendingResources()); | 216 DCHECK(hasPendingResources()); |
217 } | 217 } |
218 } else { | 218 } else { |
219 // Register us with the target in the dependencies map. Any change of | 219 // Register us with the target in the dependencies map. Any change of |
220 // hrefElement that leads to relayout/repainting now informs us, so we can | 220 // hrefElement that leads to relayout/repainting now informs us, so we can |
221 // react to it. | 221 // react to it. |
222 addReferenceTo(svgTarget); | 222 addReferenceTo(svgTarget); |
223 } | 223 } |
224 connectEventBaseConditions(); | 224 connectEventBaseConditions(); |
225 } | 225 } |
226 | 226 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 563 |
564 void SVGSMILElement::connectEventBaseConditions() { | 564 void SVGSMILElement::connectEventBaseConditions() { |
565 disconnectEventBaseConditions(); | 565 disconnectEventBaseConditions(); |
566 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 566 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
567 Condition* condition = m_conditions[n].get(); | 567 Condition* condition = m_conditions[n].get(); |
568 if (condition->getType() == Condition::EventBase) { | 568 if (condition->getType() == Condition::EventBase) { |
569 ASSERT(!condition->syncBase()); | 569 ASSERT(!condition->syncBase()); |
570 SVGElement* eventBase = eventBaseFor(*condition); | 570 SVGElement* eventBase = eventBaseFor(*condition); |
571 if (!eventBase) { | 571 if (!eventBase) { |
572 if (!condition->baseID().isEmpty() && | 572 if (!condition->baseID().isEmpty() && |
573 !document().accessSVGExtensions().isElementPendingResource( | 573 !treeScope() |
574 this, AtomicString(condition->baseID()))) | 574 .ensureSVGTreeScopedResources() |
575 document().accessSVGExtensions().addPendingResource( | 575 .isElementPendingResource(this, |
| 576 AtomicString(condition->baseID()))) |
| 577 treeScope().ensureSVGTreeScopedResources().addPendingResource( |
576 AtomicString(condition->baseID()), this); | 578 AtomicString(condition->baseID()), this); |
577 continue; | 579 continue; |
578 } | 580 } |
579 ASSERT(!condition->eventListener()); | 581 ASSERT(!condition->eventListener()); |
580 condition->setEventListener( | 582 condition->setEventListener( |
581 ConditionEventListener::create(this, condition)); | 583 ConditionEventListener::create(this, condition)); |
582 eventBase->addEventListener(AtomicString(condition->name()), | 584 eventBase->addEventListener(AtomicString(condition->name()), |
583 condition->eventListener(), false); | 585 condition->eventListener(), false); |
584 addReferenceTo(eventBase); | 586 addReferenceTo(eventBase); |
585 } | 587 } |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 DEFINE_TRACE(SVGSMILElement) { | 1311 DEFINE_TRACE(SVGSMILElement) { |
1310 visitor->trace(m_targetElement); | 1312 visitor->trace(m_targetElement); |
1311 visitor->trace(m_timeContainer); | 1313 visitor->trace(m_timeContainer); |
1312 visitor->trace(m_conditions); | 1314 visitor->trace(m_conditions); |
1313 visitor->trace(m_syncBaseDependents); | 1315 visitor->trace(m_syncBaseDependents); |
1314 SVGElement::trace(visitor); | 1316 SVGElement::trace(visitor); |
1315 SVGTests::trace(visitor); | 1317 SVGTests::trace(visitor); |
1316 } | 1318 } |
1317 | 1319 |
1318 } // namespace blink | 1320 } // namespace blink |
OLD | NEW |