| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/parser/MediaQueryTokenizer.h" | 6 #include "core/css/parser/MediaQueryTokenizer.h" |
| 7 | 7 |
| 8 namespace WebCore { | 8 namespace WebCore { |
| 9 #include "MediaQueryTokenizerCodepoints.cpp" | 9 #include "MediaQueryTokenizerCodepoints.cpp" |
| 10 } | 10 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void MediaQueryTokenizer::tokenize(String string, Vector<MediaQueryToken>& outTo
kens) | 206 void MediaQueryTokenizer::tokenize(String string, Vector<MediaQueryToken>& outTo
kens) |
| 207 { | 207 { |
| 208 // According to the spec, we should perform preprocessing here. | 208 // According to the spec, we should perform preprocessing here. |
| 209 // See: http://dev.w3.org/csswg/css-syntax/#input-preprocessing | 209 // See: http://dev.w3.org/csswg/css-syntax/#input-preprocessing |
| 210 // | 210 // |
| 211 // However, we can skip this step since: | 211 // However, we can skip this step since: |
| 212 // * We're using HTML spaces (which accept \r and \f as a valid white space) | 212 // * We're using HTML spaces (which accept \r and \f as a valid white space) |
| 213 // * Do not count white spaces | 213 // * Do not count white spaces |
| 214 // * consumeEscape replaces NULLs for replacement characters | 214 // * consumeEscape replaces NULLs for replacement characters |
| 215 | 215 |
| 216 if (string.isEmpty()) |
| 217 return; |
| 218 |
| 216 MediaQueryInputStream input(string); | 219 MediaQueryInputStream input(string); |
| 217 MediaQueryTokenizer tokenizer(input); | 220 MediaQueryTokenizer tokenizer(input); |
| 218 while (true) { | 221 while (true) { |
| 219 MediaQueryToken token = tokenizer.nextToken(); | 222 MediaQueryToken token = tokenizer.nextToken(); |
| 220 outTokens.append(token); | 223 outTokens.append(token); |
| 221 if (token.type() == EOFToken) | 224 if (token.type() == EOFToken) |
| 222 return; | 225 return; |
| 223 } | 226 } |
| 224 } | 227 } |
| 225 | 228 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 if (firstChar == '-') { | 498 if (firstChar == '-') { |
| 496 if (isNameStart(m_input.peek(1))) | 499 if (isNameStart(m_input.peek(1))) |
| 497 return true; | 500 return true; |
| 498 return nextTwoCharsAreValidEscape(1); | 501 return nextTwoCharsAreValidEscape(1); |
| 499 } | 502 } |
| 500 | 503 |
| 501 return false; | 504 return false; |
| 502 } | 505 } |
| 503 | 506 |
| 504 } // namespace WebCore | 507 } // namespace WebCore |
| OLD | NEW |