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

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

Issue 1225553002: CSSValue Immediates: Make CSSPrimitiveValue a container (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_1
Patch Set: Rebase Created 5 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
« no previous file with comments | « Source/core/css/resolver/CSSToStyleMap.cpp ('k') | Source/core/css/resolver/StyleBuilderConverter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/FilterOperationResolver.cpp
diff --git a/Source/core/css/resolver/FilterOperationResolver.cpp b/Source/core/css/resolver/FilterOperationResolver.cpp
index 348c7a09854c42c3501c04de589a8248fd2c2d48..055ae7befb5aa98a13c4e25f8cfee786e077784d 100644
--- a/Source/core/css/resolver/FilterOperationResolver.cpp
+++ b/Source/core/css/resolver/FilterOperationResolver.cpp
@@ -76,7 +76,7 @@ bool FilterOperationResolver::createFilterOperations(CSSValue inValue, const CSS
ASSERT(outOperations.isEmpty());
if (inValue.isPrimitiveValue()) {
- CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(inValue);
+ CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(inValue);
if (primitiveValue.getValueID() == CSSValueNone)
return true;
}
@@ -125,15 +125,15 @@ bool FilterOperationResolver::createFilterOperations(CSSValue inValue, const CSS
continue;
}
- CSSPrimitiveValue* firstValue = filterValue.length() && filterValue.item(0).isPrimitiveValue() ? &toCSSPrimitiveValue(filterValue.item(0)) : 0;
+ NullableCSSValue firstValue = filterValue.length() && filterValue.item(0).isPrimitiveValue() ? NullableCSSValue(filterValue.item(0)) : nullptr;
switch (filterValue.functionType()) {
case CSSValueGrayscale:
case CSSValueSepia:
case CSSValueSaturate: {
double amount = 1;
if (filterValue.length() == 1) {
- amount = firstValue->getDoubleValue();
- if (firstValue->isPercentage())
+ amount = toCSSPrimitiveValue(*firstValue).getDoubleValue();
+ if (toCSSPrimitiveValue(*firstValue).isPercentage())
amount /= 100;
}
@@ -143,7 +143,7 @@ bool FilterOperationResolver::createFilterOperations(CSSValue inValue, const CSS
case CSSValueHueRotate: {
double angle = 0;
if (filterValue.length() == 1)
- angle = firstValue->computeDegrees();
+ angle = toCSSPrimitiveValue(*firstValue).computeDegrees();
operations.operations().append(BasicColorMatrixFilterOperation::create(angle, operationType));
break;
@@ -154,8 +154,8 @@ bool FilterOperationResolver::createFilterOperations(CSSValue inValue, const CSS
case CSSValueOpacity: {
double amount = (filterValue.functionType() == CSSValueBrightness) ? 0 : 1;
if (filterValue.length() == 1) {
- amount = firstValue->getDoubleValue();
- if (firstValue->isPercentage())
+ amount = toCSSPrimitiveValue(*firstValue).getDoubleValue();
+ if (toCSSPrimitiveValue(*firstValue).isPercentage())
amount /= 100;
}
@@ -165,7 +165,7 @@ bool FilterOperationResolver::createFilterOperations(CSSValue inValue, const CSS
case CSSValueBlur: {
Length stdDeviation = Length(0, Fixed);
if (filterValue.length() >= 1)
- stdDeviation = firstValue->convertToLength(conversionData);
+ stdDeviation = toCSSPrimitiveValue(*firstValue).convertToLength(conversionData);
operations.operations().append(BlurFilterOperation::create(stdDeviation));
break;
}
@@ -178,11 +178,11 @@ bool FilterOperationResolver::createFilterOperations(CSSValue inValue, const CSS
continue;
CSSShadowValue& item = toCSSShadowValue(cssValue);
- IntPoint location(item.x->computeLength<int>(conversionData), item.y->computeLength<int>(conversionData));
- int blur = item.blur ? item.blur->computeLength<int>(conversionData) : 0;
+ IntPoint location(toCSSPrimitiveValue(*item.x).computeLength<int>(conversionData), toCSSPrimitiveValue(*item.y).computeLength<int>(conversionData));
+ int blur = item.blur ? toCSSPrimitiveValue(*item.blur).computeLength<int>(conversionData) : 0;
Color shadowColor = Color::black;
if (item.color)
- shadowColor = state.document().textLinkColors().colorFromPrimitiveValue(*item.color.get(), state.style()->color());
+ shadowColor = state.document().textLinkColors().colorFromPrimitiveValue(toCSSPrimitiveValue(*item.color), state.style()->color());
operations.operations().append(DropShadowFilterOperation::create(location, blur, shadowColor));
break;
« no previous file with comments | « Source/core/css/resolver/CSSToStyleMap.cpp ('k') | Source/core/css/resolver/StyleBuilderConverter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698