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 fprintf(stderr, "parseSimpleLengthValue() parsed %g, svg? %s, quirks %s\ n", number, svgMode ? "true" : "false", quirksMode ? "true" : "false"); | |
Timothy Loh
2015/11/04 00:33:44
You left in some debugging code here ;)
Stephen Chennney
2015/11/04 18:04:47
Done.
| |
115 if (number && (!quirksMode && !svgMode)) | |
114 return nullptr; | 116 return nullptr; |
115 unit = CSSPrimitiveValue::UnitType::Pixels; | 117 if (svgMode) |
118 unit = CSSPrimitiveValue::UnitType::UserUnits; | |
119 else | |
120 unit = CSSPrimitiveValue::UnitType::Pixels; | |
116 } | 121 } |
117 if (number < 0 && !acceptsNegativeNumbers) | 122 if (number < 0 && !acceptsNegativeNumbers) |
118 return nullptr; | 123 return nullptr; |
119 | 124 |
120 return cssValuePool().createValue(number, unit); | 125 return cssValuePool().createValue(number, unit); |
121 } | 126 } |
122 | 127 |
123 static inline bool isColorPropertyID(CSSPropertyID propertyId) | 128 static inline bool isColorPropertyID(CSSPropertyID propertyId) |
124 { | 129 { |
125 switch (propertyId) { | 130 switch (propertyId) { |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1023 if (isColorPropertyID(propertyID)) | 1028 if (isColorPropertyID(propertyID)) |
1024 return parseColor(string, parserMode); | 1029 return parseColor(string, parserMode); |
1025 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str ing)) | 1030 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str ing)) |
1026 return keyword.release(); | 1031 return keyword.release(); |
1027 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID , string)) | 1032 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID , string)) |
1028 return transform.release(); | 1033 return transform.release(); |
1029 return nullptr; | 1034 return nullptr; |
1030 } | 1035 } |
1031 | 1036 |
1032 } // namespace blink | 1037 } // namespace blink |
OLD | NEW |