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

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

Issue 1417463003: Move z-index property handling into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again! Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/CSSPropertyParser.h" 6 #include "core/css/parser/CSSPropertyParser.h"
7 7
8 #include "core/StylePropertyShorthand.h" 8 #include "core/StylePropertyShorthand.h"
9 #include "core/css/CSSCalculationValue.h" 9 #include "core/css/CSSCalculationValue.h"
10 #include "core/css/CSSCustomIdentValue.h" 10 #include "core/css/CSSCustomIdentValue.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 CSSParserTokenRange m_range; 179 CSSParserTokenRange m_range;
180 RefPtrWillBeMember<CSSCalcValue> m_calcValue; 180 RefPtrWillBeMember<CSSCalcValue> m_calcValue;
181 }; 181 };
182 182
183 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeInteger(CSSParserTokenRa nge& range, double minimumValue = -std::numeric_limits<double>::max()) 183 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeInteger(CSSParserTokenRa nge& range, double minimumValue = -std::numeric_limits<double>::max())
184 { 184 {
185 const CSSParserToken& token = range.peek(); 185 const CSSParserToken& token = range.peek();
186 if (token.type() == NumberToken) { 186 if (token.type() == NumberToken) {
187 if (token.numericValueType() == NumberValueType || token.numericValue() < minimumValue) 187 if (token.numericValueType() == NumberValueType || token.numericValue() < minimumValue)
188 return nullptr; 188 return nullptr;
189 return cssValuePool().createValue(range.consumeIncludingWhitespace().num ericValue(), token.unitType()); 189 return cssValuePool().createValue(range.consumeIncludingWhitespace().num ericValue(), CSSPrimitiveValue::UnitType::Integer);
190 } 190 }
191 CalcParser calcParser(range); 191 CalcParser calcParser(range);
192 if (const CSSCalcValue* calculation = calcParser.value()) { 192 if (const CSSCalcValue* calculation = calcParser.value()) {
193 if (calculation->category() != CalcNumber || !calculation->isInt()) 193 if (calculation->category() != CalcNumber || !calculation->isInt())
194 return nullptr; 194 return nullptr;
195 double value = calculation->doubleValue(); 195 double value = calculation->doubleValue();
196 if (value < minimumValue) 196 if (value < minimumValue)
197 return nullptr; 197 return nullptr;
198 return calcParser.consumeNumber(); 198 return calcParser.consumeNumber();
199 } 199 }
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1043 }
1044 1044
1045 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineClamp(CSSParserToken Range& range) 1045 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineClamp(CSSParserToken Range& range)
1046 { 1046 {
1047 if (range.peek().type() != PercentageToken && range.peek().type() != NumberT oken) 1047 if (range.peek().type() != PercentageToken && range.peek().type() != NumberT oken)
1048 return nullptr; 1048 return nullptr;
1049 RefPtrWillBeRawPtr<CSSPrimitiveValue> clampValue = consumePercent(range, Val ueRangeNonNegative); 1049 RefPtrWillBeRawPtr<CSSPrimitiveValue> clampValue = consumePercent(range, Val ueRangeNonNegative);
1050 if (clampValue) 1050 if (clampValue)
1051 return clampValue; 1051 return clampValue;
1052 // When specifying number of lines, don't allow 0 as a valid value. 1052 // When specifying number of lines, don't allow 0 as a valid value.
1053 return consumeInteger(range, 1); 1053 return consumePositiveInteger(range);
1054 } 1054 }
1055 1055
1056 static PassRefPtrWillBeRawPtr<CSSValue> consumeLocale(CSSParserTokenRange& range ) 1056 static PassRefPtrWillBeRawPtr<CSSValue> consumeLocale(CSSParserTokenRange& range )
1057 { 1057 {
1058 if (range.peek().id() == CSSValueAuto) 1058 if (range.peek().id() == CSSValueAuto)
1059 return consumeIdent(range); 1059 return consumeIdent(range);
1060 return consumeString(range); 1060 return consumeString(range);
1061 } 1061 }
1062 1062
1063 static PassRefPtrWillBeRawPtr<CSSValue> consumeColumnWidth(CSSParserTokenRange& range) 1063 static PassRefPtrWillBeRawPtr<CSSValue> consumeColumnWidth(CSSParserTokenRange& range)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 return nullptr; 1137 return nullptr;
1138 } 1138 }
1139 1139
1140 static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationIterationCount(CSSParser TokenRange& range) 1140 static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationIterationCount(CSSParser TokenRange& range)
1141 { 1141 {
1142 if (range.peek().id() == CSSValueInfinite) 1142 if (range.peek().id() == CSSValueInfinite)
1143 return consumeIdent(range); 1143 return consumeIdent(range);
1144 return consumeNumber(range, ValueRangeNonNegative); 1144 return consumeNumber(range, ValueRangeNonNegative);
1145 } 1145 }
1146 1146
1147 static PassRefPtrWillBeRawPtr<CSSValue> consumeZIndex(CSSParserTokenRange& range )
Timothy Loh 2015/10/29 03:53:42 errr... can we put this somewhere other than in th
1148 {
1149 if (range.peek().id() == CSSValueAuto)
1150 return consumeIdent(range);
1151 return consumeInteger(range);
1152 }
1153
1147 static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationPlayState(CSSParserToken Range& range) 1154 static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationPlayState(CSSParserToken Range& range)
1148 { 1155 {
1149 CSSValueID id = range.peek().id(); 1156 CSSValueID id = range.peek().id();
1150 if (id == CSSValueRunning || id == CSSValuePaused) 1157 if (id == CSSValueRunning || id == CSSValuePaused)
1151 return consumeIdent(range); 1158 return consumeIdent(range);
1152 return nullptr; 1159 return nullptr;
1153 } 1160 }
1154 1161
1155 static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationName(CSSParserTokenRange & range, const CSSParserContext& context, bool allowQuotedName) 1162 static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationName(CSSParserTokenRange & range, const CSSParserContext& context, bool allowQuotedName)
1156 { 1163 {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 case CSSPropertyTransitionTimingFunction: 1434 case CSSPropertyTransitionTimingFunction:
1428 return consumeAnimationPropertyList(property, m_range, m_context, unreso lvedProperty == CSSPropertyAliasWebkitAnimationName); 1435 return consumeAnimationPropertyList(property, m_range, m_context, unreso lvedProperty == CSSPropertyAliasWebkitAnimationName);
1429 case CSSPropertyOrphans: 1436 case CSSPropertyOrphans:
1430 case CSSPropertyWidows: 1437 case CSSPropertyWidows:
1431 return consumeWidowsOrOrphans(m_range); 1438 return consumeWidowsOrOrphans(m_range);
1432 case CSSPropertyWebkitTextFillColor: 1439 case CSSPropertyWebkitTextFillColor:
1433 case CSSPropertyWebkitTapHighlightColor: 1440 case CSSPropertyWebkitTapHighlightColor:
1434 return consumeColor(m_range, m_context); 1441 return consumeColor(m_range, m_context);
1435 case CSSPropertyColor: 1442 case CSSPropertyColor:
1436 return consumeColor(m_range, m_context, inQuirksMode()); 1443 return consumeColor(m_range, m_context, inQuirksMode());
1444 case CSSPropertyZIndex:
1445 return consumeZIndex(m_range);
1437 default: 1446 default:
1438 return nullptr; 1447 return nullptr;
1439 } 1448 }
1440 } 1449 }
1441 1450
1442 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) 1451 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range)
1443 { 1452 {
1444 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); 1453 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated ();
1445 1454
1446 do { 1455 do {
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 m_currentShorthand = oldShorthand; 1866 m_currentShorthand = oldShorthand;
1858 return consumeColumns(important); 1867 return consumeColumns(important);
1859 } 1868 }
1860 default: 1869 default:
1861 m_currentShorthand = oldShorthand; 1870 m_currentShorthand = oldShorthand;
1862 return false; 1871 return false;
1863 } 1872 }
1864 } 1873 }
1865 1874
1866 } // namespace blink 1875 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698