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/CSSStringValue.h" | 9 #include "core/css/CSSStringValue.h" |
10 #include "core/css/CSSValuePair.h" | 10 #include "core/css/CSSValuePair.h" |
11 // TODO(timloh): Remove this dependency | |
12 #include "core/css/parser/CSSPropertyParser.h" | |
13 | 11 |
14 namespace blink { | 12 namespace blink { |
15 | 13 |
16 namespace CSSPropertyParserHelpers { | 14 namespace CSSPropertyParserHelpers { |
17 | 15 |
18 bool consumeCommaIncludingWhitespace(CSSParserTokenRange& range) | 16 bool consumeCommaIncludingWhitespace(CSSParserTokenRange& range) |
19 { | 17 { |
20 CSSParserToken value = range.peek(); | 18 CSSParserToken value = range.peek(); |
21 if (value.type() != CommaToken) | 19 if (value.type() != CommaToken) |
22 return false; | 20 return false; |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 if ((functionId <= CSSValueRgba && !parseRGBParameters(colorRange, result, f
unctionId == CSSValueRgba)) | 438 if ((functionId <= CSSValueRgba && !parseRGBParameters(colorRange, result, f
unctionId == CSSValueRgba)) |
441 || (functionId >= CSSValueHsl && !parseHSLParameters(colorRange, result,
functionId == CSSValueHsla))) | 439 || (functionId >= CSSValueHsl && !parseHSLParameters(colorRange, result,
functionId == CSSValueHsla))) |
442 return false; | 440 return false; |
443 range = colorRange; | 441 range = colorRange; |
444 return true; | 442 return true; |
445 } | 443 } |
446 | 444 |
447 CSSValue* consumeColor(CSSParserTokenRange& range, CSSParserMode cssParserMode,
bool acceptQuirkyColors) | 445 CSSValue* consumeColor(CSSParserTokenRange& range, CSSParserMode cssParserMode,
bool acceptQuirkyColors) |
448 { | 446 { |
449 CSSValueID id = range.peek().id(); | 447 CSSValueID id = range.peek().id(); |
450 if (CSSPropertyParser::isColorKeyword(id)) { | 448 if (StyleColor::isColorKeyword(id)) { |
451 if (!isValueAllowedInMode(id, cssParserMode)) | 449 if (!isValueAllowedInMode(id, cssParserMode)) |
452 return nullptr; | 450 return nullptr; |
453 return consumeIdent(range); | 451 return consumeIdent(range); |
454 } | 452 } |
455 RGBA32 color = Color::transparent; | 453 RGBA32 color = Color::transparent; |
456 if (!parseHexColor(range, color, acceptQuirkyColors) && !parseColorFunction(
range, color)) | 454 if (!parseHexColor(range, color, acceptQuirkyColors) && !parseColorFunction(
range, color)) |
457 return nullptr; | 455 return nullptr; |
458 return CSSColorValue::create(color); | 456 return CSSColorValue::create(color); |
459 } | 457 } |
460 | 458 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 if (!value2) { | 592 if (!value2) { |
595 positionFromOneValue(value1, resultX, resultY); | 593 positionFromOneValue(value1, resultX, resultY); |
596 return true; | 594 return true; |
597 } | 595 } |
598 return positionFromTwoValues(value1, value2, resultX, resultY); | 596 return positionFromTwoValues(value1, value2, resultX, resultY); |
599 } | 597 } |
600 | 598 |
601 } // namespace CSSPropertyParserHelpers | 599 } // namespace CSSPropertyParserHelpers |
602 | 600 |
603 } // namespace blink | 601 } // namespace blink |
OLD | NEW |