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

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

Issue 545173003: Support scientific notation in CSS numbers/percentages/dimensions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop parseSVGNumber; Add additional TC. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/parser/CSSParserMode.h ('k') | Source/core/svg/SVGParserUtilities.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 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 1232
1233 if (UNLIKELY(m_parsingMode == NthChildMode) && !dotSeen && isASCIIAlphaC aselessEqual(*currentCharacter<SrcCharacterType>(), 'n')) { 1233 if (UNLIKELY(m_parsingMode == NthChildMode) && !dotSeen && isASCIIAlphaC aselessEqual(*currentCharacter<SrcCharacterType>(), 'n')) {
1234 // "[0-9]+n" is always an NthChild. 1234 // "[0-9]+n" is always an NthChild.
1235 ++currentCharacter<SrcCharacterType>(); 1235 ++currentCharacter<SrcCharacterType>();
1236 parseNthChildExtra<SrcCharacterType>(); 1236 parseNthChildExtra<SrcCharacterType>();
1237 m_token = NTH; 1237 m_token = NTH;
1238 yylval->string.init(tokenStart<SrcCharacterType>(), currentCharacter <SrcCharacterType>() - tokenStart<SrcCharacterType>()); 1238 yylval->string.init(tokenStart<SrcCharacterType>(), currentCharacter <SrcCharacterType>() - tokenStart<SrcCharacterType>());
1239 break; 1239 break;
1240 } 1240 }
1241 1241
1242 // Use SVG parser for numbers on SVG presentation attributes. 1242 // We need to take care of units like 'em' or 'ex'.
1243 if (isSVGNumberParsingEnabledForMode(m_parser.m_context.mode())) { 1243 SrcCharacterType* character = currentCharacter<SrcCharacterType>();
1244 // We need to take care of units like 'em' or 'ex'. 1244 if (isASCIIAlphaCaselessEqual(*character, 'e')) {
1245 SrcCharacterType* character = currentCharacter<SrcCharacterType>(); 1245 ASSERT(character - tokenStart<SrcCharacterType>() > 0);
1246 if (isASCIIAlphaCaselessEqual(*character, 'e')) { 1246 ++character;
1247 ASSERT(character - tokenStart<SrcCharacterType>() > 0); 1247 if (*character == '-' || *character == '+' || isASCIIDigit(*characte r)) {
1248 ++character; 1248 ++character;
1249 if (*character == '-' || *character == '+' || isASCIIDigit(*char acter)) { 1249 while (isASCIIDigit(*character))
1250 ++character; 1250 ++character;
1251 while (isASCIIDigit(*character)) 1251 // Use FLOATTOKEN if the string contains exponents.
1252 ++character; 1252 dotSeen = true;
1253 // Use FLOATTOKEN if the string contains exponents. 1253 currentCharacter<SrcCharacterType>() = character;
1254 dotSeen = true;
1255 currentCharacter<SrcCharacterType>() = character;
1256 }
1257 } 1254 }
1258 if (!parseSVGNumber(tokenStart<SrcCharacterType>(), character - toke nStart<SrcCharacterType>(), yylval->number))
1259 break;
1260 } else {
1261 yylval->number = charactersToDouble(tokenStart<SrcCharacterType>(), currentCharacter<SrcCharacterType>() - tokenStart<SrcCharacterType>());
1262 } 1255 }
1263 1256
1257 yylval->number = charactersToDouble(tokenStart<SrcCharacterType>(), curr entCharacter<SrcCharacterType>() - tokenStart<SrcCharacterType>());
1258
1264 // Type of the function. 1259 // Type of the function.
1265 if (isIdentifierStart<SrcCharacterType>()) { 1260 if (isIdentifierStart<SrcCharacterType>()) {
1266 SrcCharacterType* type = currentCharacter<SrcCharacterType>(); 1261 SrcCharacterType* type = currentCharacter<SrcCharacterType>();
1267 result = currentCharacter<SrcCharacterType>(); 1262 result = currentCharacter<SrcCharacterType>();
1268 1263
1269 parseIdentifier(result, resultString, hasEscape); 1264 parseIdentifier(result, resultString, hasEscape);
1270 1265
1271 m_token = DIMEN; 1266 m_token = DIMEN;
1272 if (!hasEscape) 1267 if (!hasEscape)
1273 detectNumberToken(type, currentCharacter<SrcCharacterType>() - t ype); 1268 detectNumberToken(type, currentCharacter<SrcCharacterType>() - t ype);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 m_dataStart16[length - 1] = 0; 1577 m_dataStart16[length - 1] = 0;
1583 1578
1584 m_is8BitSource = false; 1579 m_is8BitSource = false;
1585 m_currentCharacter8 = 0; 1580 m_currentCharacter8 = 0;
1586 m_currentCharacter16 = m_dataStart16.get(); 1581 m_currentCharacter16 = m_dataStart16.get();
1587 setTokenStart<UChar>(m_currentCharacter16); 1582 setTokenStart<UChar>(m_currentCharacter16);
1588 m_lexFunc = &CSSTokenizer::realLex<UChar>; 1583 m_lexFunc = &CSSTokenizer::realLex<UChar>;
1589 } 1584 }
1590 1585
1591 } // namespace blink 1586 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserMode.h ('k') | Source/core/svg/SVGParserUtilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698