| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/parser/CSSTokenizer.h" | 5 #include "core/css/parser/CSSTokenizer.h" |
| 6 | 6 |
| 7 namespace blink { | 7 namespace blink { |
| 8 #include "core/CSSTokenizerCodepoints.cpp" | 8 #include "core/CSSTokenizerCodepoints.cpp" |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 CSSParserTokenRange CSSTokenizer::Scope::tokenRange() { | 76 CSSParserTokenRange CSSTokenizer::Scope::tokenRange() { |
| 77 return m_tokens; | 77 return m_tokens; |
| 78 } | 78 } |
| 79 | 79 |
| 80 unsigned CSSTokenizer::Scope::tokenCount() { | 80 unsigned CSSTokenizer::Scope::tokenCount() { |
| 81 return m_tokens.size(); | 81 return m_tokens.size(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void CSSTokenizer::Scope::storeString(const String& string) { |
| 85 if (!m_stringPool) |
| 86 m_stringPool.reset(new Vector<String>); |
| 87 m_stringPool->append(string); |
| 88 } |
| 89 |
| 84 static bool isNewLine(UChar cc) { | 90 static bool isNewLine(UChar cc) { |
| 85 // We check \r and \f here, since we have no preprocessing stage | 91 // We check \r and \f here, since we have no preprocessing stage |
| 86 return (cc == '\r' || cc == '\n' || cc == '\f'); | 92 return (cc == '\r' || cc == '\n' || cc == '\f'); |
| 87 } | 93 } |
| 88 | 94 |
| 89 // http://dev.w3.org/csswg/css-syntax/#check-if-two-code-points-are-a-valid-esca
pe | 95 // http://dev.w3.org/csswg/css-syntax/#check-if-two-code-points-are-a-valid-esca
pe |
| 90 static bool twoCharsAreValidEscape(UChar first, UChar second) { | 96 static bool twoCharsAreValidEscape(UChar first, UChar second) { |
| 91 return first == '\\' && !isNewLine(second); | 97 return first == '\\' && !isNewLine(second); |
| 92 } | 98 } |
| 93 | 99 |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 reconsume(first); | 690 reconsume(first); |
| 685 return areIdentifier; | 691 return areIdentifier; |
| 686 } | 692 } |
| 687 | 693 |
| 688 StringView CSSTokenizer::registerString(const String& string) { | 694 StringView CSSTokenizer::registerString(const String& string) { |
| 689 m_scope.storeString(string); | 695 m_scope.storeString(string); |
| 690 return string; | 696 return string; |
| 691 } | 697 } |
| 692 | 698 |
| 693 } // namespace blink | 699 } // namespace blink |
| OLD | NEW |