| 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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 void SVGTreeScopeResources::removeResource(const AtomicString& id) { | 57 void SVGTreeScopeResources::removeResource(const AtomicString& id) { |
| 58 if (id.isEmpty()) | 58 if (id.isEmpty()) |
| 59 return; | 59 return; |
| 60 m_resources.erase(id); | 60 m_resources.erase(id); |
| 61 } | 61 } |
| 62 | 62 |
| 63 LayoutSVGResourceContainer* SVGTreeScopeResources::resourceById( | 63 LayoutSVGResourceContainer* SVGTreeScopeResources::resourceById( |
| 64 const AtomicString& id) const { | 64 const AtomicString& id) const { |
| 65 if (id.isEmpty()) | 65 if (id.isEmpty()) |
| 66 return nullptr; | 66 return nullptr; |
| 67 return m_resources.get(id); | 67 return m_resources.at(id); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void SVGTreeScopeResources::addPendingResource(const AtomicString& id, | 70 void SVGTreeScopeResources::addPendingResource(const AtomicString& id, |
| 71 Element* element) { | 71 Element* element) { |
| 72 DCHECK(element); | 72 DCHECK(element); |
| 73 DCHECK(element->isConnected()); | 73 DCHECK(element->isConnected()); |
| 74 | 74 |
| 75 if (id.isEmpty()) | 75 if (id.isEmpty()) |
| 76 return; | 76 return; |
| 77 | 77 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 105 } | 105 } |
| 106 return false; | 106 return false; |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool SVGTreeScopeResources::isElementPendingResource( | 109 bool SVGTreeScopeResources::isElementPendingResource( |
| 110 Element* element, | 110 Element* element, |
| 111 const AtomicString& id) const { | 111 const AtomicString& id) const { |
| 112 DCHECK(element); | 112 DCHECK(element); |
| 113 if (!hasPendingResource(id)) | 113 if (!hasPendingResource(id)) |
| 114 return false; | 114 return false; |
| 115 return m_pendingResources.get(id)->contains(element); | 115 return m_pendingResources.at(id)->contains(element); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void SVGTreeScopeResources::clearHasPendingResourcesIfPossible( | 118 void SVGTreeScopeResources::clearHasPendingResourcesIfPossible( |
| 119 Element* element) { | 119 Element* element) { |
| 120 if (!isElementPendingResources(element)) | 120 if (!isElementPendingResources(element)) |
| 121 element->clearHasPendingResources(); | 121 element->clearHasPendingResources(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void SVGTreeScopeResources::removeElementFromPendingResources( | 124 void SVGTreeScopeResources::removeElementFromPendingResources( |
| 125 Element* element) { | 125 Element* element) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 clientElement->buildPendingResource(); | 175 clientElement->buildPendingResource(); |
| 176 | 176 |
| 177 clearHasPendingResourcesIfPossible(clientElement); | 177 clearHasPendingResourcesIfPossible(clientElement); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 DEFINE_TRACE(SVGTreeScopeResources) { | 181 DEFINE_TRACE(SVGTreeScopeResources) { |
| 182 visitor->trace(m_pendingResources); | 182 visitor->trace(m_pendingResources); |
| 183 } | 183 } |
| 184 } | 184 } |
| OLD | NEW |