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 "wtf/text/AtomicString.h" | 10 #include "wtf/text/AtomicString.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 DCHECK(resource); | 26 DCHECK(resource); |
27 if (id.isEmpty()) | 27 if (id.isEmpty()) |
28 return; | 28 return; |
29 // Replaces resource if already present, to handle potential id changes | 29 // Replaces resource if already present, to handle potential id changes |
30 m_resources.set(id, resource); | 30 m_resources.set(id, resource); |
31 } | 31 } |
32 | 32 |
33 void SVGTreeScopeResources::removeResource(const AtomicString& id) { | 33 void SVGTreeScopeResources::removeResource(const AtomicString& id) { |
34 if (id.isEmpty()) | 34 if (id.isEmpty()) |
35 return; | 35 return; |
36 m_resources.remove(id); | 36 m_resources.erase(id); |
37 } | 37 } |
38 | 38 |
39 LayoutSVGResourceContainer* SVGTreeScopeResources::resourceById( | 39 LayoutSVGResourceContainer* SVGTreeScopeResources::resourceById( |
40 const AtomicString& id) const { | 40 const AtomicString& id) const { |
41 if (id.isEmpty()) | 41 if (id.isEmpty()) |
42 return nullptr; | 42 return nullptr; |
43 return m_resources.get(id); | 43 return m_resources.get(id); |
44 } | 44 } |
45 | 45 |
46 void SVGTreeScopeResources::addPendingResource(const AtomicString& id, | 46 void SVGTreeScopeResources::addPendingResource(const AtomicString& id, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 SVGTreeScopeResources::SVGPendingElements* | 126 SVGTreeScopeResources::SVGPendingElements* |
127 SVGTreeScopeResources::removePendingResource(const AtomicString& id) { | 127 SVGTreeScopeResources::removePendingResource(const AtomicString& id) { |
128 DCHECK(m_pendingResources.contains(id)); | 128 DCHECK(m_pendingResources.contains(id)); |
129 return m_pendingResources.take(id); | 129 return m_pendingResources.take(id); |
130 } | 130 } |
131 | 131 |
132 DEFINE_TRACE(SVGTreeScopeResources) { | 132 DEFINE_TRACE(SVGTreeScopeResources) { |
133 visitor->trace(m_pendingResources); | 133 visitor->trace(m_pendingResources); |
134 } | 134 } |
135 } | 135 } |
OLD | NEW |