OLD | NEW |
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 "core/css/parser/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
6 | 6 |
7 #include "core/StylePropertyShorthand.h" | 7 #include "core/StylePropertyShorthand.h" |
8 #include "core/css/CSSBasicShapeValues.h" | 8 #include "core/css/CSSBasicShapeValues.h" |
9 #include "core/css/CSSBorderImage.h" | 9 #include "core/css/CSSBorderImage.h" |
10 #include "core/css/CSSContentDistributionValue.h" | 10 #include "core/css/CSSContentDistributionValue.h" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 if (parsedValue) { | 509 if (parsedValue) { |
510 list->append(*parsedValue); | 510 list->append(*parsedValue); |
511 } else { | 511 } else { |
512 return nullptr; | 512 return nullptr; |
513 } | 513 } |
514 } | 514 } |
515 } while (consumeCommaIncludingWhitespace(range)); | 515 } while (consumeCommaIncludingWhitespace(range)); |
516 return list; | 516 return list; |
517 } | 517 } |
518 | 518 |
519 static CSSValue* consumeSpacing(CSSParserTokenRange& range, | |
520 CSSParserMode cssParserMode) { | |
521 if (range.peek().id() == CSSValueNormal) | |
522 return consumeIdent(range); | |
523 // TODO(timloh): allow <percentage>s in word-spacing. | |
524 return consumeLength(range, cssParserMode, ValueRangeAll, | |
525 UnitlessQuirk::Allow); | |
526 } | |
527 | |
528 static CSSValue* consumeFontSize( | 519 static CSSValue* consumeFontSize( |
529 CSSParserTokenRange& range, | 520 CSSParserTokenRange& range, |
530 CSSParserMode cssParserMode, | 521 CSSParserMode cssParserMode, |
531 UnitlessQuirk unitless = UnitlessQuirk::Forbid) { | 522 UnitlessQuirk unitless = UnitlessQuirk::Forbid) { |
532 if (range.peek().id() >= CSSValueXxSmall && | 523 if (range.peek().id() >= CSSValueXxSmall && |
533 range.peek().id() <= CSSValueLarger) | 524 range.peek().id() <= CSSValueLarger) |
534 return consumeIdent(range); | 525 return consumeIdent(range); |
535 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, | 526 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, |
536 unitless); | 527 unitless); |
537 } | 528 } |
(...skipping 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2819 case CSSPropertyFontVariantCaps: | 2810 case CSSPropertyFontVariantCaps: |
2820 return consumeFontVariantCaps(m_range); | 2811 return consumeFontVariantCaps(m_range); |
2821 case CSSPropertyFontVariantNumeric: | 2812 case CSSPropertyFontVariantNumeric: |
2822 return consumeFontVariantNumeric(m_range); | 2813 return consumeFontVariantNumeric(m_range); |
2823 case CSSPropertyFontFeatureSettings: | 2814 case CSSPropertyFontFeatureSettings: |
2824 return consumeFontFeatureSettings(m_range); | 2815 return consumeFontFeatureSettings(m_range); |
2825 case CSSPropertyFontFamily: | 2816 case CSSPropertyFontFamily: |
2826 return consumeFontFamily(m_range); | 2817 return consumeFontFamily(m_range); |
2827 case CSSPropertyFontWeight: | 2818 case CSSPropertyFontWeight: |
2828 return consumeFontWeight(m_range); | 2819 return consumeFontWeight(m_range); |
2829 case CSSPropertyLetterSpacing: | |
2830 case CSSPropertyWordSpacing: | |
2831 return consumeSpacing(m_range, m_context->mode()); | |
2832 case CSSPropertyFontSize: | 2820 case CSSPropertyFontSize: |
2833 return consumeFontSize(m_range, m_context->mode(), UnitlessQuirk::Allow); | 2821 return consumeFontSize(m_range, m_context->mode(), UnitlessQuirk::Allow); |
2834 case CSSPropertyLineHeight: | 2822 case CSSPropertyLineHeight: |
2835 return consumeLineHeight(m_range, m_context->mode()); | 2823 return consumeLineHeight(m_range, m_context->mode()); |
2836 case CSSPropertyScale: | 2824 case CSSPropertyScale: |
2837 return consumeScale(m_range); | 2825 return consumeScale(m_range); |
2838 case CSSPropertyWebkitBorderHorizontalSpacing: | 2826 case CSSPropertyWebkitBorderHorizontalSpacing: |
2839 case CSSPropertyWebkitBorderVerticalSpacing: | 2827 case CSSPropertyWebkitBorderVerticalSpacing: |
2840 return consumeLength(m_range, m_context->mode(), ValueRangeNonNegative); | 2828 return consumeLength(m_range, m_context->mode(), ValueRangeNonNegative); |
2841 case CSSPropertyCounterIncrement: | 2829 case CSSPropertyCounterIncrement: |
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4629 case CSSPropertyGridTemplate: | 4617 case CSSPropertyGridTemplate: |
4630 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 4618 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
4631 case CSSPropertyGrid: | 4619 case CSSPropertyGrid: |
4632 return consumeGridShorthand(important); | 4620 return consumeGridShorthand(important); |
4633 default: | 4621 default: |
4634 return false; | 4622 return false; |
4635 } | 4623 } |
4636 } | 4624 } |
4637 | 4625 |
4638 } // namespace blink | 4626 } // namespace blink |
OLD | NEW |