Chromium Code Reviews| 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 cf8a087fc21f507dcf1cbc5feeb43e1bd766546b..e6229ecdbe27f57867d3dc5703a507393989fff0 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp |
| @@ -667,13 +667,18 @@ StringView CSSTokenizer::consumeName() |
| // Names without escapes get handled without allocations |
| for (unsigned size = 0; ; ++size) { |
| UChar cc = m_input.peekWithoutReplacement(size); |
| - if (cc == '\0' || cc == '\\') |
| + if (isNameCodePoint(cc)) |
| + continue; |
| + // peekWithoutReplacement will return NUL when we hit the end of the |
| + // input. In that case we want to still use the rangeAt() fast path |
| + // below. |
| + if (cc == '\0' && m_input.offset() + size < m_input.length()) |
|
Timothy Loh
2016/06/27 00:14:25
good find!
|
| break; |
| - if (!isNameCodePoint(cc)) { |
| - unsigned startOffset = m_input.offset(); |
| - m_input.advance(size); |
| - return m_input.rangeAt(startOffset, size); |
| - } |
| + if (cc == '\\') |
| + break; |
| + unsigned startOffset = m_input.offset(); |
| + m_input.advance(size); |
| + return m_input.rangeAt(startOffset, size); |
| } |
| StringBuilder result; |