Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp

Issue 1475903002: Don't handle unitless length quirk in CSS parser fast path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/css-parser/unitless-length-quirk.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
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 if (cssParserMode == SVGAttributeMode)
113 bool svgMode = cssParserMode == SVGAttributeMode; 113 unit = CSSPrimitiveValue::UnitType::UserUnits;
114 if (number && (!quirksMode && !svgMode)) 114 else if (!number)
115 unit = CSSPrimitiveValue::UnitType::Pixels;
116 else
115 return nullptr; 117 return nullptr;
116 if (svgMode)
117 unit = CSSPrimitiveValue::UnitType::UserUnits;
118 else
119 unit = CSSPrimitiveValue::UnitType::Pixels;
120 } 118 }
119
121 if (number < 0 && !acceptsNegativeNumbers) 120 if (number < 0 && !acceptsNegativeNumbers)
122 return nullptr; 121 return nullptr;
123 122
124 return cssValuePool().createValue(number, unit); 123 return cssValuePool().createValue(number, unit);
125 } 124 }
126 125
127 static inline bool isColorPropertyID(CSSPropertyID propertyId) 126 static inline bool isColorPropertyID(CSSPropertyID propertyId)
128 { 127 {
129 switch (propertyId) { 128 switch (propertyId) {
130 case CSSPropertyColor: 129 case CSSPropertyColor:
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 if (isColorPropertyID(propertyID)) 1028 if (isColorPropertyID(propertyID))
1030 return parseColor(string, parserMode); 1029 return parseColor(string, parserMode);
1031 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str ing)) 1030 if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, str ing))
1032 return keyword.release(); 1031 return keyword.release();
1033 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID , string)) 1032 if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID , string))
1034 return transform.release(); 1033 return transform.release();
1035 return nullptr; 1034 return nullptr;
1036 } 1035 }
1037 1036
1038 } // namespace blink 1037 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/css-parser/unitless-length-quirk.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698