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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGElement.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 | « no previous file | third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // If the style changes because of a regular property change (not induced by 104 // If the style changes because of a regular property change (not induced by
105 // SMIL animations themselves) reset the "computed style without SMIL style 105 // SMIL animations themselves) reset the "computed style without SMIL style
106 // properties", so the base value change gets reflected. 106 // properties", so the base value change gets reflected.
107 if (change > NoChange || needsStyleRecalc()) 107 if (change > NoChange || needsStyleRecalc())
108 svgRareData()->setNeedsOverrideComputedStyleUpdate(); 108 svgRareData()->setNeedsOverrideComputedStyleUpdate();
109 } 109 }
110 110
111 void SVGElement::buildPendingResourcesIfNeeded() { 111 void SVGElement::buildPendingResourcesIfNeeded() {
112 if (!needsPendingResourceHandling() || !isConnected() || inUseShadowTree()) 112 if (!needsPendingResourceHandling() || !isConnected() || inUseShadowTree())
113 return; 113 return;
114 114 treeScope().ensureSVGTreeScopedResources().notifyResourceAvailable(
115 SVGTreeScopeResources& treeScopeResources = 115 getIdAttribute());
116 treeScope().ensureSVGTreeScopedResources();
117 AtomicString resourceId = getIdAttribute();
118 if (!treeScopeResources.hasPendingResource(resourceId))
119 return;
120 // Guaranteed by hasPendingResource.
121 DCHECK(!resourceId.isEmpty());
122
123 // Get pending elements for this id.
124 SVGTreeScopeResources::SVGPendingElements* pendingElements =
125 treeScopeResources.removePendingResource(resourceId);
126 if (!pendingElements || pendingElements->isEmpty())
127 return;
128
129 // Rebuild pending resources for each client of a pending resource that is
130 // being removed.
131 for (Element* clientElement : *pendingElements) {
132 DCHECK(clientElement->hasPendingResources());
133 if (!clientElement->hasPendingResources())
134 continue;
135 // TODO(fs): Ideally we'd always resolve pending resources async instead of
136 // inside insertedInto and svgAttributeChanged. For now we only do it for
137 // <use> since that would stamp out DOM.
138 if (isSVGUseElement(clientElement))
139 toSVGUseElement(clientElement)->invalidateShadowTree();
140 else
141 clientElement->buildPendingResource();
142 treeScopeResources.clearHasPendingResourcesIfPossible(clientElement);
143 }
144 } 116 }
145 117
146 SVGElementRareData* SVGElement::ensureSVGRareData() { 118 SVGElementRareData* SVGElement::ensureSVGRareData() {
147 if (hasSVGRareData()) 119 if (hasSVGRareData())
148 return svgRareData(); 120 return svgRareData();
149 121
150 m_SVGRareData = new SVGElementRareData(this); 122 m_SVGRareData = new SVGElementRareData(this);
151 return m_SVGRareData.get(); 123 return m_SVGRareData.get();
152 } 124 }
153 125
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 visitor->trace(m_className); 1274 visitor->trace(m_className);
1303 Element::trace(visitor); 1275 Element::trace(visitor);
1304 } 1276 }
1305 1277
1306 const AtomicString& SVGElement::eventParameterName() { 1278 const AtomicString& SVGElement::eventParameterName() {
1307 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1279 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1308 return evtString; 1280 return evtString;
1309 } 1281 }
1310 1282
1311 } // namespace blink 1283 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698