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

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

Issue 993013002: Perspective property should only allow positive lengths (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « LayoutTests/transforms/webkit-perspective-parsing.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index 0b8df4c88135ebd2ba29e633c737f826baf32011..ab038e5ef4e465625f0993d9e3fcaf08d855d893 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1153,18 +1153,28 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyPerspective:
if (id == CSSValueNone) {
validPrimitive = true;
- } else if (validUnit(value, FLength | FNonNeg)) {
- addProperty(propId, createPrimitiveNumericValue(value), important);
- return true;
+ } else {
+ bool isCalculationValue = isCalculation(value);
+ if (validUnit(value, FLength)) {
+ if (isCalculationValue || value->fValue > 0) {
+ addProperty(propId, createPrimitiveNumericValue(value), important);
+ return true;
+ }
+ }
alancutter (OOO until 2018) 2015/03/16 23:33:15 This can probably be simplified as: if (id == CSSV
}
break;
case CSSPropertyWebkitPerspective:
if (id == CSSValueNone) {
validPrimitive = true;
- } else if (validUnit(value, FNumber | FLength | FNonNeg)) {
- // Accepting valueless numbers is a quirk of the -webkit prefixed version of the property.
- addProperty(propId, createPrimitiveNumericValue(value), important);
- return true;
+ } else {
+ bool isCalculationValue = isCalculation(value);
+ if (validUnit(value, FNumber | FLength)) {
+ if (isCalculationValue || value->fValue > 0) {
+ // Accepting valueless numbers is a quirk of the -webkit prefixed version of the property.
+ addProperty(propId, createPrimitiveNumericValue(value), important);
+ return true;
+ }
+ }
}
break;
case CSSPropertyPerspectiveOrigin:
« no previous file with comments | « LayoutTests/transforms/webkit-perspective-parsing.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698