OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/svg/SVGTreeScopeResources.h" | 5 #include "core/svg/SVGTreeScopeResources.h" |
6 | 6 |
7 #include "core/dom/Element.h" | 7 #include "core/dom/Element.h" |
8 #include "core/dom/TreeScope.h" | 8 #include "core/dom/TreeScope.h" |
9 #include "core/layout/svg/LayoutSVGResourceContainer.h" | 9 #include "core/layout/svg/LayoutSVGResourceContainer.h" |
10 #include "core/layout/svg/SVGResourcesCache.h" | 10 #include "core/layout/svg/SVGResourcesCache.h" |
11 #include "core/svg/SVGUseElement.h" | 11 #include "core/svg/SVGUseElement.h" |
12 #include "wtf/text/AtomicString.h" | 12 #include "wtf/text/AtomicString.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 SVGTreeScopeResources::SVGTreeScopeResources(TreeScope* treeScope) | 16 SVGTreeScopeResources::SVGTreeScopeResources(TreeScope* treeScope) |
17 : m_treeScope(treeScope) { | 17 : m_treeScope(treeScope) {} |
18 // Whenever an object of SVGTreeScopeResources is created, to keep the code | |
19 // behave as before, | |
20 // the document should also have an instance of SVGDocumentExtensions created. | |
21 // Thus below line is added. | |
22 treeScope->document().accessSVGExtensions(); | |
23 } | |
24 | 18 |
25 SVGTreeScopeResources::~SVGTreeScopeResources() = default; | 19 SVGTreeScopeResources::~SVGTreeScopeResources() = default; |
26 | 20 |
27 static LayoutSVGResourceContainer* lookupResource(TreeScope& treeScope, | 21 static LayoutSVGResourceContainer* lookupResource(TreeScope& treeScope, |
28 const AtomicString& id) { | 22 const AtomicString& id) { |
29 Element* element = treeScope.getElementById(id); | 23 Element* element = treeScope.getElementById(id); |
30 if (!element) | 24 if (!element) |
31 return nullptr; | 25 return nullptr; |
32 LayoutObject* layoutObject = element->layoutObject(); | 26 LayoutObject* layoutObject = element->layoutObject(); |
33 if (!layoutObject || !layoutObject->isSVGResourceContainer()) | 27 if (!layoutObject || !layoutObject->isSVGResourceContainer()) |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 223 |
230 clearHasPendingResourcesIfPossible(*clientElement); | 224 clearHasPendingResourcesIfPossible(*clientElement); |
231 } | 225 } |
232 } | 226 } |
233 | 227 |
234 DEFINE_TRACE(SVGTreeScopeResources) { | 228 DEFINE_TRACE(SVGTreeScopeResources) { |
235 visitor->trace(m_pendingResources); | 229 visitor->trace(m_pendingResources); |
236 visitor->trace(m_treeScope); | 230 visitor->trace(m_treeScope); |
237 } | 231 } |
238 } | 232 } |
OLD | NEW |