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

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: Fix ASSERT 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
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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 | FNonNeg)) {
1157 addProperty(propId, createPrimitiveNumericValue(value), important); 1157 if (m_parsedCalculation ? m_parsedCalculation->isPositive() : value- >fValue > 0) {
1158 return true; 1158 addProperty(propId, createPrimitiveNumericValue(value), importan t);
1159 return true;
1160 }
1161 return false;
1159 } 1162 }
1160 break; 1163 break;
1161 case CSSPropertyWebkitPerspective: 1164 case CSSPropertyWebkitPerspective:
1162 if (id == CSSValueNone) { 1165 if (id == CSSValueNone) {
1163 validPrimitive = true; 1166 validPrimitive = true;
1164 } else if (validUnit(value, FNumber | FLength | FNonNeg)) { 1167 } else if (validUnit(value, FNumber | FLength | FNonNeg)) {
1165 // Accepting valueless numbers is a quirk of the -webkit prefixed ve rsion of the property. 1168 if (m_parsedCalculation ? m_parsedCalculation->isPositive() : value- >fValue > 0) {
1166 addProperty(propId, createPrimitiveNumericValue(value), important); 1169 // Accepting valueless numbers is a quirk of the -webkit prefixe d version of the property.
1167 return true; 1170 addProperty(propId, createPrimitiveNumericValue(value), importan t);
1171 return true;
1172 }
1173 return false;
1168 } 1174 }
1169 break; 1175 break;
1170 case CSSPropertyPerspectiveOrigin: 1176 case CSSPropertyPerspectiveOrigin:
1171 case CSSPropertyWebkitPerspectiveOrigin: { 1177 case CSSPropertyWebkitPerspectiveOrigin: {
1172 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin(); 1178 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin();
1173 if (!list || list->length() == 3) 1179 if (!list || list->length() == 3)
1174 return false; 1180 return false;
1175 // This values are added to match gecko serialization. 1181 // This values are added to match gecko serialization.
1176 if (list->length() == 1) 1182 if (list->length() == 1)
1177 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE)); 1183 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE));
(...skipping 7319 matching lines...) Expand 10 before | Expand all | Expand 10 after
8497 } 8503 }
8498 } 8504 }
8499 8505
8500 if (!list->length()) 8506 if (!list->length())
8501 return nullptr; 8507 return nullptr;
8502 8508
8503 return list.release(); 8509 return list.release();
8504 } 8510 }
8505 8511
8506 } // namespace blink 8512 } // namespace blink
OLDNEW
« Source/core/css/CSSCalculationValue.h ('K') | « Source/core/css/CSSCalculationValue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698