| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (string.is8Bit()) { | 103 if (string.is8Bit()) { |
| 104 if (!parseSimpleLength(string.characters8(), length, unit, number)) | 104 if (!parseSimpleLength(string.characters8(), length, unit, number)) |
| 105 return nullptr; | 105 return nullptr; |
| 106 } else { | 106 } else { |
| 107 if (!parseSimpleLength(string.characters16(), length, unit, number)) | 107 if (!parseSimpleLength(string.characters16(), length, unit, number)) |
| 108 return nullptr; | 108 return nullptr; |
| 109 } | 109 } |
| 110 | 110 |
| 111 if (unit == CSSPrimitiveValue::UnitType::Number) { | 111 if (unit == CSSPrimitiveValue::UnitType::Number) { |
| 112 bool quirksMode = isQuirksModeBehavior(cssParserMode); | 112 bool quirksMode = isQuirksModeBehavior(cssParserMode); |
| 113 if (number && !quirksMode) | 113 bool svgMode = cssParserMode == SVGAttributeMode; |
| 114 if (number && (!quirksMode && !svgMode)) |
| 114 return nullptr; | 115 return nullptr; |
| 115 unit = CSSPrimitiveValue::UnitType::Pixels; | 116 if (svgMode) |
| 117 unit = CSSPrimitiveValue::UnitType::UserUnits; |
| 118 else |
| 119 unit = CSSPrimitiveValue::UnitType::Pixels; |
| 116 } | 120 } |
| 117 if (number < 0 && !acceptsNegativeNumbers) | 121 if (number < 0 && !acceptsNegativeNumbers) |
| 118 return nullptr; | 122 return nullptr; |
| 119 | 123 |
| 120 return cssValuePool().createValue(number, unit); | 124 return cssValuePool().createValue(number, unit); |
| 121 } | 125 } |
| 122 | 126 |
| 123 static inline bool isColorPropertyID(CSSPropertyID propertyId) | 127 static inline bool isColorPropertyID(CSSPropertyID propertyId) |
| 124 { | 128 { |
| 125 switch (propertyId) { | 129 switch (propertyId) { |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 if (isColorPropertyID(propertyID)) | 1027 if (isColorPropertyID(propertyID)) |
| 1024 return parseColor(string, parserMode); | 1028 return parseColor(string, parserMode); |
| 1025 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) | 1029 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str
ing)) |
| 1026 return keyword.release(); | 1030 return keyword.release(); |
| 1027 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) | 1031 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID
, string)) |
| 1028 return transform.release(); | 1032 return transform.release(); |
| 1029 return nullptr; | 1033 return nullptr; |
| 1030 } | 1034 } |
| 1031 | 1035 |
| 1032 } // namespace blink | 1036 } // namespace blink |
| OLD | NEW |