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

Unified Diff: third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp

Issue 2165833006: Merge CSSSVGDocumentValue with CSSURIValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixup FilterInterpolationFunctions Created 4 years, 5 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/css/resolver/FilterOperationResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp b/third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp
index d41a8cfe79af2de57cee6ad81d6c7a4ea327bfc7..5f1a77734e78cc6881f45212d6dd7044236edb54 100644
--- a/third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp
@@ -31,6 +31,7 @@
#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSShadowValue.h"
+#include "core/css/CSSURIValue.h"
#include "core/css/resolver/StyleResolverState.h"
#include "core/frame/UseCounter.h"
#include "core/layout/svg/ReferenceFilterBuilder.h"
@@ -40,8 +41,6 @@ namespace blink {
FilterOperation::OperationType FilterOperationResolver::filterOperationForType(CSSValueID type)
{
switch (type) {
- case CSSValueUrl:
- return FilterOperation::REFERENCE;
case CSSValueGrayscale:
return FilterOperation::GRAYSCALE;
case CSSValueSepia:
@@ -127,26 +126,28 @@ FilterOperations FilterOperationResolver::createFilterOperations(StyleResolverSt
const CSSToLengthConversionData& conversionData = state.cssToLengthConversionData();
for (auto& currValue : toCSSValueList(inValue)) {
- const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get());
- FilterOperation::OperationType operationType = filterOperationForType(filterValue->functionType());
- countFilterUse(operationType, state.document());
- ASSERT(filterValue->length() <= 1);
+ if (currValue->isURIValue()) {
+ countFilterUse(FilterOperation::REFERENCE, state.document());
- if (operationType == FilterOperation::REFERENCE) {
- const CSSSVGDocumentValue& svgDocumentValue = toCSSSVGDocumentValue(filterValue->item(0));
- KURL url = state.document().completeURL(svgDocumentValue.url());
+ const CSSURIValue& urlValue = toCSSURIValue(*currValue);
+ KURL url = state.document().completeURL(urlValue.url());
- ReferenceFilterOperation* operation = ReferenceFilterOperation::create(svgDocumentValue.url(), AtomicString(url.fragmentIdentifier()));
+ ReferenceFilterOperation* operation = ReferenceFilterOperation::create(urlValue.url(), AtomicString(url.fragmentIdentifier()));
if (!equalIgnoringFragmentIdentifier(url, state.document().url())) {
- if (!svgDocumentValue.loadRequested())
- state.elementStyleResources().addPendingSVGDocument(operation, &svgDocumentValue);
- else if (svgDocumentValue.cachedSVGDocument())
- ReferenceFilterBuilder::setDocumentResourceReference(operation, new DocumentResourceReference(svgDocumentValue.cachedSVGDocument()));
+ if (!urlValue.loadRequested())
+ state.elementStyleResources().addPendingSVGDocument(operation, &urlValue);
+ else if (urlValue.cachedDocument())
+ ReferenceFilterBuilder::setDocumentResourceReference(operation, new DocumentResourceReference(urlValue.cachedDocument()));
}
operations.operations().append(operation);
continue;
}
+ const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get());
+ FilterOperation::OperationType operationType = filterOperationForType(filterValue->functionType());
+ countFilterUse(operationType, state.document());
+ DCHECK_LE(filterValue->length(), 1u);
+
const CSSPrimitiveValue* firstValue = filterValue->length() && filterValue->item(0).isPrimitiveValue() ? &toCSSPrimitiveValue(filterValue->item(0)) : nullptr;
switch (filterValue->functionType()) {
case CSSValueGrayscale:

Powered by Google App Engine
This is Rietveld 408576698