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

Side by Side Diff: Source/core/css/CSSParser-in.cpp

Issue 71253002: Eliminate "FractionConversion" from CSSPrimitiveValue::convertToLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 1 month 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 | « Source/core/css/CSSCalculationValue.cpp ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('j') | 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 else if (isValidKeywordPropertyAndValue(propertyId, valueID, parserContext)) 1086 else if (isValidKeywordPropertyAndValue(propertyId, valueID, parserContext))
1087 value = cssValuePool().createIdentifierValue(valueID); 1087 value = cssValuePool().createIdentifierValue(valueID);
1088 else 1088 else
1089 return false; 1089 return false;
1090 1090
1091 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), impo rtant)); 1091 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), impo rtant));
1092 return true; 1092 return true;
1093 } 1093 }
1094 1094
1095 template <typename CharacterType> 1095 template <typename CharacterType>
1096 static bool parseTransformArguments(CSSTransformValue* transformValue, Character Type* characters, unsigned length, unsigned start, unsigned expectedCount) 1096 static bool parseTransformTranslateArguments(CSSTransformValue* transformValue, CharacterType* characters, unsigned length, unsigned start, unsigned expectedCou nt)
1097 { 1097 {
1098 while (expectedCount) { 1098 while (expectedCount) {
1099 size_t end = WTF::find(characters, length, expectedCount == 1 ? ')' : ', ', start); 1099 size_t end = WTF::find(characters, length, expectedCount == 1 ? ')' : ', ', start);
1100 if (end == kNotFound || (expectedCount == 1 && end != length - 1)) 1100 if (end == kNotFound || (expectedCount == 1 && end != length - 1))
1101 return false; 1101 return false;
1102 unsigned argumentLength = end - start; 1102 unsigned argumentLength = end - start;
1103 CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::CSS_NUMBER; 1103 CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::CSS_NUMBER;
1104 double number; 1104 double number;
1105 if (!parseSimpleLength(characters + start, argumentLength, unit, number) ) 1105 if (!parseSimpleLength(characters + start, argumentLength, unit, number) )
1106 return false; 1106 return false;
1107 if (unit != CSSPrimitiveValue::CSS_PX && (number || unit != CSSPrimitive Value::CSS_NUMBER)) 1107 if (unit != CSSPrimitiveValue::CSS_PX && (number || unit != CSSPrimitive Value::CSS_NUMBER))
1108 return false; 1108 return false;
1109 transformValue->append(cssValuePool().createValue(number, unit)); 1109 transformValue->append(cssValuePool().createValue(number, CSSPrimitiveVa lue::CSS_PX));
1110 start = end + 1; 1110 start = end + 1;
1111 --expectedCount; 1111 --expectedCount;
1112 } 1112 }
1113 return true; 1113 return true;
1114 } 1114 }
1115 1115
1116 static bool parseTranslateTransformValue(MutableStylePropertySet* properties, CS SPropertyID propertyID, const String& string, bool important) 1116 static bool parseTranslateTransformValue(MutableStylePropertySet* properties, CS SPropertyID propertyID, const String& string, bool important)
1117 { 1117 {
1118 if (propertyID != CSSPropertyWebkitTransform) 1118 if (propertyID != CSSPropertyWebkitTransform)
1119 return false; 1119 return false;
(...skipping 22 matching lines...) Expand all
1142 } else if (c9 == '3' && c10 == 'd' && string[11] == '(') { 1142 } else if (c9 == '3' && c10 == 'd' && string[11] == '(') {
1143 transformType = CSSTransformValue::Translate3DTransformOperation; 1143 transformType = CSSTransformValue::Translate3DTransformOperation;
1144 expectedArgumentCount = 3; 1144 expectedArgumentCount = 3;
1145 argumentStart = 12; 1145 argumentStart = 12;
1146 } else 1146 } else
1147 return false; 1147 return false;
1148 1148
1149 RefPtr<CSSTransformValue> transformValue = CSSTransformValue::create(transfo rmType); 1149 RefPtr<CSSTransformValue> transformValue = CSSTransformValue::create(transfo rmType);
1150 bool success; 1150 bool success;
1151 if (string.is8Bit()) 1151 if (string.is8Bit())
1152 success = parseTransformArguments(transformValue.get(), string.character s8(), string.length(), argumentStart, expectedArgumentCount); 1152 success = parseTransformTranslateArguments(transformValue.get(), string. characters8(), string.length(), argumentStart, expectedArgumentCount);
1153 else 1153 else
1154 success = parseTransformArguments(transformValue.get(), string.character s16(), string.length(), argumentStart, expectedArgumentCount); 1154 success = parseTransformTranslateArguments(transformValue.get(), string. characters16(), string.length(), argumentStart, expectedArgumentCount);
1155 if (!success) 1155 if (!success)
1156 return false; 1156 return false;
1157 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); 1157 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
1158 result->append(transformValue.release()); 1158 result->append(transformValue.release());
1159 properties->addParsedProperty(CSSProperty(CSSPropertyWebkitTransform, result .release(), important)); 1159 properties->addParsedProperty(CSSProperty(CSSPropertyWebkitTransform, result .release(), important));
1160 return true; 1160 return true;
1161 } 1161 }
1162 1162
1163 PassRefPtr<CSSValueList> CSSParser::parseFontFaceValue(const AtomicString& strin g) 1163 PassRefPtr<CSSValueList> CSSParser::parseFontFaceValue(const AtomicString& strin g)
1164 { 1164 {
(...skipping 10788 matching lines...) Expand 10 before | Expand all | Expand 10 after
11953 { 11953 {
11954 // The tokenizer checks for the construct of an+b. 11954 // The tokenizer checks for the construct of an+b.
11955 // However, since the {ident} rule precedes the {nth} rule, some of those 11955 // However, since the {ident} rule precedes the {nth} rule, some of those
11956 // tokens are identified as string literal. Furthermore we need to accept 11956 // tokens are identified as string literal. Furthermore we need to accept
11957 // "odd" and "even" which does not match to an+b. 11957 // "odd" and "even" which does not match to an+b.
11958 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 11958 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
11959 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 11959 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
11960 } 11960 }
11961 11961
11962 } 11962 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSCalculationValue.cpp ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698