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

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

Issue 2746933002: Refactor <paint> URL resolution in SVGResources (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | 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 f33e7b81e96a0415194e0135a7bae17f4233b110..de77474a87f16daf29c81530e1308d7d0fbad5a3 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
@@ -138,24 +138,13 @@ static inline bool svgPaintTypeHasURL(SVGPaintType paintType) {
static inline LayoutSVGResourcePaintServer* paintingResourceFromSVGPaint(
TreeScope& treeScope,
- const SVGPaintType& paintType,
const String& paintUri,
- AtomicString& id,
- bool& hasPendingResource) {
- if (!svgPaintTypeHasURL(paintType))
- return nullptr;
-
+ AtomicString& id) {
id = SVGURIReference::fragmentIdentifierFromIRIString(paintUri, treeScope);
LayoutSVGResourceContainer* container =
treeScope.ensureSVGTreeScopedResources().resourceById(id);
- if (!container) {
- hasPendingResource = true;
- return nullptr;
- }
-
- if (!container->isSVGPaintServer())
+ if (!container || !container->isSVGPaintServer())
return nullptr;
-
return toLayoutSVGResourcePaintServer(container);
}
@@ -255,23 +244,19 @@ std::unique_ptr<SVGResources> SVGResources::buildResources(
}
if (fillAndStrokeTags().contains(tagName)) {
- if (style.hasFill()) {
- bool hasPendingResource = false;
+ if (style.hasFill() && svgPaintTypeHasURL(style.fillPaintType())) {
AtomicString id;
- LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPaint(
- treeScope, style.fillPaintType(), style.fillPaintUri(), id,
- hasPendingResource);
- if (!ensureResources(resources).setFill(resource) && hasPendingResource)
+ LayoutSVGResourcePaintServer* resource =
+ paintingResourceFromSVGPaint(treeScope, style.fillPaintUri(), id);
+ if (!ensureResources(resources).setFill(resource))
treeScopeResources.addPendingResource(id, element);
}
- if (style.hasStroke()) {
- bool hasPendingResource = false;
+ if (style.hasStroke() && svgPaintTypeHasURL(style.strokePaintType())) {
AtomicString id;
- LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPaint(
- treeScope, style.strokePaintType(), style.strokePaintUri(), id,
- hasPendingResource);
- if (!ensureResources(resources).setStroke(resource) && hasPendingResource)
+ LayoutSVGResourcePaintServer* resource =
+ paintingResourceFromSVGPaint(treeScope, style.strokePaintUri(), id);
+ if (!ensureResources(resources).setStroke(resource))
treeScopeResources.addPendingResource(id, element);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698