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" |
11 #include "core/css/CSSCounterValue.h" | 11 #include "core/css/CSSCounterValue.h" |
12 #include "core/css/CSSCursorImageValue.h" | 12 #include "core/css/CSSCursorImageValue.h" |
13 #include "core/css/CSSCustomIdentValue.h" | 13 #include "core/css/CSSCustomIdentValue.h" |
14 #include "core/css/CSSFontFaceSrcValue.h" | 14 #include "core/css/CSSFontFaceSrcValue.h" |
15 #include "core/css/CSSFontFamilyValue.h" | 15 #include "core/css/CSSFontFamilyValue.h" |
16 #include "core/css/CSSFontFeatureValue.h" | 16 #include "core/css/CSSFontFeatureValue.h" |
17 #include "core/css/CSSFunctionValue.h" | 17 #include "core/css/CSSFunctionValue.h" |
18 #include "core/css/CSSGridAutoRepeatValue.h" | 18 #include "core/css/CSSGridAutoRepeatValue.h" |
19 #include "core/css/CSSGridLineNamesValue.h" | 19 #include "core/css/CSSGridLineNamesValue.h" |
20 #include "core/css/CSSGridTemplateAreasValue.h" | 20 #include "core/css/CSSGridTemplateAreasValue.h" |
21 #include "core/css/CSSIdentifierValue.h" | |
21 #include "core/css/CSSInheritedValue.h" | 22 #include "core/css/CSSInheritedValue.h" |
22 #include "core/css/CSSInitialValue.h" | 23 #include "core/css/CSSInitialValue.h" |
23 #include "core/css/CSSPathValue.h" | 24 #include "core/css/CSSPathValue.h" |
24 #include "core/css/CSSPendingSubstitutionValue.h" | 25 #include "core/css/CSSPendingSubstitutionValue.h" |
25 #include "core/css/CSSPrimitiveValueMappings.h" | 26 #include "core/css/CSSPrimitiveValueMappings.h" |
26 #include "core/css/CSSQuadValue.h" | 27 #include "core/css/CSSQuadValue.h" |
27 #include "core/css/CSSReflectValue.h" | 28 #include "core/css/CSSReflectValue.h" |
28 #include "core/css/CSSShadowValue.h" | 29 #include "core/css/CSSShadowValue.h" |
29 #include "core/css/CSSStringValue.h" | 30 #include "core/css/CSSStringValue.h" |
30 #include "core/css/CSSTimingFunctionValue.h" | 31 #include "core/css/CSSTimingFunctionValue.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 default: | 454 default: |
454 return ParseResult::UnknownValue; | 455 return ParseResult::UnknownValue; |
455 } | 456 } |
456 m_result->append(*consumeIdent(range)); | 457 m_result->append(*consumeIdent(range)); |
457 return ParseResult::ConsumedValue; | 458 return ParseResult::ConsumedValue; |
458 } | 459 } |
459 | 460 |
460 CSSValue* finalizeValue() | 461 CSSValue* finalizeValue() |
461 { | 462 { |
462 if (!m_result->length()) | 463 if (!m_result->length()) |
463 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); | 464 return CSSIdentifierValue::createIdentifier(CSSValueNormal); |
464 return m_result.release(); | 465 return m_result.release(); |
465 } | 466 } |
466 | 467 |
467 private: | 468 private: |
468 bool m_sawCommonLigaturesValue; | 469 bool m_sawCommonLigaturesValue; |
469 bool m_sawDiscretionaryLigaturesValue; | 470 bool m_sawDiscretionaryLigaturesValue; |
470 bool m_sawHistoricalLigaturesValue; | 471 bool m_sawHistoricalLigaturesValue; |
471 bool m_sawContextualLigaturesValue; | 472 bool m_sawContextualLigaturesValue; |
472 Member<CSSValueList> m_result; | 473 Member<CSSValueList> m_result; |
473 }; | 474 }; |
474 | 475 |
475 static CSSValue* consumeFontVariantLigatures(CSSParserTokenRange& range) | 476 static CSSValue* consumeFontVariantLigatures(CSSParserTokenRange& range) |
476 { | 477 { |
477 if (range.peek().id() == CSSValueNormal || range.peek().id() == CSSValueNone ) | 478 if (range.peek().id() == CSSValueNormal || range.peek().id() == CSSValueNone ) |
478 return consumeIdent(range); | 479 return consumeIdent(range); |
479 | 480 |
480 FontVariantLigaturesParser ligaturesParser; | 481 FontVariantLigaturesParser ligaturesParser; |
481 do { | 482 do { |
482 if (ligaturesParser.consumeLigature(range) != | 483 if (ligaturesParser.consumeLigature(range) != |
483 FontVariantLigaturesParser::ParseResult::ConsumedValue) | 484 FontVariantLigaturesParser::ParseResult::ConsumedValue) |
484 return nullptr; | 485 return nullptr; |
485 } while (!range.atEnd()); | 486 } while (!range.atEnd()); |
486 | 487 |
487 return ligaturesParser.finalizeValue(); | 488 return ligaturesParser.finalizeValue(); |
488 } | 489 } |
489 | 490 |
490 static CSSPrimitiveValue* consumeFontVariantCaps(CSSParserTokenRange& range) | 491 static CSSIdentifierValue* consumeFontVariantCaps(CSSParserTokenRange& range) |
491 { | 492 { |
492 return consumeIdent<CSSValueNormal, CSSValueSmallCaps, CSSValueAllSmallCaps, | 493 return consumeIdent<CSSValueNormal, CSSValueSmallCaps, CSSValueAllSmallCaps, |
493 CSSValuePetiteCaps, CSSValueAllPetiteCaps, | 494 CSSValuePetiteCaps, CSSValueAllPetiteCaps, |
494 CSSValueUnicase, CSSValueTitlingCaps>(range); | 495 CSSValueUnicase, CSSValueTitlingCaps>(range); |
495 } | 496 } |
496 | 497 |
497 class FontVariantNumericParser { | 498 class FontVariantNumericParser { |
498 STACK_ALLOCATED(); | 499 STACK_ALLOCATED(); |
499 | 500 |
500 public: | 501 public: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 default: | 550 default: |
550 return ParseResult::UnknownValue; | 551 return ParseResult::UnknownValue; |
551 } | 552 } |
552 m_result->append(*consumeIdent(range)); | 553 m_result->append(*consumeIdent(range)); |
553 return ParseResult::ConsumedValue; | 554 return ParseResult::ConsumedValue; |
554 } | 555 } |
555 | 556 |
556 CSSValue* finalizeValue() | 557 CSSValue* finalizeValue() |
557 { | 558 { |
558 if (!m_result->length()) | 559 if (!m_result->length()) |
559 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); | 560 return CSSIdentifierValue::createIdentifier(CSSValueNormal); |
560 return m_result.release(); | 561 return m_result.release(); |
561 } | 562 } |
562 | 563 |
563 | 564 |
564 private: | 565 private: |
565 bool m_sawNumericFigureValue; | 566 bool m_sawNumericFigureValue; |
566 bool m_sawNumericSpacingValue; | 567 bool m_sawNumericSpacingValue; |
567 bool m_sawNumericFractionValue; | 568 bool m_sawNumericFractionValue; |
568 bool m_sawOrdinalValue; | 569 bool m_sawOrdinalValue; |
569 bool m_sawSlashedZeroValue; | 570 bool m_sawSlashedZeroValue; |
570 Member<CSSValueList> m_result; | 571 Member<CSSValueList> m_result; |
571 }; | 572 }; |
572 | 573 |
573 static CSSValue* consumeFontVariantNumeric(CSSParserTokenRange& range) | 574 static CSSValue* consumeFontVariantNumeric(CSSParserTokenRange& range) |
574 { | 575 { |
575 if (range.peek().id() == CSSValueNormal) | 576 if (range.peek().id() == CSSValueNormal) |
576 return consumeIdent(range); | 577 return consumeIdent(range); |
577 | 578 |
578 FontVariantNumericParser numericParser; | 579 FontVariantNumericParser numericParser; |
579 do { | 580 do { |
580 if (numericParser.consumeNumeric(range) != | 581 if (numericParser.consumeNumeric(range) != |
581 FontVariantNumericParser::ParseResult::ConsumedValue) | 582 FontVariantNumericParser::ParseResult::ConsumedValue) |
582 return nullptr; | 583 return nullptr; |
583 } while (!range.atEnd()); | 584 } while (!range.atEnd()); |
584 | 585 |
585 return numericParser.finalizeValue(); | 586 return numericParser.finalizeValue(); |
586 } | 587 } |
587 | 588 |
588 static CSSPrimitiveValue* consumeFontVariantCSS21(CSSParserTokenRange& range) | 589 static CSSIdentifierValue* consumeFontVariantCSS21(CSSParserTokenRange& range) |
589 { | 590 { |
590 return consumeIdent<CSSValueNormal, CSSValueSmallCaps>(range); | 591 return consumeIdent<CSSValueNormal, CSSValueSmallCaps>(range); |
591 } | 592 } |
592 | 593 |
593 static CSSValue* consumeFontVariantList(CSSParserTokenRange& range) | 594 static CSSValue* consumeFontVariantList(CSSParserTokenRange& range) |
594 { | 595 { |
595 CSSValueList* values = CSSValueList::createCommaSeparated(); | 596 CSSValueList* values = CSSValueList::createCommaSeparated(); |
596 do { | 597 do { |
597 if (range.peek().id() == CSSValueAll) { | 598 if (range.peek().id() == CSSValueAll) { |
598 // FIXME: CSSPropertyParser::parseFontVariant() implements | 599 // FIXME: CSSPropertyParser::parseFontVariant() implements |
599 // the old css3 draft: | 600 // the old css3 draft: |
600 // http://www.w3.org/TR/2002/WD-css3-webfonts-20020802/#font-variant | 601 // http://www.w3.org/TR/2002/WD-css3-webfonts-20020802/#font-variant |
601 // 'all' is only allowed in @font-face and with no other values. | 602 // 'all' is only allowed in @font-face and with no other values. |
602 if (values->length()) | 603 if (values->length()) |
603 return nullptr; | 604 return nullptr; |
604 return consumeIdent(range); | 605 return consumeIdent(range); |
605 } | 606 } |
606 CSSPrimitiveValue* fontVariant = consumeFontVariantCSS21(range); | 607 CSSIdentifierValue* fontVariant = consumeFontVariantCSS21(range); |
607 if (fontVariant) | 608 if (fontVariant) |
608 values->append(*fontVariant); | 609 values->append(*fontVariant); |
609 } while (consumeCommaIncludingWhitespace(range)); | 610 } while (consumeCommaIncludingWhitespace(range)); |
610 | 611 |
611 if (values->length()) | 612 if (values->length()) |
612 return values; | 613 return values; |
613 | 614 |
614 return nullptr; | 615 return nullptr; |
615 } | 616 } |
616 | 617 |
617 static CSSPrimitiveValue* consumeFontWeight(CSSParserTokenRange& range) | 618 static CSSIdentifierValue* consumeFontWeight(CSSParserTokenRange& range) |
618 { | 619 { |
619 const CSSParserToken& token = range.peek(); | 620 const CSSParserToken& token = range.peek(); |
620 if (token.id() >= CSSValueNormal && token.id() <= CSSValueLighter) | 621 if (token.id() >= CSSValueNormal && token.id() <= CSSValueLighter) |
621 return consumeIdent(range); | 622 return consumeIdent(range); |
622 if (token.type() != NumberToken || token.numericValueType() != IntegerValueT ype) | 623 if (token.type() != NumberToken || token.numericValueType() != IntegerValueT ype) |
623 return nullptr; | 624 return nullptr; |
624 int weight = static_cast<int>(token.numericValue()); | 625 int weight = static_cast<int>(token.numericValue()); |
625 if ((weight % 100) || weight < 100 || weight > 900) | 626 if ((weight % 100) || weight < 100 || weight > 900) |
626 return nullptr; | 627 return nullptr; |
627 range.consumeIncludingWhitespace(); | 628 range.consumeIncludingWhitespace(); |
628 return CSSPrimitiveValue::createIdentifier(static_cast<CSSValueID>(CSSValue1 00 + weight / 100 - 1)); | 629 return CSSIdentifierValue::createIdentifier(static_cast<CSSValueID>(CSSValue 100 + weight / 100 - 1)); |
629 } | 630 } |
630 | 631 |
631 static String concatenateFamilyName(CSSParserTokenRange& range) | 632 static String concatenateFamilyName(CSSParserTokenRange& range) |
632 { | 633 { |
633 StringBuilder builder; | 634 StringBuilder builder; |
634 bool addedSpace = false; | 635 bool addedSpace = false; |
635 const CSSParserToken& firstToken = range.peek(); | 636 const CSSParserToken& firstToken = range.peek(); |
636 while (range.peek().type() == IdentToken) { | 637 while (range.peek().type() == IdentToken) { |
637 if (!builder.isEmpty()) { | 638 if (!builder.isEmpty()) { |
638 builder.append(' '); | 639 builder.append(' '); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
706 return consumePercent(range, ValueRangeNonNegative); | 707 return consumePercent(range, ValueRangeNonNegative); |
707 } | 708 } |
708 | 709 |
709 static CSSValue* consumeFontSize(CSSParserTokenRange& range, CSSParserMode cssPa rserMode, UnitlessQuirk unitless = UnitlessQuirk::Forbid) | 710 static CSSValue* consumeFontSize(CSSParserTokenRange& range, CSSParserMode cssPa rserMode, UnitlessQuirk unitless = UnitlessQuirk::Forbid) |
710 { | 711 { |
711 if (range.peek().id() >= CSSValueXxSmall && range.peek().id() <= CSSValueLar ger) | 712 if (range.peek().id() >= CSSValueXxSmall && range.peek().id() <= CSSValueLar ger) |
712 return consumeIdent(range); | 713 return consumeIdent(range); |
713 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, u nitless); | 714 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, u nitless); |
714 } | 715 } |
715 | 716 |
716 static CSSPrimitiveValue* consumeLineHeight(CSSParserTokenRange& range, CSSParse rMode cssParserMode) | 717 static CSSValue* consumeLineHeight(CSSParserTokenRange& range, CSSParserMode css ParserMode) |
717 { | 718 { |
718 if (range.peek().id() == CSSValueNormal) | 719 if (range.peek().id() == CSSValueNormal) |
719 return consumeIdent(range); | 720 return consumeIdent(range); |
720 | 721 |
721 CSSPrimitiveValue* lineHeight = consumeNumber(range, ValueRangeNonNegative); | 722 CSSPrimitiveValue* lineHeight = consumeNumber(range, ValueRangeNonNegative); |
722 if (lineHeight) | 723 if (lineHeight) |
723 return lineHeight; | 724 return lineHeight; |
724 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative); | 725 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative); |
725 } | 726 } |
726 | 727 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
941 return consumeLengthOrPercent(range, context.mode(), ValueRangeNonNegative, unitless); | 942 return consumeLengthOrPercent(range, context.mode(), ValueRangeNonNegative, unitless); |
942 } | 943 } |
943 | 944 |
944 static CSSValue* consumeMarginOrOffset(CSSParserTokenRange& range, CSSParserMode cssParserMode, UnitlessQuirk unitless) | 945 static CSSValue* consumeMarginOrOffset(CSSParserTokenRange& range, CSSParserMode cssParserMode, UnitlessQuirk unitless) |
945 { | 946 { |
946 if (range.peek().id() == CSSValueAuto) | 947 if (range.peek().id() == CSSValueAuto) |
947 return consumeIdent(range); | 948 return consumeIdent(range); |
948 return consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, unitless) ; | 949 return consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, unitless) ; |
949 } | 950 } |
950 | 951 |
951 static CSSPrimitiveValue* consumeClipComponent(CSSParserTokenRange& range, CSSPa rserMode cssParserMode) | 952 static CSSValue* consumeClipComponent(CSSParserTokenRange& range, CSSParserMode cssParserMode) |
952 { | 953 { |
953 if (range.peek().id() == CSSValueAuto) | 954 if (range.peek().id() == CSSValueAuto) |
954 return consumeIdent(range); | 955 return consumeIdent(range); |
955 return consumeLength(range, cssParserMode, ValueRangeAll, UnitlessQuirk::All ow); | 956 return consumeLength(range, cssParserMode, ValueRangeAll, UnitlessQuirk::All ow); |
956 } | 957 } |
957 | 958 |
958 static CSSValue* consumeClip(CSSParserTokenRange& range, CSSParserMode cssParser Mode) | 959 static CSSValue* consumeClip(CSSParserTokenRange& range, CSSParserMode cssParser Mode) |
959 { | 960 { |
960 if (range.peek().id() == CSSValueAuto) | 961 if (range.peek().id() == CSSValueAuto) |
961 return consumeIdent(range); | 962 return consumeIdent(range); |
962 | 963 |
963 if (range.peek().functionId() != CSSValueRect) | 964 if (range.peek().functionId() != CSSValueRect) |
964 return nullptr; | 965 return nullptr; |
965 | 966 |
966 CSSParserTokenRange args = consumeFunction(range); | 967 CSSParserTokenRange args = consumeFunction(range); |
967 // rect(t, r, b, l) || rect(t r b l) | 968 // rect(t, r, b, l) || rect(t r b l) |
968 CSSPrimitiveValue* top = consumeClipComponent(args, cssParserMode); | 969 CSSValue* top = consumeClipComponent(args, cssParserMode); |
969 if (!top) | 970 if (!top) |
970 return nullptr; | 971 return nullptr; |
971 bool needsComma = consumeCommaIncludingWhitespace(args); | 972 bool needsComma = consumeCommaIncludingWhitespace(args); |
972 CSSPrimitiveValue* right = consumeClipComponent(args, cssParserMode); | 973 CSSValue* right = consumeClipComponent(args, cssParserMode); |
973 if (!right || (needsComma && !consumeCommaIncludingWhitespace(args))) | 974 if (!right || (needsComma && !consumeCommaIncludingWhitespace(args))) |
974 return nullptr; | 975 return nullptr; |
975 CSSPrimitiveValue* bottom = consumeClipComponent(args, cssParserMode); | 976 CSSValue* bottom = consumeClipComponent(args, cssParserMode); |
976 if (!bottom || (needsComma && !consumeCommaIncludingWhitespace(args))) | 977 if (!bottom || (needsComma && !consumeCommaIncludingWhitespace(args))) |
977 return nullptr; | 978 return nullptr; |
978 CSSPrimitiveValue* left = consumeClipComponent(args, cssParserMode); | 979 CSSValue* left = consumeClipComponent(args, cssParserMode); |
979 if (!left || !args.atEnd()) | 980 if (!left || !args.atEnd()) |
980 return nullptr; | 981 return nullptr; |
981 return CSSQuadValue::create(top, right, bottom, left, CSSQuadValue::Serializ eAsRect); | 982 return CSSQuadValue::create(top, right, bottom, left, CSSQuadValue::Serializ eAsRect); |
982 } | 983 } |
983 | 984 |
984 static bool consumePan(CSSParserTokenRange& range, CSSValue*& panX, CSSValue*& p anY) | 985 static bool consumePan(CSSParserTokenRange& range, CSSValue*& panX, CSSValue*& p anY) |
985 { | 986 { |
986 CSSValueID id = range.peek().id(); | 987 CSSValueID id = range.peek().id(); |
987 if ((id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft) && !panX) { | 988 if ((id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft) && !panX) { |
988 if (id != CSSValuePanX && !RuntimeEnabledFeatures::cssTouchActionPanDire ctionsEnabled()) | 989 if (id != CSSValuePanX && !RuntimeEnabledFeatures::cssTouchActionPanDire ctionsEnabled()) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1066 } | 1067 } |
1067 | 1068 |
1068 static CSSValue* consumeColumnSpan(CSSParserTokenRange& range) | 1069 static CSSValue* consumeColumnSpan(CSSParserTokenRange& range) |
1069 { | 1070 { |
1070 return consumeIdent<CSSValueAll, CSSValueNone>(range); | 1071 return consumeIdent<CSSValueAll, CSSValueNone>(range); |
1071 } | 1072 } |
1072 | 1073 |
1073 static CSSValue* consumeZoom(CSSParserTokenRange& range, const CSSParserContext& context) | 1074 static CSSValue* consumeZoom(CSSParserTokenRange& range, const CSSParserContext& context) |
1074 { | 1075 { |
1075 const CSSParserToken& token = range.peek(); | 1076 const CSSParserToken& token = range.peek(); |
1076 CSSPrimitiveValue* zoom = nullptr; | 1077 CSSValue* zoom = nullptr; |
1077 if (token.type() == IdentToken) { | 1078 if (token.type() == IdentToken) { |
1078 zoom = consumeIdent<CSSValueNormal, CSSValueReset, CSSValueDocument>(ran ge); | 1079 zoom = consumeIdent<CSSValueNormal, CSSValueReset, CSSValueDocument>(ran ge); |
1079 } else { | 1080 } else { |
1080 zoom = consumePercent(range, ValueRangeNonNegative); | 1081 zoom = consumePercent(range, ValueRangeNonNegative); |
1081 if (!zoom) | 1082 if (!zoom) |
1082 zoom = consumeNumber(range, ValueRangeNonNegative); | 1083 zoom = consumeNumber(range, ValueRangeNonNegative); |
1083 } | 1084 } |
1084 if (zoom && context.useCounter()) { | 1085 if (zoom && context.useCounter()) { |
1085 if (!(token.id() == CSSValueNormal | 1086 if (!(token.id() == CSSValueNormal |
1086 || (token.type() == NumberToken && zoom->getDoubleValue() == 1) | 1087 || (token.type() == NumberToken && toCSSPrimitiveValue(zoom)->getDou bleValue() == 1) |
1087 || (token.type() == PercentageToken && zoom->getDoubleValue() == 100 ))) | 1088 || (token.type() == PercentageToken && toCSSPrimitiveValue(zoom)->ge tDoubleValue() == 100))) |
1088 context.useCounter()->count(UseCounter::CSSZoomNotEqualToOne); | 1089 context.useCounter()->count(UseCounter::CSSZoomNotEqualToOne); |
1089 if (token.id() == CSSValueReset) | 1090 if (token.id() == CSSValueReset) |
1090 context.useCounter()->count(UseCounter::CSSZoomReset); | 1091 context.useCounter()->count(UseCounter::CSSZoomReset); |
1091 if (token.id() == CSSValueDocument) | 1092 if (token.id() == CSSValueDocument) |
1092 context.useCounter()->count(UseCounter::CSSZoomDocument); | 1093 context.useCounter()->count(UseCounter::CSSZoomDocument); |
1093 } | 1094 } |
1094 return zoom; | 1095 return zoom; |
1095 } | 1096 } |
1096 | 1097 |
1097 static CSSValue* consumeAnimationIterationCount(CSSParserTokenRange& range) | 1098 static CSSValue* consumeAnimationIterationCount(CSSParserTokenRange& range) |
1098 { | 1099 { |
1099 if (range.peek().id() == CSSValueInfinite) | 1100 if (range.peek().id() == CSSValueInfinite) |
1100 return consumeIdent(range); | 1101 return consumeIdent(range); |
1101 return consumeNumber(range, ValueRangeNonNegative); | 1102 return consumeNumber(range, ValueRangeNonNegative); |
1102 } | 1103 } |
1103 | 1104 |
1104 static CSSValue* consumeAnimationName(CSSParserTokenRange& range, const CSSParse rContext& context, bool allowQuotedName) | 1105 static CSSValue* consumeAnimationName(CSSParserTokenRange& range, const CSSParse rContext& context, bool allowQuotedName) |
1105 { | 1106 { |
1106 if (range.peek().id() == CSSValueNone) | 1107 if (range.peek().id() == CSSValueNone) |
1107 return consumeIdent(range); | 1108 return consumeIdent(range); |
1108 | 1109 |
1109 if (allowQuotedName && range.peek().type() == StringToken) { | 1110 if (allowQuotedName && range.peek().type() == StringToken) { |
1110 // Legacy support for strings in prefixed animations. | 1111 // Legacy support for strings in prefixed animations. |
1111 if (context.useCounter()) | 1112 if (context.useCounter()) |
1112 context.useCounter()->count(UseCounter::QuotedAnimationName); | 1113 context.useCounter()->count(UseCounter::QuotedAnimationName); |
1113 | 1114 |
1114 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 1115 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
1115 if (equalIgnoringASCIICase(token.value(), "none")) | 1116 if (equalIgnoringASCIICase(token.value(), "none")) |
1116 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1117 return CSSIdentifierValue::createIdentifier(CSSValueNone); |
1117 return CSSCustomIdentValue::create(token.value().toAtomicString()); | 1118 return CSSCustomIdentValue::create(token.value().toAtomicString()); |
1118 } | 1119 } |
1119 | 1120 |
1120 return consumeCustomIdent(range); | 1121 return consumeCustomIdent(range); |
1121 } | 1122 } |
1122 | 1123 |
1123 static CSSValue* consumeTransitionProperty(CSSParserTokenRange& range) | 1124 static CSSValue* consumeTransitionProperty(CSSParserTokenRange& range) |
1124 { | 1125 { |
1125 const CSSParserToken& token = range.peek(); | 1126 const CSSParserToken& token = range.peek(); |
1126 if (token.type() != IdentToken) | 1127 if (token.type() != IdentToken) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1241 ASSERT_NOT_REACHED(); | 1242 ASSERT_NOT_REACHED(); |
1242 return nullptr; | 1243 return nullptr; |
1243 } | 1244 } |
1244 } | 1245 } |
1245 | 1246 |
1246 static bool isValidAnimationPropertyList(CSSPropertyID property, const CSSValueL ist& valueList) | 1247 static bool isValidAnimationPropertyList(CSSPropertyID property, const CSSValueL ist& valueList) |
1247 { | 1248 { |
1248 if (property != CSSPropertyTransitionProperty || valueList.length() < 2) | 1249 if (property != CSSPropertyTransitionProperty || valueList.length() < 2) |
1249 return true; | 1250 return true; |
1250 for (auto& value : valueList) { | 1251 for (auto& value : valueList) { |
1251 if (value->isPrimitiveValue() && toCSSPrimitiveValue(*value).isValueID() | 1252 if (value->isIdentifierValue() && toCSSIdentifierValue(*value).getValueI D() == CSSValueNone) |
1252 && toCSSPrimitiveValue(*value).getValueID() == CSSValueNone) | |
1253 return false; | 1253 return false; |
1254 } | 1254 } |
1255 return true; | 1255 return true; |
1256 } | 1256 } |
1257 | 1257 |
1258 static CSSValueList* consumeAnimationPropertyList(CSSPropertyID property, CSSPar serTokenRange& range, const CSSParserContext& context, bool useLegacyParsing) | 1258 static CSSValueList* consumeAnimationPropertyList(CSSPropertyID property, CSSPar serTokenRange& range, const CSSParserContext& context, bool useLegacyParsing) |
1259 { | 1259 { |
1260 CSSValueList* list = CSSValueList::createCommaSeparated(); | 1260 CSSValueList* list = CSSValueList::createCommaSeparated(); |
1261 do { | 1261 do { |
1262 CSSValue* value = consumeAnimationValue(property, range, context, useLeg acyParsing); | 1262 CSSValue* value = consumeAnimationValue(property, range, context, useLeg acyParsing); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1318 | 1318 |
1319 static CSSValue* consumeZIndex(CSSParserTokenRange& range) | 1319 static CSSValue* consumeZIndex(CSSParserTokenRange& range) |
1320 { | 1320 { |
1321 if (range.peek().id() == CSSValueAuto) | 1321 if (range.peek().id() == CSSValueAuto) |
1322 return consumeIdent(range); | 1322 return consumeIdent(range); |
1323 return consumeInteger(range); | 1323 return consumeInteger(range); |
1324 } | 1324 } |
1325 | 1325 |
1326 static CSSShadowValue* parseSingleShadow(CSSParserTokenRange& range, CSSParserMo de cssParserMode, bool allowInset, bool allowSpread) | 1326 static CSSShadowValue* parseSingleShadow(CSSParserTokenRange& range, CSSParserMo de cssParserMode, bool allowInset, bool allowSpread) |
1327 { | 1327 { |
1328 CSSPrimitiveValue* style = nullptr; | 1328 CSSIdentifierValue* style = nullptr; |
1329 CSSValue* color = nullptr; | 1329 CSSValue* color = nullptr; |
1330 | 1330 |
1331 if (range.atEnd()) | 1331 if (range.atEnd()) |
1332 return nullptr; | 1332 return nullptr; |
1333 if (range.peek().id() == CSSValueInset) { | 1333 if (range.peek().id() == CSSValueInset) { |
1334 if (!allowInset) | 1334 if (!allowInset) |
1335 return nullptr; | 1335 return nullptr; |
1336 style = consumeIdent(range); | 1336 style = consumeIdent(range); |
1337 } | 1337 } |
1338 color = consumeColor(range, cssParserMode); | 1338 color = consumeColor(range, cssParserMode); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1450 } | 1450 } |
1451 | 1451 |
1452 static CSSValue* consumeTextDecorationLine(CSSParserTokenRange& range) | 1452 static CSSValue* consumeTextDecorationLine(CSSParserTokenRange& range) |
1453 { | 1453 { |
1454 CSSValueID id = range.peek().id(); | 1454 CSSValueID id = range.peek().id(); |
1455 if (id == CSSValueNone) | 1455 if (id == CSSValueNone) |
1456 return consumeIdent(range); | 1456 return consumeIdent(range); |
1457 | 1457 |
1458 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1458 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
1459 while (true) { | 1459 while (true) { |
1460 CSSPrimitiveValue* ident = consumeIdent<CSSValueBlink, CSSValueUnderline , CSSValueOverline, CSSValueLineThrough>(range); | 1460 CSSIdentifierValue* ident = consumeIdent<CSSValueBlink, CSSValueUnderlin e, CSSValueOverline, CSSValueLineThrough>(range); |
1461 if (!ident) | 1461 if (!ident) |
1462 break; | 1462 break; |
1463 if (list->hasValue(*ident)) | 1463 if (list->hasValue(*ident)) |
1464 return nullptr; | 1464 return nullptr; |
1465 list->append(*ident); | 1465 list->append(*ident); |
1466 } | 1466 } |
1467 | 1467 |
1468 if (!list->length()) | 1468 if (!list->length()) |
1469 return nullptr; | 1469 return nullptr; |
1470 return list; | 1470 return list; |
1471 } | 1471 } |
1472 | 1472 |
1473 // none | strict | content | [ layout || style || paint || size ] | 1473 // none | strict | content | [ layout || style || paint || size ] |
1474 static CSSValue* consumeContain(CSSParserTokenRange& range) | 1474 static CSSValue* consumeContain(CSSParserTokenRange& range) |
1475 { | 1475 { |
1476 CSSValueID id = range.peek().id(); | 1476 CSSValueID id = range.peek().id(); |
1477 if (id == CSSValueNone) | 1477 if (id == CSSValueNone) |
1478 return consumeIdent(range); | 1478 return consumeIdent(range); |
1479 | 1479 |
1480 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1480 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
1481 if (id == CSSValueStrict || id == CSSValueContent) { | 1481 if (id == CSSValueStrict || id == CSSValueContent) { |
1482 list->append(*consumeIdent(range)); | 1482 list->append(*consumeIdent(range)); |
1483 return list; | 1483 return list; |
1484 } | 1484 } |
1485 while (true) { | 1485 while (true) { |
1486 CSSPrimitiveValue* ident = consumeIdent<CSSValuePaint, CSSValueLayout, C SSValueStyle, CSSValueSize>(range); | 1486 CSSIdentifierValue* ident = consumeIdent<CSSValuePaint, CSSValueLayout, CSSValueStyle, CSSValueSize>(range); |
1487 if (!ident) | 1487 if (!ident) |
1488 break; | 1488 break; |
1489 if (list->hasValue(*ident)) | 1489 if (list->hasValue(*ident)) |
1490 return nullptr; | 1490 return nullptr; |
1491 list->append(*ident); | 1491 list->append(*ident); |
1492 } | 1492 } |
1493 | 1493 |
1494 if (!list->length()) | 1494 if (!list->length()) |
1495 return nullptr; | 1495 return nullptr; |
1496 return list; | 1496 return list; |
(...skipping 12 matching lines...) Expand all Loading... | |
1509 return nullptr; | 1509 return nullptr; |
1510 String pathString = functionArgs.consumeIncludingWhitespace().value().toStri ng(); | 1510 String pathString = functionArgs.consumeIncludingWhitespace().value().toStri ng(); |
1511 | 1511 |
1512 std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); | 1512 std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); |
1513 if (buildByteStreamFromString(pathString, *byteStream) != SVGParseStatus::No Error | 1513 if (buildByteStreamFromString(pathString, *byteStream) != SVGParseStatus::No Error |
1514 || !functionArgs.atEnd()) | 1514 || !functionArgs.atEnd()) |
1515 return nullptr; | 1515 return nullptr; |
1516 | 1516 |
1517 range = functionRange; | 1517 range = functionRange; |
1518 if (byteStream->isEmpty()) | 1518 if (byteStream->isEmpty()) |
1519 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1519 return CSSIdentifierValue::createIdentifier(CSSValueNone); |
1520 return CSSPathValue::create(std::move(byteStream)); | 1520 return CSSPathValue::create(std::move(byteStream)); |
1521 } | 1521 } |
1522 | 1522 |
1523 static CSSValue* consumePathOrNone(CSSParserTokenRange& range) | 1523 static CSSValue* consumePathOrNone(CSSParserTokenRange& range) |
1524 { | 1524 { |
1525 CSSValueID id = range.peek().id(); | 1525 CSSValueID id = range.peek().id(); |
1526 if (id == CSSValueNone) | 1526 if (id == CSSValueNone) |
1527 return consumeIdent(range); | 1527 return consumeIdent(range); |
1528 | 1528 |
1529 return consumePath(range); | 1529 return consumePath(range); |
(...skipping 19 matching lines...) Expand all Loading... | |
1549 | 1549 |
1550 static CSSValue* consumeTextEmphasisStyle(CSSParserTokenRange& range) | 1550 static CSSValue* consumeTextEmphasisStyle(CSSParserTokenRange& range) |
1551 { | 1551 { |
1552 CSSValueID id = range.peek().id(); | 1552 CSSValueID id = range.peek().id(); |
1553 if (id == CSSValueNone) | 1553 if (id == CSSValueNone) |
1554 return consumeIdent(range); | 1554 return consumeIdent(range); |
1555 | 1555 |
1556 if (CSSValue* textEmphasisStyle = consumeString(range)) | 1556 if (CSSValue* textEmphasisStyle = consumeString(range)) |
1557 return textEmphasisStyle; | 1557 return textEmphasisStyle; |
1558 | 1558 |
1559 CSSPrimitiveValue* fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range); | 1559 CSSIdentifierValue* fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range) ; |
1560 CSSPrimitiveValue* shape = consumeIdent<CSSValueDot, CSSValueCircle, CSSValu eDoubleCircle, CSSValueTriangle, CSSValueSesame>(range); | 1560 CSSIdentifierValue* shape = consumeIdent<CSSValueDot, CSSValueCircle, CSSVal ueDoubleCircle, CSSValueTriangle, CSSValueSesame>(range); |
1561 if (!fill) | 1561 if (!fill) |
1562 fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range); | 1562 fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range); |
1563 if (fill && shape) { | 1563 if (fill && shape) { |
1564 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); | 1564 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); |
1565 parsedValues->append(*fill); | 1565 parsedValues->append(*fill); |
1566 parsedValues->append(*shape); | 1566 parsedValues->append(*shape); |
1567 return parsedValues; | 1567 return parsedValues; |
1568 } | 1568 } |
1569 if (fill) | 1569 if (fill) |
1570 return fill; | 1570 return fill; |
1571 if (shape) | 1571 if (shape) |
1572 return shape; | 1572 return shape; |
1573 return nullptr; | 1573 return nullptr; |
1574 } | 1574 } |
1575 | 1575 |
1576 static CSSValue* consumeOutlineColor(CSSParserTokenRange& range, CSSParserMode c ssParserMode) | 1576 static CSSValue* consumeOutlineColor(CSSParserTokenRange& range, CSSParserMode c ssParserMode) |
1577 { | 1577 { |
1578 // Allow the special focus color even in HTML Standard parsing mode. | 1578 // Allow the special focus color even in HTML Standard parsing mode. |
1579 if (range.peek().id() == CSSValueWebkitFocusRingColor) | 1579 if (range.peek().id() == CSSValueWebkitFocusRingColor) |
1580 return consumeIdent(range); | 1580 return consumeIdent(range); |
1581 return consumeColor(range, cssParserMode); | 1581 return consumeColor(range, cssParserMode); |
1582 } | 1582 } |
1583 | 1583 |
1584 static CSSPrimitiveValue* consumeLineWidth(CSSParserTokenRange& range, CSSParser Mode cssParserMode, UnitlessQuirk unitless) | 1584 static CSSValue* consumeLineWidth(CSSParserTokenRange& range, CSSParserMode cssP arserMode, UnitlessQuirk unitless) |
1585 { | 1585 { |
1586 CSSValueID id = range.peek().id(); | 1586 CSSValueID id = range.peek().id(); |
1587 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) | 1587 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) |
1588 return consumeIdent(range); | 1588 return consumeIdent(range); |
1589 return consumeLength(range, cssParserMode, ValueRangeNonNegative, unitless); | 1589 return consumeLength(range, cssParserMode, ValueRangeNonNegative, unitless); |
1590 } | 1590 } |
1591 | 1591 |
1592 static CSSPrimitiveValue* consumeBorderWidth(CSSParserTokenRange& range, CSSPars erMode cssParserMode, UnitlessQuirk unitless) | 1592 static CSSValue* consumeBorderWidth(CSSParserTokenRange& range, CSSParserMode cs sParserMode, UnitlessQuirk unitless) |
1593 { | 1593 { |
1594 return consumeLineWidth(range, cssParserMode, unitless); | 1594 return consumeLineWidth(range, cssParserMode, unitless); |
1595 } | 1595 } |
1596 | 1596 |
1597 static CSSPrimitiveValue* consumeTextStrokeWidth(CSSParserTokenRange& range, CSS ParserMode cssParserMode) | 1597 static CSSValue* consumeTextStrokeWidth(CSSParserTokenRange& range, CSSParserMod e cssParserMode) |
1598 { | 1598 { |
1599 return consumeLineWidth(range, cssParserMode, UnitlessQuirk::Forbid); | 1599 return consumeLineWidth(range, cssParserMode, UnitlessQuirk::Forbid); |
1600 } | 1600 } |
1601 | 1601 |
1602 static CSSPrimitiveValue* consumeColumnRuleWidth(CSSParserTokenRange& range, CSS ParserMode cssParserMode) | 1602 static CSSValue* consumeColumnRuleWidth(CSSParserTokenRange& range, CSSParserMod e cssParserMode) |
1603 { | 1603 { |
1604 return consumeLineWidth(range, cssParserMode, UnitlessQuirk::Forbid); | 1604 return consumeLineWidth(range, cssParserMode, UnitlessQuirk::Forbid); |
1605 } | 1605 } |
1606 | 1606 |
1607 static bool consumeTranslate3d(CSSParserTokenRange& args, CSSParserMode cssParse rMode, CSSFunctionValue*& transformValue) | 1607 static bool consumeTranslate3d(CSSParserTokenRange& args, CSSParserMode cssParse rMode, CSSFunctionValue*& transformValue) |
1608 { | 1608 { |
1609 unsigned numberOfArguments = 2; | 1609 unsigned numberOfArguments = 2; |
1610 CSSValue* parsedValue = nullptr; | 1610 CSSValue* parsedValue = nullptr; |
1611 do { | 1611 do { |
1612 parsedValue = consumeLengthOrPercent(args, cssParserMode, ValueRangeAll) ; | 1612 parsedValue = consumeLengthOrPercent(args, cssParserMode, ValueRangeAll) ; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1810 } | 1810 } |
1811 return consumeColor(range, cssParserMode); | 1811 return consumeColor(range, cssParserMode); |
1812 } | 1812 } |
1813 | 1813 |
1814 static CSSValue* consumePaintOrder(CSSParserTokenRange& range) | 1814 static CSSValue* consumePaintOrder(CSSParserTokenRange& range) |
1815 { | 1815 { |
1816 if (range.peek().id() == CSSValueNormal) | 1816 if (range.peek().id() == CSSValueNormal) |
1817 return consumeIdent(range); | 1817 return consumeIdent(range); |
1818 | 1818 |
1819 Vector<CSSValueID, 3> paintTypeList; | 1819 Vector<CSSValueID, 3> paintTypeList; |
1820 CSSPrimitiveValue* fill = nullptr; | 1820 CSSIdentifierValue* fill = nullptr; |
1821 CSSPrimitiveValue* stroke = nullptr; | 1821 CSSIdentifierValue* stroke = nullptr; |
1822 CSSPrimitiveValue* markers = nullptr; | 1822 CSSIdentifierValue* markers = nullptr; |
1823 do { | 1823 do { |
1824 CSSValueID id = range.peek().id(); | 1824 CSSValueID id = range.peek().id(); |
1825 if (id == CSSValueFill && !fill) | 1825 if (id == CSSValueFill && !fill) |
1826 fill = consumeIdent(range); | 1826 fill = consumeIdent(range); |
1827 else if (id == CSSValueStroke && !stroke) | 1827 else if (id == CSSValueStroke && !stroke) |
1828 stroke = consumeIdent(range); | 1828 stroke = consumeIdent(range); |
1829 else if (id == CSSValueMarkers && !markers) | 1829 else if (id == CSSValueMarkers && !markers) |
1830 markers = consumeIdent(range); | 1830 markers = consumeIdent(range); |
1831 else | 1831 else |
1832 return nullptr; | 1832 return nullptr; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1885 CSSValueList* dashes = CSSValueList::createCommaSeparated(); | 1885 CSSValueList* dashes = CSSValueList::createCommaSeparated(); |
1886 do { | 1886 do { |
1887 CSSPrimitiveValue* dash = consumeLengthOrPercent(range, SVGAttributeMode , ValueRangeNonNegative); | 1887 CSSPrimitiveValue* dash = consumeLengthOrPercent(range, SVGAttributeMode , ValueRangeNonNegative); |
1888 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd())) | 1888 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd())) |
1889 return nullptr; | 1889 return nullptr; |
1890 dashes->append(*dash); | 1890 dashes->append(*dash); |
1891 } while (!range.atEnd()); | 1891 } while (!range.atEnd()); |
1892 return dashes; | 1892 return dashes; |
1893 } | 1893 } |
1894 | 1894 |
1895 static CSSPrimitiveValue* consumeBaselineShift(CSSParserTokenRange& range) | 1895 static CSSValue* consumeBaselineShift(CSSParserTokenRange& range) |
1896 { | 1896 { |
1897 CSSValueID id = range.peek().id(); | 1897 CSSValueID id = range.peek().id(); |
1898 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) | 1898 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) |
1899 return consumeIdent(range); | 1899 return consumeIdent(range); |
1900 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll); | 1900 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll); |
1901 } | 1901 } |
1902 | 1902 |
1903 static CSSPrimitiveValue* consumeRxOrRy(CSSParserTokenRange& range) | 1903 static CSSValue* consumeRxOrRy(CSSParserTokenRange& range) |
1904 { | 1904 { |
1905 if (range.peek().id() == CSSValueAuto) | 1905 if (range.peek().id() == CSSValueAuto) |
1906 return consumeIdent(range); | 1906 return consumeIdent(range); |
1907 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll, Unitle ssQuirk::Forbid); | 1907 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll, Unitle ssQuirk::Forbid); |
1908 } | 1908 } |
1909 | 1909 |
1910 static CSSValue* consumeCursor(CSSParserTokenRange& range, const CSSParserContex t& context, bool inQuirksMode) | 1910 static CSSValue* consumeCursor(CSSParserTokenRange& range, const CSSParserContex t& context, bool inQuirksMode) |
1911 { | 1911 { |
1912 CSSValueList* list = nullptr; | 1912 CSSValueList* list = nullptr; |
1913 while (CSSValue* image = consumeImage(range, context, ConsumeGeneratedImage: :Forbid)) { | 1913 while (CSSValue* image = consumeImage(range, context, ConsumeGeneratedImage: :Forbid)) { |
(...skipping 20 matching lines...) Expand all Loading... | |
1934 if (!range.atEnd() && context.useCounter()) { | 1934 if (!range.atEnd() && context.useCounter()) { |
1935 if (id == CSSValueWebkitZoomIn) | 1935 if (id == CSSValueWebkitZoomIn) |
1936 context.useCounter()->count(UseCounter::PrefixedCursorZoomIn); | 1936 context.useCounter()->count(UseCounter::PrefixedCursorZoomIn); |
1937 else if (id == CSSValueWebkitZoomOut) | 1937 else if (id == CSSValueWebkitZoomOut) |
1938 context.useCounter()->count(UseCounter::PrefixedCursorZoomOut); | 1938 context.useCounter()->count(UseCounter::PrefixedCursorZoomOut); |
1939 } | 1939 } |
1940 CSSValue* cursorType = nullptr; | 1940 CSSValue* cursorType = nullptr; |
1941 if (id == CSSValueHand) { | 1941 if (id == CSSValueHand) { |
1942 if (!inQuirksMode) // Non-standard behavior | 1942 if (!inQuirksMode) // Non-standard behavior |
1943 return nullptr; | 1943 return nullptr; |
1944 cursorType = CSSPrimitiveValue::createIdentifier(CSSValuePointer); | 1944 cursorType = CSSIdentifierValue::createIdentifier(CSSValuePointer); |
1945 range.consumeIncludingWhitespace(); | 1945 range.consumeIncludingWhitespace(); |
1946 } else if ((id >= CSSValueAuto && id <= CSSValueWebkitZoomOut) || id == CSSV alueCopy || id == CSSValueNone) { | 1946 } else if ((id >= CSSValueAuto && id <= CSSValueWebkitZoomOut) || id == CSSV alueCopy || id == CSSValueNone) { |
1947 cursorType = consumeIdent(range); | 1947 cursorType = consumeIdent(range); |
1948 } else { | 1948 } else { |
1949 return nullptr; | 1949 return nullptr; |
1950 } | 1950 } |
1951 | 1951 |
1952 if (!list) | 1952 if (!list) |
1953 return cursorType; | 1953 return cursorType; |
1954 list->append(*cursorType); | 1954 list->append(*cursorType); |
(...skipping 26 matching lines...) Expand all Loading... | |
1981 | 1981 |
1982 CSSStringValue* separator = nullptr; | 1982 CSSStringValue* separator = nullptr; |
1983 if (!counters) { | 1983 if (!counters) { |
1984 separator = CSSStringValue::create(String()); | 1984 separator = CSSStringValue::create(String()); |
1985 } else { | 1985 } else { |
1986 if (!consumeCommaIncludingWhitespace(args) || args.peek().type() != Stri ngToken) | 1986 if (!consumeCommaIncludingWhitespace(args) || args.peek().type() != Stri ngToken) |
1987 return nullptr; | 1987 return nullptr; |
1988 separator = CSSStringValue::create(args.consumeIncludingWhitespace().val ue().toString()); | 1988 separator = CSSStringValue::create(args.consumeIncludingWhitespace().val ue().toString()); |
1989 } | 1989 } |
1990 | 1990 |
1991 CSSPrimitiveValue* listStyle = nullptr; | 1991 CSSIdentifierValue* listStyle = nullptr; |
1992 if (consumeCommaIncludingWhitespace(args)) { | 1992 if (consumeCommaIncludingWhitespace(args)) { |
1993 CSSValueID id = args.peek().id(); | 1993 CSSValueID id = args.peek().id(); |
1994 if ((id != CSSValueNone && (id < CSSValueDisc || id > CSSValueKatakanaIr oha))) | 1994 if ((id != CSSValueNone && (id < CSSValueDisc || id > CSSValueKatakanaIr oha))) |
1995 return nullptr; | 1995 return nullptr; |
1996 listStyle = consumeIdent(args); | 1996 listStyle = consumeIdent(args); |
1997 } else { | 1997 } else { |
1998 listStyle = CSSPrimitiveValue::createIdentifier(CSSValueDecimal); | 1998 listStyle = CSSIdentifierValue::createIdentifier(CSSValueDecimal); |
1999 } | 1999 } |
2000 | 2000 |
2001 if (!args.atEnd()) | 2001 if (!args.atEnd()) |
2002 return nullptr; | 2002 return nullptr; |
2003 return CSSCounterValue::create(identifier, listStyle, separator); | 2003 return CSSCounterValue::create(identifier, listStyle, separator); |
2004 } | 2004 } |
2005 | 2005 |
2006 static CSSValue* consumeContent(CSSParserTokenRange& range, CSSParserContext con text) | 2006 static CSSValue* consumeContent(CSSParserTokenRange& range, CSSParserContext con text) |
2007 { | 2007 { |
2008 if (identMatches<CSSValueNone, CSSValueNormal>(range.peek().id())) | 2008 if (identMatches<CSSValueNone, CSSValueNormal>(range.peek().id())) |
(...skipping 16 matching lines...) Expand all Loading... | |
2025 parsedValue = consumeCounterContent(consumeFunction(range), true ); | 2025 parsedValue = consumeCounterContent(consumeFunction(range), true ); |
2026 if (!parsedValue) | 2026 if (!parsedValue) |
2027 return nullptr; | 2027 return nullptr; |
2028 } | 2028 } |
2029 values->append(*parsedValue); | 2029 values->append(*parsedValue); |
2030 } while (!range.atEnd()); | 2030 } while (!range.atEnd()); |
2031 | 2031 |
2032 return values; | 2032 return values; |
2033 } | 2033 } |
2034 | 2034 |
2035 static CSSPrimitiveValue* consumePerspective(CSSParserTokenRange& range, CSSPars erMode cssParserMode, CSSPropertyID unresolvedProperty) | 2035 static CSSValue* consumePerspective(CSSParserTokenRange& range, CSSParserMode cs sParserMode, CSSPropertyID unresolvedProperty) |
2036 { | 2036 { |
2037 if (range.peek().id() == CSSValueNone) | 2037 if (range.peek().id() == CSSValueNone) |
2038 return consumeIdent(range); | 2038 return consumeIdent(range); |
2039 CSSPrimitiveValue* parsedValue = consumeLength(range, cssParserMode, ValueRa ngeAll); | 2039 CSSPrimitiveValue* parsedValue = consumeLength(range, cssParserMode, ValueRa ngeAll); |
2040 if (!parsedValue && (unresolvedProperty == CSSPropertyAliasWebkitPerspective )) { | 2040 if (!parsedValue && (unresolvedProperty == CSSPropertyAliasWebkitPerspective )) { |
2041 double perspective; | 2041 double perspective; |
2042 if (!consumeNumberRaw(range, perspective)) | 2042 if (!consumeNumberRaw(range, perspective)) |
2043 return nullptr; | 2043 return nullptr; |
2044 parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue:: UnitType::Pixels); | 2044 parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue:: UnitType::Pixels); |
2045 } | 2045 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2087 { | 2087 { |
2088 CSSValue* parsedValue1 = consumeLengthOrPercent(range, cssParserMode, ValueR angeNonNegative); | 2088 CSSValue* parsedValue1 = consumeLengthOrPercent(range, cssParserMode, ValueR angeNonNegative); |
2089 if (!parsedValue1) | 2089 if (!parsedValue1) |
2090 return nullptr; | 2090 return nullptr; |
2091 CSSValue* parsedValue2 = consumeLengthOrPercent(range, cssParserMode, ValueR angeNonNegative); | 2091 CSSValue* parsedValue2 = consumeLengthOrPercent(range, cssParserMode, ValueR angeNonNegative); |
2092 if (!parsedValue2) | 2092 if (!parsedValue2) |
2093 parsedValue2 = parsedValue1; | 2093 parsedValue2 = parsedValue1; |
2094 return CSSValuePair::create(parsedValue1, parsedValue2, CSSValuePair::DropId enticalValues); | 2094 return CSSValuePair::create(parsedValue1, parsedValue2, CSSValuePair::DropId enticalValues); |
2095 } | 2095 } |
2096 | 2096 |
2097 static CSSPrimitiveValue* consumeVerticalAlign(CSSParserTokenRange& range, CSSPa rserMode cssParserMode) | 2097 static CSSValue* consumeVerticalAlign(CSSParserTokenRange& range, CSSParserMode cssParserMode) |
2098 { | 2098 { |
2099 CSSPrimitiveValue* parsedValue = consumeIdentRange(range, CSSValueBaseline, CSSValueWebkitBaselineMiddle); | 2099 CSSValue* parsedValue = consumeIdentRange(range, CSSValueBaseline, CSSValueW ebkitBaselineMiddle); |
2100 if (!parsedValue) | 2100 if (!parsedValue) |
2101 parsedValue = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll , UnitlessQuirk::Allow); | 2101 parsedValue = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll , UnitlessQuirk::Allow); |
2102 return parsedValue; | 2102 return parsedValue; |
2103 } | 2103 } |
2104 | 2104 |
2105 static CSSPrimitiveValue* consumeShapeRadius(CSSParserTokenRange& args, CSSParse rMode cssParserMode) | 2105 static CSSValue* consumeShapeRadius(CSSParserTokenRange& args, CSSParserMode css ParserMode) |
2106 { | 2106 { |
2107 if (identMatches<CSSValueClosestSide, CSSValueFarthestSide>(args.peek().id() )) | 2107 if (identMatches<CSSValueClosestSide, CSSValueFarthestSide>(args.peek().id() )) |
2108 return consumeIdent(args); | 2108 return consumeIdent(args); |
2109 return consumeLengthOrPercent(args, cssParserMode, ValueRangeNonNegative); | 2109 return consumeLengthOrPercent(args, cssParserMode, ValueRangeNonNegative); |
2110 } | 2110 } |
2111 | 2111 |
2112 static CSSBasicShapeCircleValue* consumeBasicShapeCircle(CSSParserTokenRange& ar gs, const CSSParserContext& context) | 2112 static CSSBasicShapeCircleValue* consumeBasicShapeCircle(CSSParserTokenRange& ar gs, const CSSParserContext& context) |
2113 { | 2113 { |
2114 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes | 2114 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes |
2115 // circle( [<shape-radius>]? [at <position>]? ) | 2115 // circle( [<shape-radius>]? [at <position>]? ) |
2116 CSSBasicShapeCircleValue* shape = CSSBasicShapeCircleValue::create(); | 2116 CSSBasicShapeCircleValue* shape = CSSBasicShapeCircleValue::create(); |
2117 if (CSSPrimitiveValue* radius = consumeShapeRadius(args, context.mode())) | 2117 if (CSSValue* radius = consumeShapeRadius(args, context.mode())) |
2118 shape->setRadius(radius); | 2118 shape->setRadius(radius); |
2119 if (consumeIdent<CSSValueAt>(args)) { | 2119 if (consumeIdent<CSSValueAt>(args)) { |
2120 CSSValue* centerX = nullptr; | 2120 CSSValue* centerX = nullptr; |
2121 CSSValue* centerY = nullptr; | 2121 CSSValue* centerY = nullptr; |
2122 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center X, centerY)) | 2122 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center X, centerY)) |
2123 return nullptr; | 2123 return nullptr; |
2124 shape->setCenterX(centerX); | 2124 shape->setCenterX(centerX); |
2125 shape->setCenterY(centerY); | 2125 shape->setCenterY(centerY); |
2126 } | 2126 } |
2127 return shape; | 2127 return shape; |
2128 } | 2128 } |
2129 | 2129 |
2130 static CSSBasicShapeEllipseValue* consumeBasicShapeEllipse(CSSParserTokenRange& args, const CSSParserContext& context) | 2130 static CSSBasicShapeEllipseValue* consumeBasicShapeEllipse(CSSParserTokenRange& args, const CSSParserContext& context) |
2131 { | 2131 { |
2132 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes | 2132 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes |
2133 // ellipse( [<shape-radius>{2}]? [at <position>]? ) | 2133 // ellipse( [<shape-radius>{2}]? [at <position>]? ) |
2134 CSSBasicShapeEllipseValue* shape = CSSBasicShapeEllipseValue::create(); | 2134 CSSBasicShapeEllipseValue* shape = CSSBasicShapeEllipseValue::create(); |
2135 if (CSSPrimitiveValue* radiusX = consumeShapeRadius(args, context.mode())) { | 2135 if (CSSValue* radiusX = consumeShapeRadius(args, context.mode())) { |
2136 shape->setRadiusX(radiusX); | 2136 shape->setRadiusX(radiusX); |
2137 if (CSSPrimitiveValue* radiusY = consumeShapeRadius(args, context.mode() )) | 2137 if (CSSValue* radiusY = consumeShapeRadius(args, context.mode())) |
2138 shape->setRadiusY(radiusY); | 2138 shape->setRadiusY(radiusY); |
2139 } | 2139 } |
2140 if (consumeIdent<CSSValueAt>(args)) { | 2140 if (consumeIdent<CSSValueAt>(args)) { |
2141 CSSValue* centerX = nullptr; | 2141 CSSValue* centerX = nullptr; |
2142 CSSValue* centerY = nullptr; | 2142 CSSValue* centerY = nullptr; |
2143 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center X, centerY)) | 2143 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center X, centerY)) |
2144 return nullptr; | 2144 return nullptr; |
2145 shape->setCenterX(centerX); | 2145 shape->setCenterX(centerX); |
2146 shape->setCenterY(centerY); | 2146 shape->setCenterY(centerY); |
2147 } | 2147 } |
(...skipping 14 matching lines...) Expand all Loading... | |
2162 if (!xLength) | 2162 if (!xLength) |
2163 return nullptr; | 2163 return nullptr; |
2164 CSSPrimitiveValue* yLength = consumeLengthOrPercent(args, context.mode() , ValueRangeAll); | 2164 CSSPrimitiveValue* yLength = consumeLengthOrPercent(args, context.mode() , ValueRangeAll); |
2165 if (!yLength) | 2165 if (!yLength) |
2166 return nullptr; | 2166 return nullptr; |
2167 shape->appendPoint(xLength, yLength); | 2167 shape->appendPoint(xLength, yLength); |
2168 } while (consumeCommaIncludingWhitespace(args)); | 2168 } while (consumeCommaIncludingWhitespace(args)); |
2169 return shape; | 2169 return shape; |
2170 } | 2170 } |
2171 | 2171 |
2172 static void complete4Sides(CSSPrimitiveValue* side[4]) | 2172 static void complete4Sides(CSSValue* side[4]) |
2173 { | 2173 { |
2174 if (side[3]) | 2174 if (side[3]) |
2175 return; | 2175 return; |
2176 if (!side[2]) { | 2176 if (!side[2]) { |
2177 if (!side[1]) | 2177 if (!side[1]) |
2178 side[1] = side[0]; | 2178 side[1] = side[0]; |
2179 side[2] = side[0]; | 2179 side[2] = side[0]; |
2180 } | 2180 } |
2181 side[3] = side[1]; | 2181 side[3] = side[1]; |
2182 } | 2182 } |
2183 | 2183 |
2184 static bool consumeRadii(CSSPrimitiveValue* horizontalRadii[4], CSSPrimitiveValu e* verticalRadii[4], CSSParserTokenRange& range, CSSParserMode cssParserMode, bo ol useLegacyParsing) | 2184 static bool consumeRadii(CSSValue* horizontalRadii[4], CSSValue* verticalRadii[4 ], CSSParserTokenRange& range, CSSParserMode cssParserMode, bool useLegacyParsin g) |
2185 { | 2185 { |
2186 unsigned i = 0; | 2186 unsigned i = 0; |
2187 for (; i < 4 && !range.atEnd() && range.peek().type() != DelimiterToken; ++i ) { | 2187 for (; i < 4 && !range.atEnd() && range.peek().type() != DelimiterToken; ++i ) { |
2188 horizontalRadii[i] = consumeLengthOrPercent(range, cssParserMode, ValueR angeNonNegative); | 2188 horizontalRadii[i] = consumeLengthOrPercent(range, cssParserMode, ValueR angeNonNegative); |
2189 if (!horizontalRadii[i]) | 2189 if (!horizontalRadii[i]) |
2190 return false; | 2190 return false; |
2191 } | 2191 } |
2192 if (!horizontalRadii[0]) | 2192 if (!horizontalRadii[0]) |
2193 return false; | 2193 return false; |
2194 if (range.atEnd()) { | 2194 if (range.atEnd()) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2235 if (left) | 2235 if (left) |
2236 shape->updateShapeSize4Values(top, right, bottom, left); | 2236 shape->updateShapeSize4Values(top, right, bottom, left); |
2237 else if (bottom) | 2237 else if (bottom) |
2238 shape->updateShapeSize3Values(top, right, bottom); | 2238 shape->updateShapeSize3Values(top, right, bottom); |
2239 else if (right) | 2239 else if (right) |
2240 shape->updateShapeSize2Values(top, right); | 2240 shape->updateShapeSize2Values(top, right); |
2241 else | 2241 else |
2242 shape->updateShapeSize1Value(top); | 2242 shape->updateShapeSize1Value(top); |
2243 | 2243 |
2244 if (consumeIdent<CSSValueRound>(args)) { | 2244 if (consumeIdent<CSSValueRound>(args)) { |
2245 CSSPrimitiveValue* horizontalRadii[4] = { 0 }; | 2245 CSSValue* horizontalRadii[4] = { 0 }; |
2246 CSSPrimitiveValue* verticalRadii[4] = { 0 }; | 2246 CSSValue* verticalRadii[4] = { 0 }; |
2247 if (!consumeRadii(horizontalRadii, verticalRadii, args, context.mode(), false)) | 2247 if (!consumeRadii(horizontalRadii, verticalRadii, args, context.mode(), false)) |
2248 return nullptr; | 2248 return nullptr; |
2249 shape->setTopLeftRadius(CSSValuePair::create(horizontalRadii[0], vertica lRadii[0], CSSValuePair::DropIdenticalValues)); | 2249 shape->setTopLeftRadius(CSSValuePair::create(horizontalRadii[0], vertica lRadii[0], CSSValuePair::DropIdenticalValues)); |
2250 shape->setTopRightRadius(CSSValuePair::create(horizontalRadii[1], vertic alRadii[1], CSSValuePair::DropIdenticalValues)); | 2250 shape->setTopRightRadius(CSSValuePair::create(horizontalRadii[1], vertic alRadii[1], CSSValuePair::DropIdenticalValues)); |
2251 shape->setBottomRightRadius(CSSValuePair::create(horizontalRadii[2], ver ticalRadii[2], CSSValuePair::DropIdenticalValues)); | 2251 shape->setBottomRightRadius(CSSValuePair::create(horizontalRadii[2], ver ticalRadii[2], CSSValuePair::DropIdenticalValues)); |
2252 shape->setBottomLeftRadius(CSSValuePair::create(horizontalRadii[3], vert icalRadii[3], CSSValuePair::DropIdenticalValues)); | 2252 shape->setBottomLeftRadius(CSSValuePair::create(horizontalRadii[3], vert icalRadii[3], CSSValuePair::DropIdenticalValues)); |
2253 } | 2253 } |
2254 return shape; | 2254 return shape; |
2255 } | 2255 } |
2256 | 2256 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2336 if (position == CSSValueInvalid && distribution == CSSValueInvalid) | 2336 if (position == CSSValueInvalid && distribution == CSSValueInvalid) |
2337 return nullptr; | 2337 return nullptr; |
2338 | 2338 |
2339 // The grammar states that <overflow-position> must be associated to <conten t-position>. | 2339 // The grammar states that <overflow-position> must be associated to <conten t-position>. |
2340 if (overflow != CSSValueInvalid && position == CSSValueInvalid) | 2340 if (overflow != CSSValueInvalid && position == CSSValueInvalid) |
2341 return nullptr; | 2341 return nullptr; |
2342 | 2342 |
2343 return CSSContentDistributionValue::create(distribution, position, overflow) ; | 2343 return CSSContentDistributionValue::create(distribution, position, overflow) ; |
2344 } | 2344 } |
2345 | 2345 |
2346 static CSSPrimitiveValue* consumeBorderImageRepeatKeyword(CSSParserTokenRange& r ange) | 2346 static CSSIdentifierValue* consumeBorderImageRepeatKeyword(CSSParserTokenRange& range) |
2347 { | 2347 { |
2348 return consumeIdent<CSSValueStretch, CSSValueRepeat, CSSValueSpace, CSSValue Round>(range); | 2348 return consumeIdent<CSSValueStretch, CSSValueRepeat, CSSValueSpace, CSSValue Round>(range); |
2349 } | 2349 } |
2350 | 2350 |
2351 static CSSValue* consumeBorderImageRepeat(CSSParserTokenRange& range) | 2351 static CSSValue* consumeBorderImageRepeat(CSSParserTokenRange& range) |
2352 { | 2352 { |
2353 CSSPrimitiveValue* horizontal = consumeBorderImageRepeatKeyword(range); | 2353 CSSIdentifierValue* horizontal = consumeBorderImageRepeatKeyword(range); |
2354 if (!horizontal) | 2354 if (!horizontal) |
2355 return nullptr; | 2355 return nullptr; |
2356 CSSPrimitiveValue* vertical = consumeBorderImageRepeatKeyword(range); | 2356 CSSIdentifierValue* vertical = consumeBorderImageRepeatKeyword(range); |
2357 if (!vertical) | 2357 if (!vertical) |
2358 vertical = horizontal; | 2358 vertical = horizontal; |
2359 return CSSValuePair::create(horizontal, vertical, CSSValuePair::DropIdentica lValues); | 2359 return CSSValuePair::create(horizontal, vertical, CSSValuePair::DropIdentica lValues); |
2360 } | 2360 } |
2361 | 2361 |
2362 static CSSValue* consumeBorderImageSlice(CSSPropertyID property, CSSParserTokenR ange& range) | 2362 static CSSValue* consumeBorderImageSlice(CSSPropertyID property, CSSParserTokenR ange& range) |
2363 { | 2363 { |
2364 bool fill = consumeIdent<CSSValueFill>(range); | 2364 bool fill = consumeIdent<CSSValueFill>(range); |
2365 CSSPrimitiveValue* slices[4] = { 0 }; | 2365 CSSValue* slices[4] = { 0 }; |
2366 | 2366 |
2367 for (size_t index = 0; index < 4; ++index) { | 2367 for (size_t index = 0; index < 4; ++index) { |
2368 CSSPrimitiveValue* value = consumePercent(range, ValueRangeNonNegative); | 2368 CSSPrimitiveValue* value = consumePercent(range, ValueRangeNonNegative); |
2369 if (!value) | 2369 if (!value) |
2370 value = consumeNumber(range, ValueRangeNonNegative); | 2370 value = consumeNumber(range, ValueRangeNonNegative); |
2371 if (!value) | 2371 if (!value) |
2372 break; | 2372 break; |
2373 slices[index] = value; | 2373 slices[index] = value; |
2374 } | 2374 } |
2375 if (!slices[0]) | 2375 if (!slices[0]) |
2376 return nullptr; | 2376 return nullptr; |
2377 if (consumeIdent<CSSValueFill>(range)) { | 2377 if (consumeIdent<CSSValueFill>(range)) { |
2378 if (fill) | 2378 if (fill) |
2379 return nullptr; | 2379 return nullptr; |
2380 fill = true; | 2380 fill = true; |
2381 } | 2381 } |
2382 complete4Sides(slices); | 2382 complete4Sides(slices); |
2383 // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mask-bo x-image and -webkit-box-reflect have to do a fill by default. | 2383 // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mask-bo x-image and -webkit-box-reflect have to do a fill by default. |
2384 // FIXME: What do we do with -webkit-box-reflect and -webkit-mask-box-image? Probably just have to leave them filling... | 2384 // FIXME: What do we do with -webkit-box-reflect and -webkit-mask-box-image? Probably just have to leave them filling... |
2385 if (property == CSSPropertyWebkitBorderImage || property == CSSPropertyWebki tMaskBoxImage || property == CSSPropertyWebkitBoxReflect) | 2385 if (property == CSSPropertyWebkitBorderImage || property == CSSPropertyWebki tMaskBoxImage || property == CSSPropertyWebkitBoxReflect) |
2386 fill = true; | 2386 fill = true; |
2387 return CSSBorderImageSliceValue::create(CSSQuadValue::create(slices[0], slic es[1], slices[2], slices[3], CSSQuadValue::SerializeAsQuad), fill); | 2387 return CSSBorderImageSliceValue::create(CSSQuadValue::create(slices[0], slic es[1], slices[2], slices[3], CSSQuadValue::SerializeAsQuad), fill); |
2388 } | 2388 } |
2389 | 2389 |
2390 static CSSValue* consumeBorderImageOutset(CSSParserTokenRange& range) | 2390 static CSSValue* consumeBorderImageOutset(CSSParserTokenRange& range) |
2391 { | 2391 { |
2392 CSSPrimitiveValue* outsets[4] = { 0 }; | 2392 CSSValue* outsets[4] = { 0 }; |
2393 | 2393 |
2394 CSSPrimitiveValue* value = nullptr; | 2394 CSSValue* value = nullptr; |
2395 for (size_t index = 0; index < 4; ++index) { | 2395 for (size_t index = 0; index < 4; ++index) { |
2396 value = consumeNumber(range, ValueRangeNonNegative); | 2396 value = consumeNumber(range, ValueRangeNonNegative); |
2397 if (!value) | 2397 if (!value) |
2398 value = consumeLength(range, HTMLStandardMode, ValueRangeNonNegative ); | 2398 value = consumeLength(range, HTMLStandardMode, ValueRangeNonNegative ); |
2399 if (!value) | 2399 if (!value) |
2400 break; | 2400 break; |
2401 outsets[index] = value; | 2401 outsets[index] = value; |
2402 } | 2402 } |
2403 if (!outsets[0]) | 2403 if (!outsets[0]) |
2404 return nullptr; | 2404 return nullptr; |
2405 complete4Sides(outsets); | 2405 complete4Sides(outsets); |
2406 return CSSQuadValue::create(outsets[0], outsets[1], outsets[2], outsets[3], CSSQuadValue::SerializeAsQuad); | 2406 return CSSQuadValue::create(outsets[0], outsets[1], outsets[2], outsets[3], CSSQuadValue::SerializeAsQuad); |
2407 } | 2407 } |
2408 | 2408 |
2409 static CSSValue* consumeBorderImageWidth(CSSParserTokenRange& range) | 2409 static CSSValue* consumeBorderImageWidth(CSSParserTokenRange& range) |
2410 { | 2410 { |
2411 CSSPrimitiveValue* widths[4] = { 0 }; | 2411 CSSValue* widths[4] = { 0 }; |
2412 | 2412 |
2413 CSSPrimitiveValue* value = nullptr; | 2413 CSSValue* value = nullptr; |
2414 for (size_t index = 0; index < 4; ++index) { | 2414 for (size_t index = 0; index < 4; ++index) { |
2415 value = consumeNumber(range, ValueRangeNonNegative); | 2415 value = consumeNumber(range, ValueRangeNonNegative); |
2416 if (!value) | 2416 if (!value) |
2417 value = consumeLengthOrPercent(range, HTMLStandardMode, ValueRangeNo nNegative, UnitlessQuirk::Forbid); | 2417 value = consumeLengthOrPercent(range, HTMLStandardMode, ValueRangeNo nNegative, UnitlessQuirk::Forbid); |
2418 if (!value) | 2418 if (!value) |
2419 value = consumeIdent<CSSValueAuto>(range); | 2419 value = consumeIdent<CSSValueAuto>(range); |
2420 if (!value) | 2420 if (!value) |
2421 break; | 2421 break; |
2422 widths[index] = value; | 2422 widths[index] = value; |
2423 } | 2423 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2472 CSSValue* width = nullptr; | 2472 CSSValue* width = nullptr; |
2473 CSSValue* outset = nullptr; | 2473 CSSValue* outset = nullptr; |
2474 CSSValue* repeat = nullptr; | 2474 CSSValue* repeat = nullptr; |
2475 if (consumeBorderImageComponents(property, range, context, source, slice, wi dth, outset, repeat)) | 2475 if (consumeBorderImageComponents(property, range, context, source, slice, wi dth, outset, repeat)) |
2476 return createBorderImageValue(source, slice, width, outset, repeat); | 2476 return createBorderImageValue(source, slice, width, outset, repeat); |
2477 return nullptr; | 2477 return nullptr; |
2478 } | 2478 } |
2479 | 2479 |
2480 static CSSValue* consumeReflect(CSSParserTokenRange& range, const CSSParserConte xt& context) | 2480 static CSSValue* consumeReflect(CSSParserTokenRange& range, const CSSParserConte xt& context) |
2481 { | 2481 { |
2482 CSSPrimitiveValue* direction = consumeIdent<CSSValueAbove, CSSValueBelow, CS SValueLeft, CSSValueRight>(range); | 2482 CSSIdentifierValue* direction = consumeIdent<CSSValueAbove, CSSValueBelow, C SSValueLeft, CSSValueRight>(range); |
2483 if (!direction) | 2483 if (!direction) |
2484 return nullptr; | 2484 return nullptr; |
2485 | 2485 |
2486 CSSPrimitiveValue* offset = nullptr; | 2486 CSSPrimitiveValue* offset = nullptr; |
2487 if (range.atEnd()) { | 2487 if (range.atEnd()) { |
2488 offset = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pixel s); | 2488 offset = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pixel s); |
2489 } else { | 2489 } else { |
2490 offset = consumeLengthOrPercent(range, context.mode(), ValueRangeAll, Un itlessQuirk::Forbid); | 2490 offset = consumeLengthOrPercent(range, context.mode(), ValueRangeAll, Un itlessQuirk::Forbid); |
2491 if (!offset) | 2491 if (!offset) |
2492 return nullptr; | 2492 return nullptr; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2557 if ((property == CSSPropertyWebkitBackgroundClip || property == CSSPropertyW ebkitMaskClip) && range.peek().id() == CSSValueText) | 2557 if ((property == CSSPropertyWebkitBackgroundClip || property == CSSPropertyW ebkitMaskClip) && range.peek().id() == CSSValueText) |
2558 return consumeIdent(range); | 2558 return consumeIdent(range); |
2559 return nullptr; | 2559 return nullptr; |
2560 } | 2560 } |
2561 | 2561 |
2562 static CSSValue* consumeBackgroundSize(CSSPropertyID unresolvedProperty, CSSPars erTokenRange& range, CSSParserMode cssParserMode) | 2562 static CSSValue* consumeBackgroundSize(CSSPropertyID unresolvedProperty, CSSPars erTokenRange& range, CSSParserMode cssParserMode) |
2563 { | 2563 { |
2564 if (identMatches<CSSValueContain, CSSValueCover>(range.peek().id())) | 2564 if (identMatches<CSSValueContain, CSSValueCover>(range.peek().id())) |
2565 return consumeIdent(range); | 2565 return consumeIdent(range); |
2566 | 2566 |
2567 CSSPrimitiveValue* horizontal = consumeIdent<CSSValueAuto>(range); | 2567 CSSValue* horizontal = consumeIdent<CSSValueAuto>(range); |
2568 if (!horizontal) | 2568 if (!horizontal) |
2569 horizontal = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Forbid); | 2569 horizontal = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Forbid); |
2570 | 2570 |
2571 CSSPrimitiveValue* vertical = nullptr; | 2571 CSSValue* vertical = nullptr; |
2572 if (!range.atEnd()) { | 2572 if (!range.atEnd()) { |
2573 if (range.peek().id() == CSSValueAuto) // `auto' is the default | 2573 if (range.peek().id() == CSSValueAuto) // `auto' is the default |
2574 range.consumeIncludingWhitespace(); | 2574 range.consumeIncludingWhitespace(); |
2575 else | 2575 else |
2576 vertical = consumeLengthOrPercent(range, cssParserMode, ValueRangeAl l, UnitlessQuirk::Forbid); | 2576 vertical = consumeLengthOrPercent(range, cssParserMode, ValueRangeAl l, UnitlessQuirk::Forbid); |
2577 } else if (unresolvedProperty == CSSPropertyAliasWebkitBackgroundSize) { | 2577 } else if (unresolvedProperty == CSSPropertyAliasWebkitBackgroundSize) { |
2578 // Legacy syntax: "-webkit-background-size: 10px" is equivalent to "back ground-size: 10px 10px". | 2578 // Legacy syntax: "-webkit-background-size: 10px" is equivalent to "back ground-size: 10px 10px". |
2579 vertical = horizontal; | 2579 vertical = horizontal; |
2580 } | 2580 } |
2581 if (!vertical) | 2581 if (!vertical) |
2582 return horizontal; | 2582 return horizontal; |
2583 return CSSValuePair::create(horizontal, vertical, CSSValuePair::KeepIdentica lValues); | 2583 return CSSValuePair::create(horizontal, vertical, CSSValuePair::KeepIdentica lValues); |
2584 } | 2584 } |
2585 | 2585 |
2586 static CSSValueList* consumeGridAutoFlow(CSSParserTokenRange& range) | 2586 static CSSValueList* consumeGridAutoFlow(CSSParserTokenRange& range) |
2587 { | 2587 { |
2588 CSSPrimitiveValue* rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColu mn>(range); | 2588 CSSIdentifierValue* rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueCol umn>(range); |
2589 CSSPrimitiveValue* denseAlgorithm = consumeIdent<CSSValueDense>(range); | 2589 CSSIdentifierValue* denseAlgorithm = consumeIdent<CSSValueDense>(range); |
2590 if (!rowOrColumnValue) { | 2590 if (!rowOrColumnValue) { |
2591 rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColumn>(range); | 2591 rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColumn>(range); |
2592 if (!rowOrColumnValue && !denseAlgorithm) | 2592 if (!rowOrColumnValue && !denseAlgorithm) |
2593 return nullptr; | 2593 return nullptr; |
2594 } | 2594 } |
2595 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); | 2595 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); |
2596 if (rowOrColumnValue) | 2596 if (rowOrColumnValue) |
2597 parsedValues->append(*rowOrColumnValue); | 2597 parsedValues->append(*rowOrColumnValue); |
2598 if (denseAlgorithm) | 2598 if (denseAlgorithm) |
2599 parsedValues->append(*denseAlgorithm); | 2599 parsedValues->append(*denseAlgorithm); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2661 CSSValue* result = nullptr; | 2661 CSSValue* result = nullptr; |
2662 do { | 2662 do { |
2663 CSSValue* value = consumeBackgroundComponent(unresolvedProperty, range, context); | 2663 CSSValue* value = consumeBackgroundComponent(unresolvedProperty, range, context); |
2664 if (!value) | 2664 if (!value) |
2665 return nullptr; | 2665 return nullptr; |
2666 addBackgroundValue(result, value); | 2666 addBackgroundValue(result, value); |
2667 } while (consumeCommaIncludingWhitespace(range)); | 2667 } while (consumeCommaIncludingWhitespace(range)); |
2668 return result; | 2668 return result; |
2669 } | 2669 } |
2670 | 2670 |
2671 static CSSPrimitiveValue* consumeSelfPositionKeyword(CSSParserTokenRange& range) | 2671 static CSSIdentifierValue* consumeSelfPositionKeyword(CSSParserTokenRange& range ) |
2672 { | 2672 { |
2673 CSSValueID id = range.peek().id(); | 2673 CSSValueID id = range.peek().id(); |
2674 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 2674 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
2675 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart | 2675 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart |
2676 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) | 2676 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) |
2677 return consumeIdent(range); | 2677 return consumeIdent(range); |
2678 return nullptr; | 2678 return nullptr; |
2679 } | 2679 } |
2680 | 2680 |
2681 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) | 2681 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) |
2682 { | 2682 { |
2683 if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch, CSSValueBase line, CSSValueLastBaseline>(range.peek().id())) | 2683 if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch, CSSValueBase line, CSSValueLastBaseline>(range.peek().id())) |
2684 return consumeIdent(range); | 2684 return consumeIdent(range); |
2685 | 2685 |
2686 CSSPrimitiveValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueS afe>(range); | 2686 CSSIdentifierValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValue Safe>(range); |
2687 CSSPrimitiveValue* selfPosition = consumeSelfPositionKeyword(range); | 2687 CSSIdentifierValue* selfPosition = consumeSelfPositionKeyword(range); |
2688 if (!selfPosition) | 2688 if (!selfPosition) |
2689 return nullptr; | 2689 return nullptr; |
2690 if (!overflowPosition) | 2690 if (!overflowPosition) |
2691 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); | 2691 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); |
2692 if (overflowPosition) | 2692 if (overflowPosition) |
2693 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair ::DropIdenticalValues); | 2693 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair ::DropIdenticalValues); |
2694 return selfPosition; | 2694 return selfPosition; |
2695 } | 2695 } |
2696 | 2696 |
2697 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) | 2697 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) |
2698 { | 2698 { |
2699 // align-items property does not allow the 'auto' value. | 2699 // align-items property does not allow the 'auto' value. |
2700 if (identMatches<CSSValueAuto>(range.peek().id())) | 2700 if (identMatches<CSSValueAuto>(range.peek().id())) |
2701 return nullptr; | 2701 return nullptr; |
2702 return consumeSelfPositionOverflowPosition(range); | 2702 return consumeSelfPositionOverflowPosition(range); |
2703 } | 2703 } |
2704 | 2704 |
2705 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) | 2705 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) |
2706 { | 2706 { |
2707 CSSParserTokenRange rangeCopy = range; | 2707 CSSParserTokenRange rangeCopy = range; |
2708 CSSPrimitiveValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 2708 CSSIdentifierValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
2709 CSSPrimitiveValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueLe ft, CSSValueRight>(rangeCopy); | 2709 CSSIdentifierValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueL eft, CSSValueRight>(rangeCopy); |
2710 if (!legacy) | 2710 if (!legacy) |
2711 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 2711 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
2712 if (legacy && positionKeyword) { | 2712 if (legacy && positionKeyword) { |
2713 range = rangeCopy; | 2713 range = rangeCopy; |
2714 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI denticalValues); | 2714 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI denticalValues); |
2715 } | 2715 } |
2716 return consumeSelfPositionOverflowPosition(range); | 2716 return consumeSelfPositionOverflowPosition(range); |
2717 } | 2717 } |
2718 | 2718 |
2719 static CSSValue* consumeFitContent(CSSParserTokenRange& range, CSSParserMode css ParserMode) | 2719 static CSSValue* consumeFitContent(CSSParserTokenRange& range, CSSParserMode css ParserMode) |
(...skipping 14 matching lines...) Expand all Loading... | |
2734 if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueSpan) | 2734 if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueSpan) |
2735 return nullptr; | 2735 return nullptr; |
2736 return consumeCustomIdent(range); | 2736 return consumeCustomIdent(range); |
2737 } | 2737 } |
2738 | 2738 |
2739 static CSSValue* consumeGridLine(CSSParserTokenRange& range) | 2739 static CSSValue* consumeGridLine(CSSParserTokenRange& range) |
2740 { | 2740 { |
2741 if (range.peek().id() == CSSValueAuto) | 2741 if (range.peek().id() == CSSValueAuto) |
2742 return consumeIdent(range); | 2742 return consumeIdent(range); |
2743 | 2743 |
2744 CSSPrimitiveValue* spanValue = nullptr; | 2744 CSSIdentifierValue* spanValue = nullptr; |
2745 CSSCustomIdentValue* gridLineName = nullptr; | 2745 CSSCustomIdentValue* gridLineName = nullptr; |
2746 CSSPrimitiveValue* numericValue = consumeInteger(range); | 2746 CSSPrimitiveValue* numericValue = consumeInteger(range); |
2747 if (numericValue) { | 2747 if (numericValue) { |
2748 gridLineName = consumeCustomIdentForGridLine(range); | 2748 gridLineName = consumeCustomIdentForGridLine(range); |
2749 spanValue = consumeIdent<CSSValueSpan>(range); | 2749 spanValue = consumeIdent<CSSValueSpan>(range); |
2750 } else { | 2750 } else { |
2751 spanValue = consumeIdent<CSSValueSpan>(range); | 2751 spanValue = consumeIdent<CSSValueSpan>(range); |
2752 if (spanValue) { | 2752 if (spanValue) { |
2753 numericValue = consumeInteger(range); | 2753 numericValue = consumeInteger(range); |
2754 gridLineName = consumeCustomIdentForGridLine(range); | 2754 gridLineName = consumeCustomIdentForGridLine(range); |
(...skipping 23 matching lines...) Expand all Loading... | |
2778 if (spanValue) | 2778 if (spanValue) |
2779 values->append(*spanValue); | 2779 values->append(*spanValue); |
2780 if (numericValue) | 2780 if (numericValue) |
2781 values->append(*numericValue); | 2781 values->append(*numericValue); |
2782 if (gridLineName) | 2782 if (gridLineName) |
2783 values->append(*gridLineName); | 2783 values->append(*gridLineName); |
2784 ASSERT(values->length()); | 2784 ASSERT(values->length()); |
2785 return values; | 2785 return values; |
2786 } | 2786 } |
2787 | 2787 |
2788 static bool isGridTrackFixedSized(const CSSPrimitiveValue& primitiveValue) | 2788 static bool isGridTrackFixedSizedInternal(const CSSValue& value) |
Timothy Loh
2016/09/21 07:55:06
I'm not sure about this name change, both of these
sashab
2016/09/23 01:01:10
Nice! Done
| |
2789 { | 2789 { |
2790 CSSValueID valueID = primitiveValue.getValueID(); | 2790 if (value.isIdentifierValue()) { |
2791 if (valueID == CSSValueMinContent || valueID == CSSValueMaxContent || valueI D == CSSValueAuto || primitiveValue.isFlex()) | 2791 CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); |
2792 return false; | 2792 return !(valueID == CSSValueMinContent || valueID == CSSValueMaxContent || valueID == CSSValueAuto); |
2793 } | |
2794 | |
2795 if (value.isPrimitiveValue()) { | |
2796 return !toCSSPrimitiveValue(value).isFlex(); | |
2797 } | |
2793 | 2798 |
2794 return true; | 2799 return true; |
Timothy Loh
2016/09/21 07:55:06
Is this actually reached?
sashab
2016/09/23 01:01:10
Added NOTREACHED() and nothing failed :) So leavin
| |
2795 } | 2800 } |
2796 | 2801 |
2797 static bool isGridTrackFixedSized(const CSSValue& value) | 2802 static bool isGridTrackFixedSized(const CSSValue& value) |
2798 { | 2803 { |
2799 if (value.isPrimitiveValue()) | 2804 if (value.isPrimitiveValue() || value.isIdentifierValue()) |
2800 return isGridTrackFixedSized(toCSSPrimitiveValue(value)); | 2805 return isGridTrackFixedSizedInternal(value); |
2801 | 2806 |
2802 DCHECK(value.isFunctionValue()); | 2807 DCHECK(value.isFunctionValue()); |
2803 auto& function = toCSSFunctionValue(value); | 2808 auto& function = toCSSFunctionValue(value); |
2804 if (function.functionType() == CSSValueFitContent) | 2809 if (function.functionType() == CSSValueFitContent) |
2805 return false; | 2810 return false; |
2806 | 2811 |
2807 const CSSPrimitiveValue& minPrimitiveValue = toCSSPrimitiveValue(function.it em(0)); | 2812 const CSSValue& minValue = function.item(0); |
2808 const CSSPrimitiveValue& maxPrimitiveValue = toCSSPrimitiveValue(function.it em(1)); | 2813 const CSSValue& maxValue = function.item(1); |
2809 return isGridTrackFixedSized(minPrimitiveValue) || isGridTrackFixedSized(max PrimitiveValue); | 2814 return isGridTrackFixedSizedInternal(minValue) || isGridTrackFixedSizedInter nal(maxValue); |
2810 } | 2815 } |
2811 | 2816 |
2812 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNam es) | 2817 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNam es) |
2813 { | 2818 { |
2814 ASSERT(!gridRowNames.isEmpty()); | 2819 ASSERT(!gridRowNames.isEmpty()); |
2815 Vector<String> columnNames; | 2820 Vector<String> columnNames; |
2816 // Using StringImpl to avoid checks and indirection in every call to String: :operator[]. | 2821 // Using StringImpl to avoid checks and indirection in every call to String: :operator[]. |
2817 StringImpl& text = *gridRowNames.impl(); | 2822 StringImpl& text = *gridRowNames.impl(); |
2818 | 2823 |
2819 StringBuilder areaName; | 2824 StringBuilder areaName; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2896 return false; | 2901 return false; |
2897 | 2902 |
2898 gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.s tartLine(), gridArea.rows.endLine() + 1); | 2903 gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.s tartLine(), gridArea.rows.endLine() + 1); |
2899 } | 2904 } |
2900 currentColumn = lookAheadColumn - 1; | 2905 currentColumn = lookAheadColumn - 1; |
2901 } | 2906 } |
2902 | 2907 |
2903 return true; | 2908 return true; |
2904 } | 2909 } |
2905 | 2910 |
2906 static CSSPrimitiveValue* consumeGridBreadth(CSSParserTokenRange& range, CSSPars erMode cssParserMode) | 2911 static CSSValue* consumeGridBreadth(CSSParserTokenRange& range, CSSParserMode cs sParserMode) |
2907 { | 2912 { |
2908 const CSSParserToken& token = range.peek(); | 2913 const CSSParserToken& token = range.peek(); |
2909 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(token .id())) | 2914 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(token .id())) |
2910 return consumeIdent(range); | 2915 return consumeIdent(range); |
2911 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue: :UnitType::Fraction) { | 2916 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue: :UnitType::Fraction) { |
2912 if (range.peek().numericValue() < 0) | 2917 if (range.peek().numericValue() < 0) |
2913 return nullptr; | 2918 return nullptr; |
2914 return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().nume ricValue(), CSSPrimitiveValue::UnitType::Fraction); | 2919 return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().nume ricValue(), CSSPrimitiveValue::UnitType::Fraction); |
2915 } | 2920 } |
2916 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U nitlessQuirk::Allow); | 2921 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U nitlessQuirk::Allow); |
2917 } | 2922 } |
2918 | 2923 |
2919 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode cssParserMode) | 2924 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode cssParserMode) |
2920 { | 2925 { |
2921 const CSSParserToken& token = range.peek(); | 2926 const CSSParserToken& token = range.peek(); |
2922 if (identMatches<CSSValueAuto>(token.id())) | 2927 if (identMatches<CSSValueAuto>(token.id())) |
2923 return consumeIdent(range); | 2928 return consumeIdent(range); |
2924 | 2929 |
2925 if (token.functionId() == CSSValueMinmax) { | 2930 if (token.functionId() == CSSValueMinmax) { |
2926 CSSParserTokenRange rangeCopy = range; | 2931 CSSParserTokenRange rangeCopy = range; |
2927 CSSParserTokenRange args = consumeFunction(rangeCopy); | 2932 CSSParserTokenRange args = consumeFunction(rangeCopy); |
2928 CSSPrimitiveValue* minTrackBreadth = consumeGridBreadth(args, cssParserM ode); | 2933 CSSValue* minTrackBreadth = consumeGridBreadth(args, cssParserMode); |
2929 if (!minTrackBreadth || minTrackBreadth->isFlex() || !consumeCommaInclud ingWhitespace(args)) | 2934 if (!minTrackBreadth || (minTrackBreadth->isPrimitiveValue() && toCSSPri mitiveValue(minTrackBreadth)->isFlex()) || !consumeCommaIncludingWhitespace(args )) |
2930 return nullptr; | 2935 return nullptr; |
2931 CSSPrimitiveValue* maxTrackBreadth = consumeGridBreadth(args, cssParserM ode); | 2936 CSSValue* maxTrackBreadth = consumeGridBreadth(args, cssParserMode); |
2932 if (!maxTrackBreadth || !args.atEnd()) | 2937 if (!maxTrackBreadth || !args.atEnd()) |
2933 return nullptr; | 2938 return nullptr; |
2934 range = rangeCopy; | 2939 range = rangeCopy; |
2935 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueMinmax); | 2940 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueMinmax); |
2936 result->append(*minTrackBreadth); | 2941 result->append(*minTrackBreadth); |
2937 result->append(*maxTrackBreadth); | 2942 result->append(*maxTrackBreadth); |
2938 return result; | 2943 return result; |
2939 } | 2944 } |
2940 | 2945 |
2941 if (token.functionId() == CSSValueFitContent) | 2946 if (token.functionId() == CSSValueFitContent) |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3510 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3515 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3511 return consumeGridTemplateAreas(m_range); | 3516 return consumeGridTemplateAreas(m_range); |
3512 case CSSPropertyGridAutoFlow: | 3517 case CSSPropertyGridAutoFlow: |
3513 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3518 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3514 return consumeGridAutoFlow(m_range); | 3519 return consumeGridAutoFlow(m_range); |
3515 default: | 3520 default: |
3516 return nullptr; | 3521 return nullptr; |
3517 } | 3522 } |
3518 } | 3523 } |
3519 | 3524 |
3520 static CSSPrimitiveValue* consumeFontDisplay(CSSParserTokenRange& range) | 3525 static CSSIdentifierValue* consumeFontDisplay(CSSParserTokenRange& range) |
3521 { | 3526 { |
3522 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap, CSSValueFallb ack, CSSValueOptional>(range); | 3527 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap, CSSValueFallb ack, CSSValueOptional>(range); |
3523 } | 3528 } |
3524 | 3529 |
3525 static CSSValueList* consumeFontFaceUnicodeRange(CSSParserTokenRange& range) | 3530 static CSSValueList* consumeFontFaceUnicodeRange(CSSParserTokenRange& range) |
3526 { | 3531 { |
3527 CSSValueList* values = CSSValueList::createCommaSeparated(); | 3532 CSSValueList* values = CSSValueList::createCommaSeparated(); |
3528 | 3533 |
3529 do { | 3534 do { |
3530 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 3535 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3615 parsedValue = consumeFontFaceUnicodeRange(m_range); | 3620 parsedValue = consumeFontFaceUnicodeRange(m_range); |
3616 break; | 3621 break; |
3617 case CSSPropertyFontDisplay: | 3622 case CSSPropertyFontDisplay: |
3618 parsedValue = consumeFontDisplay(m_range); | 3623 parsedValue = consumeFontDisplay(m_range); |
3619 break; | 3624 break; |
3620 case CSSPropertyFontStretch: | 3625 case CSSPropertyFontStretch: |
3621 case CSSPropertyFontStyle: { | 3626 case CSSPropertyFontStyle: { |
3622 CSSValueID id = m_range.consumeIncludingWhitespace().id(); | 3627 CSSValueID id = m_range.consumeIncludingWhitespace().id(); |
3623 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_co ntext.mode())) | 3628 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_co ntext.mode())) |
3624 return false; | 3629 return false; |
3625 parsedValue = CSSPrimitiveValue::createIdentifier(id); | 3630 parsedValue = CSSIdentifierValue::createIdentifier(id); |
3626 break; | 3631 break; |
3627 } | 3632 } |
3628 case CSSPropertyFontVariant: | 3633 case CSSPropertyFontVariant: |
3629 parsedValue = consumeFontVariantList(m_range); | 3634 parsedValue = consumeFontVariantList(m_range); |
3630 break; | 3635 break; |
3631 case CSSPropertyFontWeight: | 3636 case CSSPropertyFontWeight: |
3632 parsedValue = consumeFontWeight(m_range); | 3637 parsedValue = consumeFontWeight(m_range); |
3633 break; | 3638 break; |
3634 case CSSPropertyFontFeatureSettings: | 3639 case CSSPropertyFontFeatureSettings: |
3635 parsedValue = consumeFontFeatureSettings(m_range); | 3640 parsedValue = consumeFontFeatureSettings(m_range); |
(...skipping 15 matching lines...) Expand all Loading... | |
3651 ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar) ; | 3656 ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar) ; |
3652 if (!m_range.atEnd()) | 3657 if (!m_range.atEnd()) |
3653 return false; | 3658 return false; |
3654 | 3659 |
3655 FontStyle fontStyle = FontStyleNormal; | 3660 FontStyle fontStyle = FontStyleNormal; |
3656 FontWeight fontWeight = FontWeightNormal; | 3661 FontWeight fontWeight = FontWeightNormal; |
3657 float fontSize = 0; | 3662 float fontSize = 0; |
3658 AtomicString fontFamily; | 3663 AtomicString fontFamily; |
3659 LayoutTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSiz e, fontFamily); | 3664 LayoutTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSiz e, fontFamily); |
3660 | 3665 |
3661 addProperty(CSSPropertyFontStyle, CSSPropertyFont, *CSSPrimitiveValue::creat eIdentifier(fontStyle == FontStyleItalic ? CSSValueItalic : CSSValueNormal), imp ortant); | 3666 addProperty(CSSPropertyFontStyle, CSSPropertyFont, *CSSIdentifierValue::crea teIdentifier(fontStyle == FontStyleItalic ? CSSValueItalic : CSSValueNormal), im portant); |
3662 addProperty(CSSPropertyFontWeight, CSSPropertyFont, *CSSPrimitiveValue::crea te(fontWeight), important); | 3667 addProperty(CSSPropertyFontWeight, CSSPropertyFont, *CSSIdentifierValue::cre ate(fontWeight), important); |
3663 addProperty(CSSPropertyFontSize, CSSPropertyFont, *CSSPrimitiveValue::create (fontSize, CSSPrimitiveValue::UnitType::Pixels), important); | 3668 addProperty(CSSPropertyFontSize, CSSPropertyFont, *CSSPrimitiveValue::create (fontSize, CSSPrimitiveValue::UnitType::Pixels), important); |
3664 CSSValueList* fontFamilyList = CSSValueList::createCommaSeparated(); | 3669 CSSValueList* fontFamilyList = CSSValueList::createCommaSeparated(); |
3665 fontFamilyList->append(*CSSFontFamilyValue::create(fontFamily)); | 3670 fontFamilyList->append(*CSSFontFamilyValue::create(fontFamily)); |
3666 addProperty(CSSPropertyFontFamily, CSSPropertyFont, *fontFamilyList, importa nt); | 3671 addProperty(CSSPropertyFontFamily, CSSPropertyFont, *fontFamilyList, importa nt); |
3667 | 3672 |
3668 addProperty(CSSPropertyFontStretch, CSSPropertyFont, *CSSPrimitiveValue::cre ateIdentifier(CSSValueNormal), important); | 3673 addProperty(CSSPropertyFontStretch, CSSPropertyFont, *CSSIdentifierValue::cr eateIdentifier(CSSValueNormal), important); |
3669 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, *CSSPrimitiveValue: :createIdentifier(CSSValueNormal), important); | 3674 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, *CSSIdentifierValue ::createIdentifier(CSSValueNormal), important); |
3670 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSPrimitiveV alue::createIdentifier(CSSValueNormal), important); | 3675 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSIdentifier Value::createIdentifier(CSSValueNormal), important); |
3671 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSPrimitiveVal ue::createIdentifier(CSSValueNormal), important); | 3676 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSIdentifierVa lue::createIdentifier(CSSValueNormal), important); |
3672 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *CSSPrimitiveValue::crea teIdentifier(CSSValueNormal), important); | 3677 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *CSSIdentifierValue::cre ateIdentifier(CSSValueNormal), important); |
3673 return true; | 3678 return true; |
3674 } | 3679 } |
3675 | 3680 |
3676 bool CSSPropertyParser::consumeFont(bool important) | 3681 bool CSSPropertyParser::consumeFont(bool important) |
3677 { | 3682 { |
3678 // Let's check if there is an inherit or initial somewhere in the shorthand. | 3683 // Let's check if there is an inherit or initial somewhere in the shorthand. |
3679 CSSParserTokenRange range = m_range; | 3684 CSSParserTokenRange range = m_range; |
3680 while (!range.atEnd()) { | 3685 while (!range.atEnd()) { |
3681 CSSValueID id = range.consumeIncludingWhitespace().id(); | 3686 CSSValueID id = range.consumeIncludingWhitespace().id(); |
3682 if (id == CSSValueInherit || id == CSSValueInitial) | 3687 if (id == CSSValueInherit || id == CSSValueInitial) |
3683 return false; | 3688 return false; |
3684 } | 3689 } |
3685 // Optional font-style, font-variant, font-stretch and font-weight. | 3690 // Optional font-style, font-variant, font-stretch and font-weight. |
3686 CSSPrimitiveValue* fontStyle = nullptr; | 3691 CSSIdentifierValue* fontStyle = nullptr; |
3687 CSSPrimitiveValue* fontVariantCaps = nullptr; | 3692 CSSIdentifierValue* fontVariantCaps = nullptr; |
3688 CSSPrimitiveValue* fontWeight = nullptr; | 3693 CSSIdentifierValue* fontWeight = nullptr; |
3689 CSSPrimitiveValue* fontStretch = nullptr; | 3694 CSSIdentifierValue* fontStretch = nullptr; |
3690 while (!m_range.atEnd()) { | 3695 while (!m_range.atEnd()) { |
3691 CSSValueID id = m_range.peek().id(); | 3696 CSSValueID id = m_range.peek().id(); |
3692 if (!fontStyle && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSS PropertyFontStyle, id, m_context.mode())) { | 3697 if (!fontStyle && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSS PropertyFontStyle, id, m_context.mode())) { |
3693 fontStyle = consumeIdent(m_range); | 3698 fontStyle = consumeIdent(m_range); |
3694 continue; | 3699 continue; |
3695 } | 3700 } |
3696 if (!fontVariantCaps && (id == CSSValueNormal || id == CSSValueSmallCaps )) { | 3701 if (!fontVariantCaps && (id == CSSValueNormal || id == CSSValueSmallCaps )) { |
3697 // Font variant in the shorthand is particular, it only accepts norm al or small-caps. | 3702 // Font variant in the shorthand is particular, it only accepts norm al or small-caps. |
3698 // See https://drafts.csswg.org/css-fonts/#propdef-font | 3703 // See https://drafts.csswg.org/css-fonts/#propdef-font |
3699 fontVariantCaps = consumeFontVariantCSS21(m_range); | 3704 fontVariantCaps = consumeFontVariantCSS21(m_range); |
3700 if (fontVariantCaps) | 3705 if (fontVariantCaps) |
3701 continue; | 3706 continue; |
3702 } | 3707 } |
3703 if (!fontWeight) { | 3708 if (!fontWeight) { |
3704 fontWeight = consumeFontWeight(m_range); | 3709 fontWeight = consumeFontWeight(m_range); |
3705 if (fontWeight) | 3710 if (fontWeight) |
3706 continue; | 3711 continue; |
3707 } | 3712 } |
3708 if (!fontStretch && CSSParserFastPaths::isValidKeywordPropertyAndValue(C SSPropertyFontStretch, id, m_context.mode())) | 3713 if (!fontStretch && CSSParserFastPaths::isValidKeywordPropertyAndValue(C SSPropertyFontStretch, id, m_context.mode())) |
3709 fontStretch = consumeIdent(m_range); | 3714 fontStretch = consumeIdent(m_range); |
3710 else | 3715 else |
3711 break; | 3716 break; |
3712 } | 3717 } |
3713 | 3718 |
3714 if (m_range.atEnd()) | 3719 if (m_range.atEnd()) |
3715 return false; | 3720 return false; |
3716 | 3721 |
3717 addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle ? *fontStyle : *CSSPrimitiveValue::createIdentifier(CSSValueNormal), important); | 3722 addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle ? *fontStyle : *CSSIdentifierValue::createIdentifier(CSSValueNormal), important); |
3718 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, fontVariantCaps ? * fontVariantCaps : *CSSPrimitiveValue::createIdentifier(CSSValueNormal), importan t); | 3723 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, fontVariantCaps ? * fontVariantCaps : *CSSIdentifierValue::createIdentifier(CSSValueNormal), importa nt); |
3719 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSPrimitiveV alue::createIdentifier(CSSValueNormal), important); | 3724 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSIdentifier Value::createIdentifier(CSSValueNormal), important); |
3720 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSPrimitiveVal ue::createIdentifier(CSSValueNormal), important); | 3725 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSIdentifierVa lue::createIdentifier(CSSValueNormal), important); |
3721 | 3726 |
3722 addProperty(CSSPropertyFontWeight, CSSPropertyFont, fontWeight ? *fontWeight : *CSSPrimitiveValue::createIdentifier(CSSValueNormal), important); | 3727 addProperty(CSSPropertyFontWeight, CSSPropertyFont, fontWeight ? *fontWeight : *CSSIdentifierValue::createIdentifier(CSSValueNormal), important); |
3723 addProperty(CSSPropertyFontStretch, CSSPropertyFont, fontStretch ? *fontStre tch : *CSSPrimitiveValue::createIdentifier(CSSValueNormal), important); | 3728 addProperty(CSSPropertyFontStretch, CSSPropertyFont, fontStretch ? *fontStre tch : *CSSIdentifierValue::createIdentifier(CSSValueNormal), important); |
3724 | 3729 |
3725 // Now a font size _must_ come. | 3730 // Now a font size _must_ come. |
3726 CSSValue* fontSize = consumeFontSize(m_range, m_context.mode()); | 3731 CSSValue* fontSize = consumeFontSize(m_range, m_context.mode()); |
3727 if (!fontSize || m_range.atEnd()) | 3732 if (!fontSize || m_range.atEnd()) |
3728 return false; | 3733 return false; |
3729 | 3734 |
3730 addProperty(CSSPropertyFontSize, CSSPropertyFont, *fontSize, important); | 3735 addProperty(CSSPropertyFontSize, CSSPropertyFont, *fontSize, important); |
3731 | 3736 |
3732 if (consumeSlashIncludingWhitespace(m_range)) { | 3737 if (consumeSlashIncludingWhitespace(m_range)) { |
3733 CSSPrimitiveValue* lineHeight = consumeLineHeight(m_range, m_context.mod e()); | 3738 CSSValue* lineHeight = consumeLineHeight(m_range, m_context.mode()); |
3734 if (!lineHeight) | 3739 if (!lineHeight) |
3735 return false; | 3740 return false; |
3736 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *lineHeight, importa nt); | 3741 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *lineHeight, importa nt); |
3737 } else { | 3742 } else { |
3738 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *CSSPrimitiveValue:: createIdentifier(CSSValueNormal), important); | 3743 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *CSSIdentifierValue: :createIdentifier(CSSValueNormal), important); |
3739 } | 3744 } |
3740 | 3745 |
3741 // Font family must come now. | 3746 // Font family must come now. |
3742 CSSValue* parsedFamilyValue = consumeFontFamily(m_range); | 3747 CSSValue* parsedFamilyValue = consumeFontFamily(m_range); |
3743 if (!parsedFamilyValue) | 3748 if (!parsedFamilyValue) |
3744 return false; | 3749 return false; |
3745 | 3750 |
3746 addProperty(CSSPropertyFontFamily, CSSPropertyFont, *parsedFamilyValue, impo rtant); | 3751 addProperty(CSSPropertyFontFamily, CSSPropertyFont, *parsedFamilyValue, impo rtant); |
3747 | 3752 |
3748 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requir es that | 3753 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requir es that |
3749 // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their initial values | 3754 // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their initial values |
3750 // but we don't seem to support them at the moment. They should also be adde d here once implemented. | 3755 // but we don't seem to support them at the moment. They should also be adde d here once implemented. |
3751 return m_range.atEnd(); | 3756 return m_range.atEnd(); |
3752 } | 3757 } |
3753 | 3758 |
3754 bool CSSPropertyParser::consumeFontVariantShorthand(bool important) | 3759 bool CSSPropertyParser::consumeFontVariantShorthand(bool important) |
3755 { | 3760 { |
3756 if (identMatches<CSSValueNormal, CSSValueNone>(m_range.peek().id())) { | 3761 if (identMatches<CSSValueNormal, CSSValueNone>(m_range.peek().id())) { |
3757 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *co nsumeIdent(m_range), important); | 3762 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *co nsumeIdent(m_range), important); |
3758 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, *CSSPrim itiveValue::createIdentifier(CSSValueNormal), important); | 3763 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, *CSSIden tifierValue::createIdentifier(CSSValueNormal), important); |
3759 return m_range.atEnd(); | 3764 return m_range.atEnd(); |
3760 } | 3765 } |
3761 | 3766 |
3762 CSSPrimitiveValue* capsValue = nullptr; | 3767 CSSIdentifierValue* capsValue = nullptr; |
3763 FontVariantLigaturesParser ligaturesParser; | 3768 FontVariantLigaturesParser ligaturesParser; |
3764 FontVariantNumericParser numericParser; | 3769 FontVariantNumericParser numericParser; |
3765 do { | 3770 do { |
3766 FontVariantLigaturesParser::ParseResult ligaturesParseResult = ligatures Parser.consumeLigature(m_range); | 3771 FontVariantLigaturesParser::ParseResult ligaturesParseResult = ligatures Parser.consumeLigature(m_range); |
3767 FontVariantNumericParser::ParseResult numericParseResult = numericParser .consumeNumeric(m_range); | 3772 FontVariantNumericParser::ParseResult numericParseResult = numericParser .consumeNumeric(m_range); |
3768 if (ligaturesParseResult == FontVariantLigaturesParser::ParseResult::Con sumedValue | 3773 if (ligaturesParseResult == FontVariantLigaturesParser::ParseResult::Con sumedValue |
3769 || numericParseResult == FontVariantNumericParser::ParseResult::Cons umedValue) | 3774 || numericParseResult == FontVariantNumericParser::ParseResult::Cons umedValue) |
3770 continue; | 3775 continue; |
3771 | 3776 |
3772 if (ligaturesParseResult == FontVariantLigaturesParser::ParseResult::Dis allowedValue | 3777 if (ligaturesParseResult == FontVariantLigaturesParser::ParseResult::Dis allowedValue |
(...skipping 13 matching lines...) Expand all Loading... | |
3786 return false; | 3791 return false; |
3787 capsValue = consumeIdent(m_range); | 3792 capsValue = consumeIdent(m_range); |
3788 break; | 3793 break; |
3789 default: | 3794 default: |
3790 return false; | 3795 return false; |
3791 } | 3796 } |
3792 } while (!m_range.atEnd()); | 3797 } while (!m_range.atEnd()); |
3793 | 3798 |
3794 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *ligatu resParser.finalizeValue(), important); | 3799 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *ligatu resParser.finalizeValue(), important); |
3795 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFontVariant, *numericP arser.finalizeValue(), important); | 3800 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFontVariant, *numericP arser.finalizeValue(), important); |
3796 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, capsValue ? *capsValue : *CSSPrimitiveValue::createIdentifier(CSSValueNormal), important); | 3801 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, capsValue ? *capsValue : *CSSIdentifierValue::createIdentifier(CSSValueNormal), important); |
3797 return true; | 3802 return true; |
3798 } | 3803 } |
3799 | 3804 |
3800 bool CSSPropertyParser::consumeBorderSpacing(bool important) | 3805 bool CSSPropertyParser::consumeBorderSpacing(bool important) |
3801 { | 3806 { |
3802 CSSValue* horizontalSpacing = consumeLength(m_range, m_context.mode(), Value RangeNonNegative, UnitlessQuirk::Allow); | 3807 CSSValue* horizontalSpacing = consumeLength(m_range, m_context.mode(), Value RangeNonNegative, UnitlessQuirk::Allow); |
3803 if (!horizontalSpacing) | 3808 if (!horizontalSpacing) |
3804 return false; | 3809 return false; |
3805 CSSValue* verticalSpacing = horizontalSpacing; | 3810 CSSValue* verticalSpacing = horizontalSpacing; |
3806 if (!m_range.atEnd()) | 3811 if (!m_range.atEnd()) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3916 bool CSSPropertyParser::consumeColumns(bool important) | 3921 bool CSSPropertyParser::consumeColumns(bool important) |
3917 { | 3922 { |
3918 CSSValue* columnWidth = nullptr; | 3923 CSSValue* columnWidth = nullptr; |
3919 CSSValue* columnCount = nullptr; | 3924 CSSValue* columnCount = nullptr; |
3920 if (!consumeColumnWidthOrCount(m_range, columnWidth, columnCount)) | 3925 if (!consumeColumnWidthOrCount(m_range, columnWidth, columnCount)) |
3921 return false; | 3926 return false; |
3922 consumeColumnWidthOrCount(m_range, columnWidth, columnCount); | 3927 consumeColumnWidthOrCount(m_range, columnWidth, columnCount); |
3923 if (!m_range.atEnd()) | 3928 if (!m_range.atEnd()) |
3924 return false; | 3929 return false; |
3925 if (!columnWidth) | 3930 if (!columnWidth) |
3926 columnWidth = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 3931 columnWidth = CSSIdentifierValue::createIdentifier(CSSValueAuto); |
3927 if (!columnCount) | 3932 if (!columnCount) |
3928 columnCount = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 3933 columnCount = CSSIdentifierValue::createIdentifier(CSSValueAuto); |
3929 addProperty(CSSPropertyColumnWidth, CSSPropertyInvalid, *columnWidth, import ant); | 3934 addProperty(CSSPropertyColumnWidth, CSSPropertyInvalid, *columnWidth, import ant); |
3930 addProperty(CSSPropertyColumnCount, CSSPropertyInvalid, *columnCount, import ant); | 3935 addProperty(CSSPropertyColumnCount, CSSPropertyInvalid, *columnCount, import ant); |
3931 return true; | 3936 return true; |
3932 } | 3937 } |
3933 | 3938 |
3934 bool CSSPropertyParser::consumeShorthandGreedily(const StylePropertyShorthand& s horthand, bool important) | 3939 bool CSSPropertyParser::consumeShorthandGreedily(const StylePropertyShorthand& s horthand, bool important) |
3935 { | 3940 { |
3936 ASSERT(shorthand.length() <= 6); // Existing shorthands have at most 6 longh ands. | 3941 ASSERT(shorthand.length() <= 6); // Existing shorthands have at most 6 longh ands. |
3937 const CSSValue* longhands[6] = { nullptr, nullptr, nullptr, nullptr, nullptr , nullptr }; | 3942 const CSSValue* longhands[6] = { nullptr, nullptr, nullptr, nullptr, nullptr , nullptr }; |
3938 const CSSPropertyID* shorthandProperties = shorthand.properties(); | 3943 const CSSPropertyID* shorthandProperties = shorthand.properties(); |
(...skipping 17 matching lines...) Expand all Loading... | |
3956 addProperty(shorthandProperties[i], shorthand.id(), *CSSInitialValue ::createLegacyImplicit(), important); | 3961 addProperty(shorthandProperties[i], shorthand.id(), *CSSInitialValue ::createLegacyImplicit(), important); |
3957 } | 3962 } |
3958 return true; | 3963 return true; |
3959 } | 3964 } |
3960 | 3965 |
3961 bool CSSPropertyParser::consumeFlex(bool important) | 3966 bool CSSPropertyParser::consumeFlex(bool important) |
3962 { | 3967 { |
3963 static const double unsetValue = -1; | 3968 static const double unsetValue = -1; |
3964 double flexGrow = unsetValue; | 3969 double flexGrow = unsetValue; |
3965 double flexShrink = unsetValue; | 3970 double flexShrink = unsetValue; |
3966 CSSPrimitiveValue* flexBasis = nullptr; | 3971 CSSValue* flexBasis = nullptr; |
3967 | 3972 |
3968 if (m_range.peek().id() == CSSValueNone) { | 3973 if (m_range.peek().id() == CSSValueNone) { |
3969 flexGrow = 0; | 3974 flexGrow = 0; |
3970 flexShrink = 0; | 3975 flexShrink = 0; |
3971 flexBasis = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 3976 flexBasis = CSSIdentifierValue::createIdentifier(CSSValueAuto); |
3972 m_range.consumeIncludingWhitespace(); | 3977 m_range.consumeIncludingWhitespace(); |
3973 } else { | 3978 } else { |
3974 unsigned index = 0; | 3979 unsigned index = 0; |
3975 while (!m_range.atEnd() && index++ < 3) { | 3980 while (!m_range.atEnd() && index++ < 3) { |
3976 double num; | 3981 double num; |
3977 if (consumeNumberRaw(m_range, num)) { | 3982 if (consumeNumberRaw(m_range, num)) { |
3978 if (num < 0) | 3983 if (num < 0) |
3979 return false; | 3984 return false; |
3980 if (flexGrow == unsetValue) | 3985 if (flexGrow == unsetValue) |
3981 flexGrow = num; | 3986 flexGrow = num; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4151 return CSSPropertyBreakBefore; | 4156 return CSSPropertyBreakBefore; |
4152 ASSERT(property == CSSPropertyPageBreakInside || property == CSSPropertyWebk itColumnBreakInside); | 4157 ASSERT(property == CSSPropertyPageBreakInside || property == CSSPropertyWebk itColumnBreakInside); |
4153 return CSSPropertyBreakInside; | 4158 return CSSPropertyBreakInside; |
4154 } | 4159 } |
4155 | 4160 |
4156 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, bool important) | 4161 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, bool important) |
4157 { | 4162 { |
4158 // The fragmentation spec says that page-break-(after|before|inside) are to be treated as | 4163 // The fragmentation spec says that page-break-(after|before|inside) are to be treated as |
4159 // shorthands for their break-(after|before|inside) counterparts. We'll do t he same for the | 4164 // shorthands for their break-(after|before|inside) counterparts. We'll do t he same for the |
4160 // non-standard properties -webkit-column-break-(after|before|inside). | 4165 // non-standard properties -webkit-column-break-(after|before|inside). |
4161 CSSPrimitiveValue* keyword = consumeIdent(m_range); | 4166 CSSIdentifierValue* keyword = consumeIdent(m_range); |
4162 if (!keyword) | 4167 if (!keyword) |
4163 return false; | 4168 return false; |
4164 if (!m_range.atEnd()) | 4169 if (!m_range.atEnd()) |
4165 return false; | 4170 return false; |
4166 CSSValueID value = keyword->getValueID(); | 4171 CSSValueID value = keyword->getValueID(); |
4167 switch (property) { | 4172 switch (property) { |
4168 case CSSPropertyPageBreakAfter: | 4173 case CSSPropertyPageBreakAfter: |
4169 case CSSPropertyPageBreakBefore: | 4174 case CSSPropertyPageBreakBefore: |
4170 value = mapFromPageBreakBetween(value); | 4175 value = mapFromPageBreakBetween(value); |
4171 break; | 4176 break; |
4172 case CSSPropertyWebkitColumnBreakAfter: | 4177 case CSSPropertyWebkitColumnBreakAfter: |
4173 case CSSPropertyWebkitColumnBreakBefore: | 4178 case CSSPropertyWebkitColumnBreakBefore: |
4174 value = mapFromColumnBreakBetween(value); | 4179 value = mapFromColumnBreakBetween(value); |
4175 break; | 4180 break; |
4176 case CSSPropertyPageBreakInside: | 4181 case CSSPropertyPageBreakInside: |
4177 case CSSPropertyWebkitColumnBreakInside: | 4182 case CSSPropertyWebkitColumnBreakInside: |
4178 value = mapFromColumnOrPageBreakInside(value); | 4183 value = mapFromColumnOrPageBreakInside(value); |
4179 break; | 4184 break; |
4180 default: | 4185 default: |
4181 ASSERT_NOT_REACHED(); | 4186 ASSERT_NOT_REACHED(); |
4182 } | 4187 } |
4183 if (value == CSSValueInvalid) | 4188 if (value == CSSValueInvalid) |
4184 return false; | 4189 return false; |
4185 | 4190 |
4186 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property); | 4191 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property); |
4187 addProperty(genericBreakProperty, property, *CSSPrimitiveValue::createIdenti fier(value), important); | 4192 addProperty(genericBreakProperty, property, *CSSIdentifierValue::createIdent ifier(value), important); |
4188 return true; | 4193 return true; |
4189 } | 4194 } |
4190 | 4195 |
4191 static bool consumeBackgroundPosition(CSSParserTokenRange& range, const CSSParse rContext& context, UnitlessQuirk unitless, CSSValue*& resultX, CSSValue*& result Y) | 4196 static bool consumeBackgroundPosition(CSSParserTokenRange& range, const CSSParse rContext& context, UnitlessQuirk unitless, CSSValue*& resultX, CSSValue*& result Y) |
4192 { | 4197 { |
4193 do { | 4198 do { |
4194 CSSValue* positionX = nullptr; | 4199 CSSValue* positionX = nullptr; |
4195 CSSValue* positionY = nullptr; | 4200 CSSValue* positionY = nullptr; |
4196 if (!consumePosition(range, context.mode(), unitless, positionX, positio nY)) | 4201 if (!consumePosition(range, context.mode(), unitless, positionX, positio nY)) |
4197 return false; | 4202 return false; |
4198 addBackgroundValue(resultX, positionX); | 4203 addBackgroundValue(resultX, positionX); |
4199 addBackgroundValue(resultY, positionY); | 4204 addBackgroundValue(resultY, positionY); |
4200 } while (consumeCommaIncludingWhitespace(range)); | 4205 } while (consumeCommaIncludingWhitespace(range)); |
4201 return true; | 4206 return true; |
4202 } | 4207 } |
4203 | 4208 |
4204 static bool consumeRepeatStyleComponent(CSSParserTokenRange& range, CSSValue*& v alue1, CSSValue*& value2, bool& implicit) | 4209 static bool consumeRepeatStyleComponent(CSSParserTokenRange& range, CSSValue*& v alue1, CSSValue*& value2, bool& implicit) |
4205 { | 4210 { |
4206 if (consumeIdent<CSSValueRepeatX>(range)) { | 4211 if (consumeIdent<CSSValueRepeatX>(range)) { |
4207 value1 = CSSPrimitiveValue::createIdentifier(CSSValueRepeat); | 4212 value1 = CSSIdentifierValue::createIdentifier(CSSValueRepeat); |
4208 value2 = CSSPrimitiveValue::createIdentifier(CSSValueNoRepeat); | 4213 value2 = CSSIdentifierValue::createIdentifier(CSSValueNoRepeat); |
4209 implicit = true; | 4214 implicit = true; |
4210 return true; | 4215 return true; |
4211 } | 4216 } |
4212 if (consumeIdent<CSSValueRepeatY>(range)) { | 4217 if (consumeIdent<CSSValueRepeatY>(range)) { |
4213 value1 = CSSPrimitiveValue::createIdentifier(CSSValueNoRepeat); | 4218 value1 = CSSIdentifierValue::createIdentifier(CSSValueNoRepeat); |
4214 value2 = CSSPrimitiveValue::createIdentifier(CSSValueRepeat); | 4219 value2 = CSSIdentifierValue::createIdentifier(CSSValueRepeat); |
4215 implicit = true; | 4220 implicit = true; |
4216 return true; | 4221 return true; |
4217 } | 4222 } |
4218 value1 = consumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSVa lueSpace>(range); | 4223 value1 = consumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSVa lueSpace>(range); |
4219 if (!value1) | 4224 if (!value1) |
4220 return false; | 4225 return false; |
4221 | 4226 |
4222 value2 = consumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSVa lueSpace>(range); | 4227 value2 = consumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSVa lueSpace>(range); |
4223 if (!value2) { | 4228 if (!value2) { |
4224 value2 = value1; | 4229 value2 = value1; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4330 CSSValue* startValue = consumeGridLine(m_range); | 4335 CSSValue* startValue = consumeGridLine(m_range); |
4331 if (!startValue) | 4336 if (!startValue) |
4332 return false; | 4337 return false; |
4333 | 4338 |
4334 CSSValue* endValue = nullptr; | 4339 CSSValue* endValue = nullptr; |
4335 if (consumeSlashIncludingWhitespace(m_range)) { | 4340 if (consumeSlashIncludingWhitespace(m_range)) { |
4336 endValue = consumeGridLine(m_range); | 4341 endValue = consumeGridLine(m_range); |
4337 if (!endValue) | 4342 if (!endValue) |
4338 return false; | 4343 return false; |
4339 } else { | 4344 } else { |
4340 endValue = startValue->isCustomIdentValue() ? startValue : CSSPrimitiveV alue::createIdentifier(CSSValueAuto); | 4345 endValue = startValue->isCustomIdentValue() ? startValue : CSSIdentifier Value::createIdentifier(CSSValueAuto); |
4341 } | 4346 } |
4342 if (!m_range.atEnd()) | 4347 if (!m_range.atEnd()) |
4343 return false; | 4348 return false; |
4344 addProperty(shorthand.properties()[0], shorthandId, *startValue, important); | 4349 addProperty(shorthand.properties()[0], shorthandId, *startValue, important); |
4345 addProperty(shorthand.properties()[1], shorthandId, *endValue, important); | 4350 addProperty(shorthand.properties()[1], shorthandId, *endValue, important); |
4346 return true; | 4351 return true; |
4347 } | 4352 } |
4348 | 4353 |
4349 bool CSSPropertyParser::consumeGridAreaShorthand(bool important) | 4354 bool CSSPropertyParser::consumeGridAreaShorthand(bool important) |
4350 { | 4355 { |
(...skipping 16 matching lines...) Expand all Loading... | |
4367 if (consumeSlashIncludingWhitespace(m_range)) { | 4372 if (consumeSlashIncludingWhitespace(m_range)) { |
4368 columnEndValue = consumeGridLine(m_range); | 4373 columnEndValue = consumeGridLine(m_range); |
4369 if (!columnEndValue) | 4374 if (!columnEndValue) |
4370 return false; | 4375 return false; |
4371 } | 4376 } |
4372 } | 4377 } |
4373 } | 4378 } |
4374 if (!m_range.atEnd()) | 4379 if (!m_range.atEnd()) |
4375 return false; | 4380 return false; |
4376 if (!columnStartValue) | 4381 if (!columnStartValue) |
4377 columnStartValue = rowStartValue->isCustomIdentValue() ? rowStartValue : CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 4382 columnStartValue = rowStartValue->isCustomIdentValue() ? rowStartValue : CSSIdentifierValue::createIdentifier(CSSValueAuto); |
4378 if (!rowEndValue) | 4383 if (!rowEndValue) |
4379 rowEndValue = rowStartValue->isCustomIdentValue() ? rowStartValue : CSSP rimitiveValue::createIdentifier(CSSValueAuto); | 4384 rowEndValue = rowStartValue->isCustomIdentValue() ? rowStartValue : CSSI dentifierValue::createIdentifier(CSSValueAuto); |
4380 if (!columnEndValue) | 4385 if (!columnEndValue) |
4381 columnEndValue = columnStartValue->isCustomIdentValue() ? columnStartVal ue : CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 4386 columnEndValue = columnStartValue->isCustomIdentValue() ? columnStartVal ue : CSSIdentifierValue::createIdentifier(CSSValueAuto); |
4382 | 4387 |
4383 addProperty(CSSPropertyGridRowStart, CSSPropertyGridArea, *rowStartValue, im portant); | 4388 addProperty(CSSPropertyGridRowStart, CSSPropertyGridArea, *rowStartValue, im portant); |
4384 addProperty(CSSPropertyGridColumnStart, CSSPropertyGridArea, *columnStartVal ue, important); | 4389 addProperty(CSSPropertyGridColumnStart, CSSPropertyGridArea, *columnStartVal ue, important); |
4385 addProperty(CSSPropertyGridRowEnd, CSSPropertyGridArea, *rowEndValue, import ant); | 4390 addProperty(CSSPropertyGridRowEnd, CSSPropertyGridArea, *rowEndValue, import ant); |
4386 addProperty(CSSPropertyGridColumnEnd, CSSPropertyGridArea, *columnEndValue, important); | 4391 addProperty(CSSPropertyGridColumnEnd, CSSPropertyGridArea, *columnEndValue, important); |
4387 return true; | 4392 return true; |
4388 } | 4393 } |
4389 | 4394 |
4390 bool CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns(CSSPropertyID shorthandId, bool important) | 4395 bool CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns(CSSPropertyID shorthandId, bool important) |
4391 { | 4396 { |
(...skipping 14 matching lines...) Expand all Loading... | |
4406 templateRows->append(*lineNames); | 4411 templateRows->append(*lineNames); |
4407 | 4412 |
4408 // Handle a template-area's row. | 4413 // Handle a template-area's row. |
4409 if (m_range.peek().type() != StringToken || !parseGridTemplateAreasRow(m _range.consumeIncludingWhitespace().value().toString(), gridAreaMap, rowCount, c olumnCount)) | 4414 if (m_range.peek().type() != StringToken || !parseGridTemplateAreasRow(m _range.consumeIncludingWhitespace().value().toString(), gridAreaMap, rowCount, c olumnCount)) |
4410 return false; | 4415 return false; |
4411 ++rowCount; | 4416 ++rowCount; |
4412 | 4417 |
4413 // Handle template-rows's track-size. | 4418 // Handle template-rows's track-size. |
4414 CSSValue* value = consumeGridTrackSize(m_range, m_context.mode()); | 4419 CSSValue* value = consumeGridTrackSize(m_range, m_context.mode()); |
4415 if (!value) | 4420 if (!value) |
4416 value = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 4421 value = CSSIdentifierValue::createIdentifier(CSSValueAuto); |
4417 templateRows->append(*value); | 4422 templateRows->append(*value); |
4418 | 4423 |
4419 // This will handle the trailing/leading <custom-ident>* in the grammar. | 4424 // This will handle the trailing/leading <custom-ident>* in the grammar. |
4420 lineNames = consumeGridLineNames(m_range); | 4425 lineNames = consumeGridLineNames(m_range); |
4421 if (lineNames) | 4426 if (lineNames) |
4422 templateRows->append(*lineNames); | 4427 templateRows->append(*lineNames); |
4423 } while (!m_range.atEnd() && !(m_range.peek().type() == DelimiterToken && m_ range.peek().delimiter() == '/')); | 4428 } while (!m_range.atEnd() && !(m_range.peek().type() == DelimiterToken && m_ range.peek().delimiter() == '/')); |
4424 | 4429 |
4425 CSSValue* columnsValue = nullptr; | 4430 CSSValue* columnsValue = nullptr; |
4426 if (!m_range.atEnd()) { | 4431 if (!m_range.atEnd()) { |
4427 if (!consumeSlashIncludingWhitespace(m_range)) | 4432 if (!consumeSlashIncludingWhitespace(m_range)) |
4428 return false; | 4433 return false; |
4429 columnsValue = consumeGridTrackList(m_range, m_context.mode(), GridTempl ateNoRepeat); | 4434 columnsValue = consumeGridTrackList(m_range, m_context.mode(), GridTempl ateNoRepeat); |
4430 if (!columnsValue || !m_range.atEnd()) | 4435 if (!columnsValue || !m_range.atEnd()) |
4431 return false; | 4436 return false; |
4432 } else { | 4437 } else { |
4433 columnsValue = CSSPrimitiveValue::createIdentifier(CSSValueNone); | 4438 columnsValue = CSSIdentifierValue::createIdentifier(CSSValueNone); |
4434 } | 4439 } |
4435 addProperty(CSSPropertyGridTemplateRows, shorthandId, *templateRows, importa nt); | 4440 addProperty(CSSPropertyGridTemplateRows, shorthandId, *templateRows, importa nt); |
4436 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *columnsValue, impo rtant); | 4441 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *columnsValue, impo rtant); |
4437 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSGridTemplateAreas Value::create(gridAreaMap, rowCount, columnCount), important); | 4442 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSGridTemplateAreas Value::create(gridAreaMap, rowCount, columnCount), important); |
4438 return true; | 4443 return true; |
4439 } | 4444 } |
4440 | 4445 |
4441 bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId, bool important) | 4446 bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId, bool important) |
4442 { | 4447 { |
4443 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 4448 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
4444 ASSERT(gridTemplateShorthand().length() == 3); | 4449 ASSERT(gridTemplateShorthand().length() == 3); |
4445 | 4450 |
4446 CSSParserTokenRange rangeCopy = m_range; | 4451 CSSParserTokenRange rangeCopy = m_range; |
4447 CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range); | 4452 CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range); |
4448 | 4453 |
4449 // 1- 'none' case. | 4454 // 1- 'none' case. |
4450 if (rowsValue && m_range.atEnd()) { | 4455 if (rowsValue && m_range.atEnd()) { |
4451 addProperty(CSSPropertyGridTemplateRows, shorthandId, *CSSPrimitiveValue ::createIdentifier(CSSValueNone), important); | 4456 addProperty(CSSPropertyGridTemplateRows, shorthandId, *CSSIdentifierValu e::createIdentifier(CSSValueNone), important); |
4452 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *CSSPrimitiveVa lue::createIdentifier(CSSValueNone), important); | 4457 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *CSSIdentifierV alue::createIdentifier(CSSValueNone), important); |
4453 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSPrimitiveValu e::createIdentifier(CSSValueNone), important); | 4458 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSIdentifierVal ue::createIdentifier(CSSValueNone), important); |
4454 return true; | 4459 return true; |
4455 } | 4460 } |
4456 | 4461 |
4457 // 2- <grid-template-rows> / <grid-template-columns> | 4462 // 2- <grid-template-rows> / <grid-template-columns> |
4458 if (!rowsValue) | 4463 if (!rowsValue) |
4459 rowsValue = consumeGridTrackList(m_range, m_context.mode(), GridTemplate ); | 4464 rowsValue = consumeGridTrackList(m_range, m_context.mode(), GridTemplate ); |
4460 | 4465 |
4461 if (rowsValue) { | 4466 if (rowsValue) { |
4462 if (!consumeSlashIncludingWhitespace(m_range)) | 4467 if (!consumeSlashIncludingWhitespace(m_range)) |
4463 return false; | 4468 return false; |
4464 CSSValue* columnsValue = consumeGridTemplatesRowsOrColumns(m_range, m_co ntext.mode()); | 4469 CSSValue* columnsValue = consumeGridTemplatesRowsOrColumns(m_range, m_co ntext.mode()); |
4465 if (!columnsValue || !m_range.atEnd()) | 4470 if (!columnsValue || !m_range.atEnd()) |
4466 return false; | 4471 return false; |
4467 | 4472 |
4468 addProperty(CSSPropertyGridTemplateRows, shorthandId, *rowsValue, import ant); | 4473 addProperty(CSSPropertyGridTemplateRows, shorthandId, *rowsValue, import ant); |
4469 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *columnsValue, important); | 4474 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *columnsValue, important); |
4470 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSPrimitiveValu e::createIdentifier(CSSValueNone), important); | 4475 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSIdentifierVal ue::createIdentifier(CSSValueNone), important); |
4471 return true; | 4476 return true; |
4472 } | 4477 } |
4473 | 4478 |
4474 // 3- [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <track-lis t> ]? | 4479 // 3- [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <track-lis t> ]? |
4475 m_range = rangeCopy; | 4480 m_range = rangeCopy; |
4476 return consumeGridTemplateRowsAndAreasAndColumns(shorthandId, important); | 4481 return consumeGridTemplateRowsAndAreasAndColumns(shorthandId, important); |
4477 } | 4482 } |
4478 | 4483 |
4479 bool CSSPropertyParser::consumeGridShorthand(bool important) | 4484 bool CSSPropertyParser::consumeGridShorthand(bool important) |
4480 { | 4485 { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4541 | 4546 |
4542 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im portant) | 4547 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im portant) |
4543 { | 4548 { |
4544 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 4549 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
4545 | 4550 |
4546 switch (property) { | 4551 switch (property) { |
4547 case CSSPropertyWebkitMarginCollapse: { | 4552 case CSSPropertyWebkitMarginCollapse: { |
4548 CSSValueID id = m_range.consumeIncludingWhitespace().id(); | 4553 CSSValueID id = m_range.consumeIncludingWhitespace().id(); |
4549 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebki tMarginBeforeCollapse, id, m_context.mode())) | 4554 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebki tMarginBeforeCollapse, id, m_context.mode())) |
4550 return false; | 4555 return false; |
4551 CSSValue* beforeCollapse = CSSPrimitiveValue::createIdentifier(id); | 4556 CSSValue* beforeCollapse = CSSIdentifierValue::createIdentifier(id); |
4552 addProperty(CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarg inCollapse, *beforeCollapse, important); | 4557 addProperty(CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarg inCollapse, *beforeCollapse, important); |
4553 if (m_range.atEnd()) { | 4558 if (m_range.atEnd()) { |
4554 addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitM arginCollapse, *beforeCollapse, important); | 4559 addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitM arginCollapse, *beforeCollapse, important); |
4555 return true; | 4560 return true; |
4556 } | 4561 } |
4557 id = m_range.consumeIncludingWhitespace().id(); | 4562 id = m_range.consumeIncludingWhitespace().id(); |
4558 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebki tMarginAfterCollapse, id, m_context.mode())) | 4563 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebki tMarginAfterCollapse, id, m_context.mode())) |
4559 return false; | 4564 return false; |
4560 addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMargi nCollapse, *CSSPrimitiveValue::createIdentifier(id), important); | 4565 addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMargi nCollapse, *CSSIdentifierValue::createIdentifier(id), important); |
4561 return true; | 4566 return true; |
4562 } | 4567 } |
4563 case CSSPropertyOverflow: { | 4568 case CSSPropertyOverflow: { |
4564 CSSValueID id = m_range.consumeIncludingWhitespace().id(); | 4569 CSSValueID id = m_range.consumeIncludingWhitespace().id(); |
4565 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyOverf lowY, id, m_context.mode())) | 4570 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyOverf lowY, id, m_context.mode())) |
4566 return false; | 4571 return false; |
4567 if (!m_range.atEnd()) | 4572 if (!m_range.atEnd()) |
4568 return false; | 4573 return false; |
4569 CSSValue* overflowYValue = CSSPrimitiveValue::createIdentifier(id); | 4574 CSSValue* overflowYValue = CSSIdentifierValue::createIdentifier(id); |
4570 | 4575 |
4571 CSSValue* overflowXValue = nullptr; | 4576 CSSValue* overflowXValue = nullptr; |
4572 | 4577 |
4573 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I f this value has been | 4578 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I f this value has been |
4574 // set using the shorthand, then for now overflow-x will default to auto , but once we implement | 4579 // set using the shorthand, then for now overflow-x will default to auto , but once we implement |
4575 // pagination controls, it should default to hidden. If the overflow-y v alue is anything but | 4580 // pagination controls, it should default to hidden. If the overflow-y v alue is anything but |
4576 // paged-x or paged-y, then overflow-x and overflow-y should have the sa me value. | 4581 // paged-x or paged-y, then overflow-x and overflow-y should have the sa me value. |
4577 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) | 4582 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) |
4578 overflowXValue = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 4583 overflowXValue = CSSIdentifierValue::createIdentifier(CSSValueAuto); |
4579 else | 4584 else |
4580 overflowXValue = overflowYValue; | 4585 overflowXValue = overflowYValue; |
4581 addProperty(CSSPropertyOverflowX, CSSPropertyOverflow, *overflowXValue, important); | 4586 addProperty(CSSPropertyOverflowX, CSSPropertyOverflow, *overflowXValue, important); |
4582 addProperty(CSSPropertyOverflowY, CSSPropertyOverflow, *overflowYValue, important); | 4587 addProperty(CSSPropertyOverflowY, CSSPropertyOverflow, *overflowYValue, important); |
4583 return true; | 4588 return true; |
4584 } | 4589 } |
4585 case CSSPropertyFont: { | 4590 case CSSPropertyFont: { |
4586 const CSSParserToken& token = m_range.peek(); | 4591 const CSSParserToken& token = m_range.peek(); |
4587 if (token.id() >= CSSValueCaption && token.id() <= CSSValueStatusBar) | 4592 if (token.id() >= CSSValueCaption && token.id() <= CSSValueStatusBar) |
4588 return consumeSystemFont(important); | 4593 return consumeSystemFont(important); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4632 } | 4637 } |
4633 case CSSPropertyFlex: | 4638 case CSSPropertyFlex: |
4634 return consumeFlex(important); | 4639 return consumeFlex(important); |
4635 case CSSPropertyFlexFlow: | 4640 case CSSPropertyFlexFlow: |
4636 return consumeShorthandGreedily(flexFlowShorthand(), important); | 4641 return consumeShorthandGreedily(flexFlowShorthand(), important); |
4637 case CSSPropertyColumnRule: | 4642 case CSSPropertyColumnRule: |
4638 return consumeShorthandGreedily(columnRuleShorthand(), important); | 4643 return consumeShorthandGreedily(columnRuleShorthand(), important); |
4639 case CSSPropertyListStyle: | 4644 case CSSPropertyListStyle: |
4640 return consumeShorthandGreedily(listStyleShorthand(), important); | 4645 return consumeShorthandGreedily(listStyleShorthand(), important); |
4641 case CSSPropertyBorderRadius: { | 4646 case CSSPropertyBorderRadius: { |
4642 CSSPrimitiveValue* horizontalRadii[4] = { 0 }; | 4647 CSSValue* horizontalRadii[4] = { 0 }; |
4643 CSSPrimitiveValue* verticalRadii[4] = { 0 }; | 4648 CSSValue* verticalRadii[4] = { 0 }; |
4644 if (!consumeRadii(horizontalRadii, verticalRadii, m_range, m_context.mod e(), unresolvedProperty == CSSPropertyAliasWebkitBorderRadius)) | 4649 if (!consumeRadii(horizontalRadii, verticalRadii, m_range, m_context.mod e(), unresolvedProperty == CSSPropertyAliasWebkitBorderRadius)) |
4645 return false; | 4650 return false; |
4646 addProperty(CSSPropertyBorderTopLeftRadius, CSSPropertyBorderRadius, *CS SValuePair::create(horizontalRadii[0], verticalRadii[0], CSSValuePair::DropIdent icalValues), important); | 4651 addProperty(CSSPropertyBorderTopLeftRadius, CSSPropertyBorderRadius, *CS SValuePair::create(horizontalRadii[0], verticalRadii[0], CSSValuePair::DropIdent icalValues), important); |
4647 addProperty(CSSPropertyBorderTopRightRadius, CSSPropertyBorderRadius, *C SSValuePair::create(horizontalRadii[1], verticalRadii[1], CSSValuePair::DropIden ticalValues), important); | 4652 addProperty(CSSPropertyBorderTopRightRadius, CSSPropertyBorderRadius, *C SSValuePair::create(horizontalRadii[1], verticalRadii[1], CSSValuePair::DropIden ticalValues), important); |
4648 addProperty(CSSPropertyBorderBottomRightRadius, CSSPropertyBorderRadius, *CSSValuePair::create(horizontalRadii[2], verticalRadii[2], CSSValuePair::DropI denticalValues), important); | 4653 addProperty(CSSPropertyBorderBottomRightRadius, CSSPropertyBorderRadius, *CSSValuePair::create(horizontalRadii[2], verticalRadii[2], CSSValuePair::DropI denticalValues), important); |
4649 addProperty(CSSPropertyBorderBottomLeftRadius, CSSPropertyBorderRadius, *CSSValuePair::create(horizontalRadii[3], verticalRadii[3], CSSValuePair::DropId enticalValues), important); | 4654 addProperty(CSSPropertyBorderBottomLeftRadius, CSSPropertyBorderRadius, *CSSValuePair::create(horizontalRadii[3], verticalRadii[3], CSSValuePair::DropId enticalValues), important); |
4650 return true; | 4655 return true; |
4651 } | 4656 } |
4652 case CSSPropertyBorderColor: | 4657 case CSSPropertyBorderColor: |
4653 return consume4Values(borderColorShorthand(), important); | 4658 return consume4Values(borderColorShorthand(), important); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4720 case CSSPropertyGridTemplate: | 4725 case CSSPropertyGridTemplate: |
4721 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 4726 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
4722 case CSSPropertyGrid: | 4727 case CSSPropertyGrid: |
4723 return consumeGridShorthand(important); | 4728 return consumeGridShorthand(important); |
4724 default: | 4729 default: |
4725 return false; | 4730 return false; |
4726 } | 4731 } |
4727 } | 4732 } |
4728 | 4733 |
4729 } // namespace blink | 4734 } // namespace blink |
OLD | NEW |