| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/css/parser/CSSPropertyParserHelpers.h" | 5 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 6 | 6 |
| 7 #include "core/css/CSSCalculationValue.h" | 7 #include "core/css/CSSCalculationValue.h" |
| 8 #include "core/css/CSSColorValue.h" | 8 #include "core/css/CSSColorValue.h" |
| 9 #include "core/css/CSSCrossfadeValue.h" | 9 #include "core/css/CSSCrossfadeValue.h" |
| 10 #include "core/css/CSSGradientValue.h" | 10 #include "core/css/CSSGradientValue.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 return nullptr; | 306 return nullptr; |
| 307 } | 307 } |
| 308 CalcParser calcParser(range, valueRange); | 308 CalcParser calcParser(range, valueRange); |
| 309 if (const CSSCalcValue* calculation = calcParser.value()) { | 309 if (const CSSCalcValue* calculation = calcParser.value()) { |
| 310 if (calculation->category() == CalcTime) | 310 if (calculation->category() == CalcTime) |
| 311 return calcParser.consumeValue(); | 311 return calcParser.consumeValue(); |
| 312 } | 312 } |
| 313 return nullptr; | 313 return nullptr; |
| 314 } | 314 } |
| 315 | 315 |
| 316 CSSPrimitiveValue* consumeResolution(CSSParserTokenRange& range) { |
| 317 const CSSParserToken& token = range.peek(); |
| 318 // Unlike the other types, calc() does not work with <resolution>. |
| 319 if (token.type() != DimensionToken) |
| 320 return nullptr; |
| 321 CSSPrimitiveValue::UnitType unit = token.unitType(); |
| 322 if (unit == CSSPrimitiveValue::UnitType::DotsPerPixel || |
| 323 unit == CSSPrimitiveValue::UnitType::DotsPerInch || |
| 324 unit == CSSPrimitiveValue::UnitType::DotsPerCentimeter) { |
| 325 return CSSPrimitiveValue::create( |
| 326 range.consumeIncludingWhitespace().numericValue(), unit); |
| 327 } |
| 328 return nullptr; |
| 329 } |
| 330 |
| 316 CSSIdentifierValue* consumeIdent(CSSParserTokenRange& range) { | 331 CSSIdentifierValue* consumeIdent(CSSParserTokenRange& range) { |
| 317 if (range.peek().type() != IdentToken) | 332 if (range.peek().type() != IdentToken) |
| 318 return nullptr; | 333 return nullptr; |
| 319 return CSSIdentifierValue::create(range.consumeIncludingWhitespace().id()); | 334 return CSSIdentifierValue::create(range.consumeIncludingWhitespace().id()); |
| 320 } | 335 } |
| 321 | 336 |
| 322 CSSIdentifierValue* consumeIdentRange(CSSParserTokenRange& range, | 337 CSSIdentifierValue* consumeIdentRange(CSSParserTokenRange& range, |
| 323 CSSValueID lower, | 338 CSSValueID lower, |
| 324 CSSValueID upper) { | 339 CSSValueID upper) { |
| 325 if (range.peek().id() < lower || range.peek().id() > upper) | 340 if (range.peek().id() < lower || range.peek().id() > upper) |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 | 1248 |
| 1234 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box | 1249 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box |
| 1235 CSSIdentifierValue* consumeShapeBox(CSSParserTokenRange& range) { | 1250 CSSIdentifierValue* consumeShapeBox(CSSParserTokenRange& range) { |
| 1236 return consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, | 1251 return consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, |
| 1237 CSSValueMarginBox>(range); | 1252 CSSValueMarginBox>(range); |
| 1238 } | 1253 } |
| 1239 | 1254 |
| 1240 } // namespace CSSPropertyParserHelpers | 1255 } // namespace CSSPropertyParserHelpers |
| 1241 | 1256 |
| 1242 } // namespace blink | 1257 } // namespace blink |
| OLD | NEW |