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

Unified Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 2473483004: Simplify SVG pending resource (re)validation (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp
index 851793682737676af7afe23fdbe3aa6d2465da2e..2c2a275a0dd3cc8c0dd4b7bf8167a532e37329e6 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -113,26 +113,29 @@ void SVGElement::buildPendingResourcesIfNeeded() {
AtomicString resourceId = getIdAttribute();
if (!extensions.hasPendingResource(resourceId))
return;
+ // Guaranteed by hasPendingResource.
+ DCHECK(!resourceId.isEmpty());
- // Mark pending resources as pending for removal.
- extensions.markPendingResourcesForRemoval(resourceId);
+ // Get pending elements for this id.
+ SVGDocumentExtensions::SVGPendingElements* pendingElements =
+ extensions.removePendingResource(resourceId);
+ if (!pendingElements || pendingElements->isEmpty())
+ return;
// Rebuild pending resources for each client of a pending resource that is
// being removed.
- while (
- Element* clientElement =
- extensions.removeElementFromPendingResourcesForRemoval(resourceId)) {
- ASSERT(clientElement->hasPendingResources());
- if (clientElement->hasPendingResources()) {
- // FIXME: Ideally we'd always resolve pending resources async instead of
- // inside insertedInto and svgAttributeChanged. For now we only do it for
- // <use> since that would stamp out DOM.
- if (isSVGUseElement(clientElement))
- toSVGUseElement(clientElement)->invalidateShadowTree();
- else
- clientElement->buildPendingResource();
- extensions.clearHasPendingResourcesIfPossible(clientElement);
- }
+ for (Element* clientElement : *pendingElements) {
+ DCHECK(clientElement->hasPendingResources());
+ if (!clientElement->hasPendingResources())
+ continue;
+ // TODO(fs): Ideally we'd always resolve pending resources async instead of
+ // inside insertedInto and svgAttributeChanged. For now we only do it for
+ // <use> since that would stamp out DOM.
+ if (isSVGUseElement(clientElement))
+ toSVGUseElement(clientElement)->invalidateShadowTree();
+ else
+ clientElement->buildPendingResource();
+ extensions.clearHasPendingResourcesIfPossible(clientElement);
}
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698