Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1162)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGTreeScopeResources.cpp

Issue 2710583005: Move SVGElement::buildPendingResourcesIfNeeded to SVGTreeScopeResources (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "wtf/text/AtomicString.h" 12 #include "wtf/text/AtomicString.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 SVGTreeScopeResources::SVGTreeScopeResources(TreeScope* treeScope) { 16 SVGTreeScopeResources::SVGTreeScopeResources(TreeScope* treeScope) {
16 // Whenever an object of SVGTreeScopeResources is created, to keep the code 17 // Whenever an object of SVGTreeScopeResources is created, to keep the code
17 // behave as before, 18 // behave as before,
18 // the document should also have an instance of SVGDocumentExtensions created. 19 // the document should also have an instance of SVGDocumentExtensions created.
19 // Thus below line is added. 20 // Thus below line is added.
20 treeScope->document().accessSVGExtensions(); 21 treeScope->document().accessSVGExtensions();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 removePendingResource(id); 146 removePendingResource(id);
146 } 147 }
147 } 148 }
148 149
149 SVGTreeScopeResources::SVGPendingElements* 150 SVGTreeScopeResources::SVGPendingElements*
150 SVGTreeScopeResources::removePendingResource(const AtomicString& id) { 151 SVGTreeScopeResources::removePendingResource(const AtomicString& id) {
151 DCHECK(m_pendingResources.contains(id)); 152 DCHECK(m_pendingResources.contains(id));
152 return m_pendingResources.take(id); 153 return m_pendingResources.take(id);
153 } 154 }
154 155
156 void SVGTreeScopeResources::notifyResourceAvailable(const AtomicString& id) {
157 if (id.isEmpty())
158 return;
159 // Get pending elements for this id.
160 SVGPendingElements* pendingElements = m_pendingResources.take(id);
161 if (!pendingElements)
162 return;
163 // Rebuild pending resources for each client of a pending resource that is
164 // being removed.
165 for (Element* clientElement : *pendingElements) {
166 DCHECK(clientElement->hasPendingResources());
167 if (!clientElement->hasPendingResources())
168 continue;
169 // TODO(fs): Ideally we'd always resolve pending resources async instead of
170 // inside insertedInto and svgAttributeChanged. For now we only do it for
171 // <use> since that would stamp out DOM.
172 if (isSVGUseElement(clientElement))
173 toSVGUseElement(clientElement)->invalidateShadowTree();
174 else
175 clientElement->buildPendingResource();
176
177 clearHasPendingResourcesIfPossible(clientElement);
178 }
179 }
180
155 DEFINE_TRACE(SVGTreeScopeResources) { 181 DEFINE_TRACE(SVGTreeScopeResources) {
156 visitor->trace(m_pendingResources); 182 visitor->trace(m_pendingResources);
157 } 183 }
158 } 184 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698