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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/transforms/webkit-perspective-parsing.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 case CSSPropertyWebkitPerspectiveOriginY: 1144 case CSSPropertyWebkitPerspectiveOriginY:
1145 case CSSPropertyWebkitTransformOriginY: 1145 case CSSPropertyWebkitTransformOriginY:
1146 parsedValue = parseFillPositionY(m_valueList); 1146 parsedValue = parseFillPositionY(m_valueList);
1147 if (parsedValue) 1147 if (parsedValue)
1148 m_valueList->next(); 1148 m_valueList->next();
1149 break; 1149 break;
1150 case CSSPropertyWebkitTransformOriginZ: 1150 case CSSPropertyWebkitTransformOriginZ:
1151 validPrimitive = validUnit(value, FLength); 1151 validPrimitive = validUnit(value, FLength);
1152 break; 1152 break;
1153 case CSSPropertyPerspective: 1153 case CSSPropertyPerspective:
1154 if (id == CSSValueNone) { 1154 if (id == CSSValueNone)
1155 validPrimitive = true; 1155 validPrimitive = true;
1156 } else if (validUnit(value, FLength | FNonNeg)) { 1156 else if (validUnit(value, FLength) && (m_parsedCalculation || value->fVa lue > 0))
1157 addProperty(propId, createPrimitiveNumericValue(value), important); 1157 validPrimitive = true;
1158 return true; 1158 else
1159 } 1159 return false;
1160 break; 1160 break;
1161 case CSSPropertyWebkitPerspective: 1161 case CSSPropertyWebkitPerspective:
1162 if (id == CSSValueNone) { 1162 if (id == CSSValueNone)
1163 validPrimitive = true; 1163 validPrimitive = true;
1164 } else if (validUnit(value, FNumber | FLength | FNonNeg)) { 1164 else if (validUnit(value, FNumber | FLength) && (m_parsedCalculation || value->fValue > 0))
1165 // Accepting valueless numbers is a quirk of the -webkit prefixed ve rsion of the property. 1165 validPrimitive = true;
1166 addProperty(propId, createPrimitiveNumericValue(value), important); 1166 else
1167 return true; 1167 return false;
1168 }
1169 break; 1168 break;
1170 case CSSPropertyPerspectiveOrigin: 1169 case CSSPropertyPerspectiveOrigin:
1171 case CSSPropertyWebkitPerspectiveOrigin: { 1170 case CSSPropertyWebkitPerspectiveOrigin: {
1172 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin(); 1171 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin();
1173 if (!list || list->length() == 3) 1172 if (!list || list->length() == 3)
1174 return false; 1173 return false;
1175 // This values are added to match gecko serialization. 1174 // This values are added to match gecko serialization.
1176 if (list->length() == 1) 1175 if (list->length() == 1)
1177 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE)); 1176 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE));
1178 addProperty(propId, list.release(), important); 1177 addProperty(propId, list.release(), important);
(...skipping 7312 matching lines...) Expand 10 before | Expand all | Expand 10 after
8491 } 8490 }
8492 } 8491 }
8493 8492
8494 if (!list->length()) 8493 if (!list->length())
8495 return nullptr; 8494 return nullptr;
8496 8495
8497 return list.release(); 8496 return list.release();
8498 } 8497 }
8499 8498
8500 } // namespace blink 8499 } // namespace blink
OLDNEW
« 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