| 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/CSSTokenizer.h" | 6 #include "core/css/parser/CSSTokenizer.h" |
| 7 | 7 |
| 8 namespace blink { | 8 namespace blink { |
| 9 #include "core/CSSTokenizerCodepoints.cpp" | 9 #include "core/CSSTokenizerCodepoints.cpp" |
| 10 } | 10 } |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 | 390 |
| 391 void CSSTokenizer::consumeUntilNonWhitespace() | 391 void CSSTokenizer::consumeUntilNonWhitespace() |
| 392 { | 392 { |
| 393 // Using HTML space here rather than CSS space since we don't do preprocessi
ng | 393 // Using HTML space here rather than CSS space since we don't do preprocessi
ng |
| 394 while (isHTMLSpace<UChar>(m_input.nextInputChar())) | 394 while (isHTMLSpace<UChar>(m_input.nextInputChar())) |
| 395 consume(); | 395 consume(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void CSSTokenizer::consumeSingleWhitespaceIfNext() |
| 399 { |
| 400 // We check for \r\n and HTML spaces since we don't do preprocessing |
| 401 UChar c = m_input.nextInputChar(); |
| 402 if (c == '\r' && m_input.peek(1) == '\n') |
| 403 consume(2); |
| 404 else if (isHTMLSpace(c)) |
| 405 consume(); |
| 406 } |
| 407 |
| 398 bool CSSTokenizer::consumeUntilCommentEndFound() | 408 bool CSSTokenizer::consumeUntilCommentEndFound() |
| 399 { | 409 { |
| 400 UChar c = consume(); | 410 UChar c = consume(); |
| 401 while (true) { | 411 while (true) { |
| 402 if (c == kEndOfFileMarker) | 412 if (c == kEndOfFileMarker) |
| 403 return false; | 413 return false; |
| 404 if (c != '*') { | 414 if (c != '*') { |
| 405 c = consume(); | 415 c = consume(); |
| 406 continue; | 416 continue; |
| 407 } | 417 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 ASSERT(cc != '\n'); | 459 ASSERT(cc != '\n'); |
| 450 if (isASCIIHexDigit(cc)) { | 460 if (isASCIIHexDigit(cc)) { |
| 451 unsigned consumedHexDigits = 1; | 461 unsigned consumedHexDigits = 1; |
| 452 StringBuilder hexChars; | 462 StringBuilder hexChars; |
| 453 hexChars.append(cc); | 463 hexChars.append(cc); |
| 454 while (consumedHexDigits < 6 && isASCIIHexDigit(m_input.nextInputChar())
) { | 464 while (consumedHexDigits < 6 && isASCIIHexDigit(m_input.nextInputChar())
) { |
| 455 cc = consume(); | 465 cc = consume(); |
| 456 hexChars.append(cc); | 466 hexChars.append(cc); |
| 457 consumedHexDigits++; | 467 consumedHexDigits++; |
| 458 }; | 468 }; |
| 469 consumeSingleWhitespaceIfNext(); |
| 459 bool ok = false; | 470 bool ok = false; |
| 460 UChar codePoint = hexChars.toString().toUIntStrict(&ok, 16); | 471 UChar codePoint = hexChars.toString().toUIntStrict(&ok, 16); |
| 461 if (!ok) | 472 if (!ok) |
| 462 return WTF::Unicode::replacementCharacter; | 473 return WTF::Unicode::replacementCharacter; |
| 463 return codePoint; | 474 return codePoint; |
| 464 } | 475 } |
| 465 | 476 |
| 466 // Replaces NULLs with replacement characters, since we do not perform prepr
ocessing | 477 // Replaces NULLs with replacement characters, since we do not perform prepr
ocessing |
| 467 if (cc == kEndOfFileMarker) | 478 if (cc == kEndOfFileMarker) |
| 468 return WTF::Unicode::replacementCharacter; | 479 return WTF::Unicode::replacementCharacter; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 526 |
| 516 bool CSSTokenizer::nextCharsAreIdentifier() | 527 bool CSSTokenizer::nextCharsAreIdentifier() |
| 517 { | 528 { |
| 518 UChar first = consume(); | 529 UChar first = consume(); |
| 519 bool areIdentifier = nextCharsAreIdentifier(first); | 530 bool areIdentifier = nextCharsAreIdentifier(first); |
| 520 reconsume(first); | 531 reconsume(first); |
| 521 return areIdentifier; | 532 return areIdentifier; |
| 522 } | 533 } |
| 523 | 534 |
| 524 } // namespace blink | 535 } // namespace blink |
| OLD | NEW |