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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.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
Index: third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp b/third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp
index 659966d0c7f641e802b619d249ed9d8d1b00cedf..8907cbac4f072df3e9c49b627ede9d91c2b82791 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp
@@ -708,6 +708,9 @@ void writeSVGGradientStop(TextStream& ts,
void writeResources(TextStream& ts, const LayoutObject& object, int indent) {
const ComputedStyle& style = object.styleRef();
const SVGComputedStyle& svgStyle = style.svgStyle();
+ TreeScope& treeScope = object.document();
+ SVGTreeScopeResources& treeScopeResources =
+ treeScope.ensureSVGTreeScopedResources();
// FIXME: We want to use SVGResourcesCache to determine which resources are
// present, instead of quering the resource <-> id cache.
@@ -716,7 +719,7 @@ void writeResources(TextStream& ts, const LayoutObject& object, int indent) {
if (!svgStyle.maskerResource().isEmpty()) {
if (LayoutSVGResourceMasker* masker =
getLayoutSVGResourceById<LayoutSVGResourceMasker>(
- object.document(), svgStyle.maskerResource())) {
+ treeScopeResources, svgStyle.maskerResource())) {
writeIndent(ts, indent);
ts << " ";
writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource());
@@ -730,10 +733,10 @@ void writeResources(TextStream& ts, const LayoutObject& object, int indent) {
const ReferenceClipPathOperation& clipPathReference =
toReferenceClipPathOperation(*clipPathOperation);
AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString(
- clipPathReference.url(), object.document());
+ clipPathReference.url(), treeScope);
if (LayoutSVGResourceClipper* clipper =
getLayoutSVGResourceById<LayoutSVGResourceClipper>(
- object.document(), id)) {
+ treeScopeResources, id)) {
writeIndent(ts, indent);
ts << " ";
writeNameAndQuotedValue(ts, "clipPath", id);
@@ -752,10 +755,10 @@ void writeResources(TextStream& ts, const LayoutObject& object, int indent) {
const auto& referenceFilterOperation =
toReferenceFilterOperation(filterOperation);
AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString(
- referenceFilterOperation.url(), object.document());
+ referenceFilterOperation.url(), treeScope);
if (LayoutSVGResourceFilter* filter =
getLayoutSVGResourceById<LayoutSVGResourceFilter>(
- object.document(), id)) {
+ treeScopeResources, id)) {
writeIndent(ts, indent);
ts << " ";
writeNameAndQuotedValue(ts, "filter", id);

Powered by Google App Engine
This is Rietveld 408576698