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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp

Issue 1889143003: Improve named grid areas parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 4 years, 8 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 | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp b/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp
index 6d4a2abdcf65b3ab061f26de86d9e1551a79cb3b..a4d30292d96e9e7a8fe991a0ae3a42a828060818 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp
@@ -8,6 +8,7 @@ namespace blink {
#include "core/CSSTokenizerCodepoints.cpp"
}
+#include "core/css/parser/CSSParserIdioms.h"
#include "core/css/parser/CSSParserObserverWrapper.h"
#include "core/css/parser/CSSParserTokenRange.h"
#include "core/css/parser/CSSTokenizerInputStream.h"
@@ -83,22 +84,6 @@ unsigned CSSTokenizer::Scope::tokenCount()
return m_tokens.size();
}
-// http://dev.w3.org/csswg/css-syntax/#name-start-code-point
-static bool isNameStart(UChar c)
-{
- if (isASCIIAlpha(c))
- return true;
- if (c == '_')
- return true;
- return !isASCII(c);
-}
-
-// http://dev.w3.org/csswg/css-syntax/#name-code-point
-static bool isNameChar(UChar c)
-{
- return isNameStart(c) || isASCIIDigit(c) || c == '-';
-}
-
static bool isNewLine(UChar cc)
{
// We check \r and \f here, since we have no preprocessing stage
@@ -271,7 +256,7 @@ CSSParserToken CSSTokenizer::semiColon(UChar cc)
CSSParserToken CSSTokenizer::hash(UChar cc)
{
UChar nextChar = m_input.nextInputChar();
- if (isNameChar(nextChar) || twoCharsAreValidEscape(nextChar, m_input.peek(1))) {
+ if (isNameCodePoint(nextChar) || twoCharsAreValidEscape(nextChar, m_input.peek(1))) {
HashTokenType type = nextCharsAreIdentifier() ? HashTokenId : HashTokenUnrestricted;
return CSSParserToken(type, consumeName());
}
@@ -684,7 +669,7 @@ CSSParserString CSSTokenizer::consumeName()
UChar cc = m_input.peekWithoutReplacement(size);
if (cc == '\0' || cc == '\\')
break;
- if (!isNameChar(cc)) {
+ if (!isNameCodePoint(cc)) {
unsigned startOffset = m_input.offset();
m_input.advance(size);
return m_input.rangeAsCSSParserString(startOffset, size);
@@ -694,7 +679,7 @@ CSSParserString CSSTokenizer::consumeName()
StringBuilder result;
while (true) {
UChar cc = consume();
- if (isNameChar(cc)) {
+ if (isNameCodePoint(cc)) {
result.append(cc);
continue;
}
@@ -765,11 +750,11 @@ bool CSSTokenizer::nextCharsAreNumber()
bool CSSTokenizer::nextCharsAreIdentifier(UChar first)
{
UChar second = m_input.nextInputChar();
- if (isNameStart(first) || twoCharsAreValidEscape(first, second))
+ if (isNameStartCodePoint(first) || twoCharsAreValidEscape(first, second))
return true;
if (first == '-')
- return isNameStart(second) || second == '-' || nextTwoCharsAreValidEscape();
+ return isNameStartCodePoint(second) || second == '-' || nextTwoCharsAreValidEscape();
return false;
}
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698