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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 2052883002: Clamp filter functions {grayscale, invert, opacity, sepia} to 100% (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@filter-js-tests
Patch Set: Additional test fixup Created 4 years, 6 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 | « third_party/WebKit/LayoutTests/css3/filters/filter-property-parsing-invalid.html ('k') | 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/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 199002ba26900add3c16777b503e180bdda07e81..90d4462a74cae8cd2715c52fe25163a01d684766 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1455,9 +1455,13 @@ static CSSFunctionValue* consumeFilterFunction(CSSParserTokenRange& range, CSSPa
if (!parsedValue)
parsedValue = consumeNumber(args, ValueRangeNonNegative);
if (parsedValue && filterType != CSSValueSaturate && filterType != CSSValueContrast) {
- double maxAllowed = toCSSPrimitiveValue(parsedValue)->isPercentage() ? 100.0 : 1.0;
- if (toCSSPrimitiveValue(parsedValue)->getDoubleValue() > maxAllowed)
- return nullptr;
+ bool isPercentage = toCSSPrimitiveValue(parsedValue)->isPercentage();
+ double maxAllowed = isPercentage ? 100.0 : 1.0;
+ if (toCSSPrimitiveValue(parsedValue)->getDoubleValue() > maxAllowed) {
+ parsedValue = CSSPrimitiveValue::create(
+ maxAllowed,
+ isPercentage ? CSSPrimitiveValue::UnitType::Percentage : CSSPrimitiveValue::UnitType::Number);
+ }
}
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/filters/filter-property-parsing-invalid.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698