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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2484153003: Use an SVGElementProxy in ReferenceClipPathOperation (Closed)
Patch Set: Rebase; fix comments; findElement 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 convertLengthOrAuto(state, *rect.bottom()), 131 convertLengthOrAuto(state, *rect.bottom()),
132 convertLengthOrAuto(state, *rect.left())); 132 convertLengthOrAuto(state, *rect.left()));
133 } 133 }
134 134
135 PassRefPtr<ClipPathOperation> StyleBuilderConverter::convertClipPath( 135 PassRefPtr<ClipPathOperation> StyleBuilderConverter::convertClipPath(
136 StyleResolverState& state, 136 StyleResolverState& state,
137 const CSSValue& value) { 137 const CSSValue& value) {
138 if (value.isBasicShapeValue()) 138 if (value.isBasicShapeValue())
139 return ShapeClipPathOperation::create(basicShapeForValue(state, value)); 139 return ShapeClipPathOperation::create(basicShapeForValue(state, value));
140 if (value.isURIValue()) { 140 if (value.isURIValue()) {
141 SVGURLReferenceResolver resolver(toCSSURIValue(value).value(), 141 const CSSURIValue& urlValue = toCSSURIValue(value);
142 state.document()); 142 SVGElementProxy& elementProxy =
143 // If the reference is non-local, then the fragment will remain as a 143 state.elementStyleResources().cachedOrPendingFromValue(urlValue);
144 // null string, which makes the element lookup fail. 144 // TODO(fs): Doesn't work with external SVG references (crbug.com/109212.)
145 AtomicString fragmentIdentifier; 145 return ReferenceClipPathOperation::create(urlValue.value(), elementProxy);
146 if (resolver.isLocal())
147 fragmentIdentifier = resolver.fragmentIdentifier();
148 // TODO(fs): Doesn't work with forward or external SVG references
149 // (crbug.com/391604, crbug.com/109212, ...)
150 return ReferenceClipPathOperation::create(toCSSURIValue(value).value(),
151 fragmentIdentifier);
152 } 146 }
153 DCHECK(value.isIdentifierValue() && 147 DCHECK(value.isIdentifierValue() &&
154 toCSSIdentifierValue(value).getValueID() == CSSValueNone); 148 toCSSIdentifierValue(value).getValueID() == CSSValueNone);
155 return nullptr; 149 return nullptr;
156 } 150 }
157 151
158 FilterOperations StyleBuilderConverter::convertFilterOperations( 152 FilterOperations StyleBuilderConverter::convertFilterOperations(
159 StyleResolverState& state, 153 StyleResolverState& state,
160 const CSSValue& value) { 154 const CSSValue& value) {
161 return FilterOperationResolver::createFilterOperations(state, value); 155 return FilterOperationResolver::createFilterOperations(state, value);
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 // Instead of the actual zoom, use 1 to avoid potential rounding errors 1290 // Instead of the actual zoom, use 1 to avoid potential rounding errors
1297 Length length = primitiveValue.convertToLength( 1291 Length length = primitiveValue.convertToLength(
1298 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); 1292 state.cssToLengthConversionData().copyWithAdjustedZoom(1));
1299 return *CSSPrimitiveValue::create(length, 1); 1293 return *CSSPrimitiveValue::create(length, 1);
1300 } 1294 }
1301 } 1295 }
1302 return value; 1296 return value;
1303 } 1297 }
1304 1298
1305 } // namespace blink 1299 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698