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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 if (string.is8Bit()) { | 100 if (string.is8Bit()) { |
101 if (!parseSimpleLength(string.characters8(), length, unit, number)) | 101 if (!parseSimpleLength(string.characters8(), length, unit, number)) |
102 return nullptr; | 102 return nullptr; |
103 } else { | 103 } else { |
104 if (!parseSimpleLength(string.characters16(), length, unit, number)) | 104 if (!parseSimpleLength(string.characters16(), length, unit, number)) |
105 return nullptr; | 105 return nullptr; |
106 } | 106 } |
107 | 107 |
108 if (unit == CSSPrimitiveValue::CSS_NUMBER) { | 108 if (unit == CSSPrimitiveValue::CSS_NUMBER) { |
109 bool quirksMode = isQuirksModeBehavior(cssParserMode); | 109 if (!isUnitLessLengthParsingEnabledForMode(cssParserMode)) { |
110 if (number && !quirksMode) | 110 bool quirksMode = isQuirksModeBehavior(cssParserMode); |
111 return nullptr; | 111 if (number && !quirksMode) |
112 unit = CSSPrimitiveValue::CSS_PX; | 112 return nullptr; |
| 113 unit = CSSPrimitiveValue::CSS_PX; |
| 114 } |
113 } | 115 } |
114 if (number < 0 && !acceptsNegativeNumbers) | 116 if (number < 0 && !acceptsNegativeNumbers) |
115 return nullptr; | 117 return nullptr; |
116 | 118 |
117 return cssValuePool().createValue(number, unit); | 119 return cssValuePool().createValue(number, unit); |
118 } | 120 } |
119 | 121 |
120 static inline bool isColorPropertyID(CSSPropertyID propertyId) | 122 static inline bool isColorPropertyID(CSSPropertyID propertyId) |
121 { | 123 { |
122 switch (propertyId) { | 124 switch (propertyId) { |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 if (RefPtrWillBeRawPtr<CSSValue> color = parseColorValue(propertyID, string,
parserMode)) | 661 if (RefPtrWillBeRawPtr<CSSValue> color = parseColorValue(propertyID, string,
parserMode)) |
660 return color.release(); | 662 return color.release(); |
661 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) | 663 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) |
662 return keyword.release(); | 664 return keyword.release(); |
663 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) | 665 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) |
664 return transform.release(); | 666 return transform.release(); |
665 return nullptr; | 667 return nullptr; |
666 } | 668 } |
667 | 669 |
668 } // namespace blink | 670 } // namespace blink |
OLD | NEW |