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

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: Patch for landing 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 c5438e59cfb3ba9ba89630151029ebf73dba8e16..d99e0d96d7216fc0bffffc409e492f75c778380b 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1151,21 +1151,20 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
validPrimitive = validUnit(value, FLength);
break;
case CSSPropertyPerspective:
- if (id == CSSValueNone) {
+ if (id == CSSValueNone)
validPrimitive = true;
- } else if (validUnit(value, FLength | FNonNeg)) {
- addProperty(propId, createPrimitiveNumericValue(value), important);
- return true;
- }
+ else if (validUnit(value, FLength) && (m_parsedCalculation || value->fValue > 0))
+ validPrimitive = true;
+ else
+ return false;
break;
case CSSPropertyWebkitPerspective:
- if (id == CSSValueNone) {
+ 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 if (validUnit(value, FNumber | FLength) && (m_parsedCalculation || value->fValue > 0))
+ validPrimitive = true;
+ else
+ return false;
break;
case CSSPropertyPerspectiveOrigin:
case CSSPropertyWebkitPerspectiveOrigin: {
« 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