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/CSSParserFastPaths.h" | 6 #include "core/css/parser/CSSParserFastPaths.h" |
7 | 7 |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSFunctionValue.h" | 9 #include "core/css/CSSFunctionValue.h" |
10 #include "core/css/CSSValuePool.h" | 10 #include "core/css/CSSValuePool.h" |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 if (pos < end) { | 631 if (pos < end) { |
632 if (isCSSSpace(*pos)) | 632 if (isCSSSpace(*pos)) |
633 return nullptr; | 633 return nullptr; |
634 } | 634 } |
635 } | 635 } |
636 return transformList.release(); | 636 return transformList.release(); |
637 } | 637 } |
638 | 638 |
639 static PassRefPtrWillBeRawPtr<CSSValue> parseSimpleTransform(CSSPropertyID prope
rtyID, const String& string) | 639 static PassRefPtrWillBeRawPtr<CSSValue> parseSimpleTransform(CSSPropertyID prope
rtyID, const String& string) |
640 { | 640 { |
| 641 ASSERT(!string.isEmpty()); |
| 642 |
641 if (propertyID != CSSPropertyTransform) | 643 if (propertyID != CSSPropertyTransform) |
642 return nullptr; | 644 return nullptr; |
643 if (string.isEmpty()) | |
644 return nullptr; | |
645 if (string.is8Bit()) { | 645 if (string.is8Bit()) { |
646 const LChar* pos = string.characters8(); | 646 const LChar* pos = string.characters8(); |
647 const LChar* end = pos + string.length(); | 647 const LChar* end = pos + string.length(); |
648 return parseSimpleTransformList(pos, end); | 648 return parseSimpleTransformList(pos, end); |
649 } | 649 } |
650 const UChar* pos = string.characters16(); | 650 const UChar* pos = string.characters16(); |
651 const UChar* end = pos + string.length(); | 651 const UChar* end = pos + string.length(); |
652 return parseSimpleTransformList(pos, end); | 652 return parseSimpleTransformList(pos, end); |
653 } | 653 } |
654 | 654 |
655 PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSProperty
ID propertyID, const String& string, CSSParserMode parserMode) | 655 PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSProperty
ID propertyID, const String& string, CSSParserMode parserMode) |
656 { | 656 { |
657 if (RefPtrWillBeRawPtr<CSSValue> length = parseSimpleLengthValue(propertyID,
string, parserMode)) | 657 if (RefPtrWillBeRawPtr<CSSValue> length = parseSimpleLengthValue(propertyID,
string, parserMode)) |
658 return length.release(); | 658 return length.release(); |
659 if (RefPtrWillBeRawPtr<CSSValue> color = parseColorValue(propertyID, string,
parserMode)) | 659 if (RefPtrWillBeRawPtr<CSSValue> color = parseColorValue(propertyID, string,
parserMode)) |
660 return color.release(); | 660 return color.release(); |
661 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) | 661 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) |
662 return keyword.release(); | 662 return keyword.release(); |
663 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) | 663 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) |
664 return transform.release(); | 664 return transform.release(); |
665 return nullptr; | 665 return nullptr; |
666 } | 666 } |
667 | 667 |
668 } // namespace blink | 668 } // namespace blink |
OLD | NEW |