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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGResources.cpp

Issue 2708543003: Clean up the getLayoutSVGResource*ById helpers (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.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/layout/svg/SVGResources.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
index 95c9032bec5b44ae4b5d8a2eb2fbb5ca5917b0cc..18af003d4469bdcfa292252c11d1e8625f0c0c49 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
@@ -147,7 +147,7 @@ static inline LayoutSVGResourcePaintServer* paintingResourceFromSVGPaint(
id = SVGURIReference::fragmentIdentifierFromIRIString(paintUri, treeScope);
LayoutSVGResourceContainer* container =
- getLayoutSVGResourceContainerById(treeScope, id);
+ treeScope.ensureSVGTreeScopedResources().resourceById(id);
if (!container) {
hasPendingResource = true;
return nullptr;
@@ -159,14 +159,6 @@ static inline LayoutSVGResourcePaintServer* paintingResourceFromSVGPaint(
return toLayoutSVGResourcePaintServer(container);
}
-static inline void registerPendingResource(
- SVGTreeScopeResources& treeScopeResources,
- const AtomicString& id,
- SVGElement* element) {
- DCHECK(element);
- treeScopeResources.addPendingResource(id, element);
-}
-
bool SVGResources::hasResourceData() const {
return m_clipperFilterMaskerData || m_markerData || m_fillStrokeData ||
m_linkedResource;
@@ -211,9 +203,9 @@ std::unique_ptr<SVGResources> SVGResources::buildResources(
AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString(
clipPathReference.url(), treeScope);
if (!ensureResources(resources).setClipper(
- getLayoutSVGResourceById<LayoutSVGResourceClipper>(treeScope,
- id)))
- registerPendingResource(treeScopeResources, id, element);
+ getLayoutSVGResourceById<LayoutSVGResourceClipper>(
+ treeScopeResources, id)))
+ treeScopeResources.addPendingResource(id, element);
}
}
@@ -227,9 +219,9 @@ std::unique_ptr<SVGResources> SVGResources::buildResources(
AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString(
referenceFilterOperation.url(), treeScope);
if (!ensureResources(resources).setFilter(
- getLayoutSVGResourceById<LayoutSVGResourceFilter>(treeScope,
- id)))
- registerPendingResource(treeScopeResources, id, element);
+ getLayoutSVGResourceById<LayoutSVGResourceFilter>(
+ treeScopeResources, id)))
+ treeScopeResources.addPendingResource(id, element);
}
}
}
@@ -237,29 +229,30 @@ std::unique_ptr<SVGResources> SVGResources::buildResources(
if (style.hasMasker()) {
AtomicString id = style.maskerResource();
if (!ensureResources(resources).setMasker(
- getLayoutSVGResourceById<LayoutSVGResourceMasker>(treeScope, id)))
- registerPendingResource(treeScopeResources, id, element);
+ getLayoutSVGResourceById<LayoutSVGResourceMasker>(
+ treeScopeResources, id)))
+ treeScopeResources.addPendingResource(id, element);
}
}
if (style.hasMarkers() && supportsMarkers(*element)) {
const AtomicString& markerStartId = style.markerStartResource();
if (!ensureResources(resources).setMarkerStart(
- getLayoutSVGResourceById<LayoutSVGResourceMarker>(treeScope,
- markerStartId)))
- registerPendingResource(treeScopeResources, markerStartId, element);
+ getLayoutSVGResourceById<LayoutSVGResourceMarker>(
+ treeScopeResources, markerStartId)))
+ treeScopeResources.addPendingResource(markerStartId, element);
const AtomicString& markerMidId = style.markerMidResource();
if (!ensureResources(resources).setMarkerMid(
- getLayoutSVGResourceById<LayoutSVGResourceMarker>(treeScope,
- markerMidId)))
- registerPendingResource(treeScopeResources, markerMidId, element);
+ getLayoutSVGResourceById<LayoutSVGResourceMarker>(
+ treeScopeResources, markerMidId)))
+ treeScopeResources.addPendingResource(markerMidId, element);
const AtomicString& markerEndId = style.markerEndResource();
if (!ensureResources(resources).setMarkerEnd(
getLayoutSVGResourceById<LayoutSVGResourceMarker>(
- treeScope, style.markerEndResource())))
- registerPendingResource(treeScopeResources, markerEndId, element);
+ treeScopeResources, markerEndId)))
+ treeScopeResources.addPendingResource(markerEndId, element);
}
if (fillAndStrokeTags().contains(tagName)) {
@@ -270,7 +263,7 @@ std::unique_ptr<SVGResources> SVGResources::buildResources(
treeScope, style.fillPaintType(), style.fillPaintUri(), id,
hasPendingResource);
if (!ensureResources(resources).setFill(resource) && hasPendingResource)
- registerPendingResource(treeScopeResources, id, element);
+ treeScopeResources.addPendingResource(id, element);
}
if (style.hasStroke()) {
@@ -280,15 +273,15 @@ std::unique_ptr<SVGResources> SVGResources::buildResources(
treeScope, style.strokePaintType(), style.strokePaintUri(), id,
hasPendingResource);
if (!ensureResources(resources).setStroke(resource) && hasPendingResource)
- registerPendingResource(treeScopeResources, id, element);
+ treeScopeResources.addPendingResource(id, element);
}
}
if (chainableResourceTags().contains(tagName)) {
AtomicString id = targetReferenceFromResource(*element);
if (!ensureResources(resources).setLinkedResource(
- getLayoutSVGResourceContainerById(treeScope, id)))
- registerPendingResource(treeScopeResources, id, element);
+ treeScopeResources.resourceById(id)))
+ treeScopeResources.addPendingResource(id, element);
}
return (!resources || !resources->hasResourceData()) ? nullptr
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698