| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/SVGElementProxy.h" | 5 #include "core/svg/SVGElementProxy.h" |
| 6 | 6 |
| 7 #include "core/dom/IdTargetObserver.h" | 7 #include "core/dom/IdTargetObserver.h" |
| 8 #include "core/fetch/FetchInitiatorTypeNames.h" | 8 #include "core/fetch/FetchInitiatorTypeNames.h" |
| 9 #include "core/fetch/FetchRequest.h" | 9 #include "core/fetch/FetchRequest.h" |
| 10 #include "core/fetch/ResourceFetcher.h" | 10 #include "core/fetch/ResourceFetcher.h" |
| 11 #include "core/svg/SVGElement.h" | 11 #include "core/svg/SVGElement.h" |
| 12 #include "core/svg/SVGFilterElement.h" | |
| 13 #include "core/svg/SVGResourceClient.h" | 12 #include "core/svg/SVGResourceClient.h" |
| 14 | 13 |
| 15 namespace blink { | 14 namespace blink { |
| 16 | 15 |
| 17 class SVGElementProxy::IdObserver : public IdTargetObserver { | 16 class SVGElementProxy::IdObserver : public IdTargetObserver { |
| 18 public: | 17 public: |
| 19 IdObserver(TreeScope& treeScope, SVGElementProxy& proxy) | 18 IdObserver(TreeScope& treeScope, SVGElementProxy& proxy) |
| 20 : IdTargetObserver(treeScope.idTargetObserverRegistry(), proxy.id()), | 19 : IdTargetObserver(treeScope.idTargetObserverRegistry(), proxy.id()), |
| 21 m_treeScope(&treeScope) {} | 20 m_treeScope(&treeScope) {} |
| 22 | 21 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 149 } |
| 151 | 150 |
| 152 SVGElement* SVGElementProxy::findElement(TreeScope& treeScope) { | 151 SVGElement* SVGElementProxy::findElement(TreeScope& treeScope) { |
| 153 // An empty id will never be a valid element reference. | 152 // An empty id will never be a valid element reference. |
| 154 if (m_id.isEmpty()) | 153 if (m_id.isEmpty()) |
| 155 return nullptr; | 154 return nullptr; |
| 156 TreeScope* lookupScope = treeScopeForLookup(treeScope); | 155 TreeScope* lookupScope = treeScopeForLookup(treeScope); |
| 157 if (!lookupScope) | 156 if (!lookupScope) |
| 158 return nullptr; | 157 return nullptr; |
| 159 if (Element* targetElement = lookupScope->getElementById(m_id)) { | 158 if (Element* targetElement = lookupScope->getElementById(m_id)) { |
| 160 if (isSVGFilterElement(*targetElement)) { | 159 SVGElementProxySet* proxySet = |
| 161 toSVGFilterElement(*targetElement).elementProxySet().add(*this); | 160 targetElement->isSVGElement() |
| 161 ? toSVGElement(targetElement)->elementProxySet() |
| 162 : nullptr; |
| 163 if (proxySet) { |
| 164 proxySet->add(*this); |
| 162 return toSVGElement(targetElement); | 165 return toSVGElement(targetElement); |
| 163 } | 166 } |
| 164 } | 167 } |
| 165 return nullptr; | 168 return nullptr; |
| 166 } | 169 } |
| 167 | 170 |
| 168 void SVGElementProxy::contentChanged(TreeScope& treeScope) { | 171 void SVGElementProxy::contentChanged(TreeScope& treeScope) { |
| 169 if (auto* observer = m_observers.get(&treeScope)) | 172 if (auto* observer = m_observers.get(&treeScope)) |
| 170 observer->contentChanged(); | 173 observer->contentChanged(); |
| 171 } | 174 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 187 void SVGElementProxySet::notifyContentChanged(TreeScope& treeScope) { | 190 void SVGElementProxySet::notifyContentChanged(TreeScope& treeScope) { |
| 188 for (SVGElementProxy* proxy : m_elementProxies) | 191 for (SVGElementProxy* proxy : m_elementProxies) |
| 189 proxy->contentChanged(treeScope); | 192 proxy->contentChanged(treeScope); |
| 190 } | 193 } |
| 191 | 194 |
| 192 DEFINE_TRACE(SVGElementProxySet) { | 195 DEFINE_TRACE(SVGElementProxySet) { |
| 193 visitor->trace(m_elementProxies); | 196 visitor->trace(m_elementProxies); |
| 194 } | 197 } |
| 195 | 198 |
| 196 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |