| 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::create(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::create(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::create(static_cast<CSSValueID>(CSSValue100 + weig
ht / 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, CSSValue*& pinchZoom) | 985 static bool consumePan(CSSParserTokenRange& range, CSSValue*& panX, CSSValue*& p
anY, CSSValue*& pinchZoom) |
| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 } | 1074 } |
| 1074 | 1075 |
| 1075 static CSSValue* consumeColumnSpan(CSSParserTokenRange& range) | 1076 static CSSValue* consumeColumnSpan(CSSParserTokenRange& range) |
| 1076 { | 1077 { |
| 1077 return consumeIdent<CSSValueAll, CSSValueNone>(range); | 1078 return consumeIdent<CSSValueAll, CSSValueNone>(range); |
| 1078 } | 1079 } |
| 1079 | 1080 |
| 1080 static CSSValue* consumeZoom(CSSParserTokenRange& range, const CSSParserContext&
context) | 1081 static CSSValue* consumeZoom(CSSParserTokenRange& range, const CSSParserContext&
context) |
| 1081 { | 1082 { |
| 1082 const CSSParserToken& token = range.peek(); | 1083 const CSSParserToken& token = range.peek(); |
| 1083 CSSPrimitiveValue* zoom = nullptr; | 1084 CSSValue* zoom = nullptr; |
| 1084 if (token.type() == IdentToken) { | 1085 if (token.type() == IdentToken) { |
| 1085 zoom = consumeIdent<CSSValueNormal, CSSValueReset, CSSValueDocument>(ran
ge); | 1086 zoom = consumeIdent<CSSValueNormal, CSSValueReset, CSSValueDocument>(ran
ge); |
| 1086 } else { | 1087 } else { |
| 1087 zoom = consumePercent(range, ValueRangeNonNegative); | 1088 zoom = consumePercent(range, ValueRangeNonNegative); |
| 1088 if (!zoom) | 1089 if (!zoom) |
| 1089 zoom = consumeNumber(range, ValueRangeNonNegative); | 1090 zoom = consumeNumber(range, ValueRangeNonNegative); |
| 1090 } | 1091 } |
| 1091 if (zoom && context.useCounter()) { | 1092 if (zoom && context.useCounter()) { |
| 1092 if (!(token.id() == CSSValueNormal | 1093 if (!(token.id() == CSSValueNormal |
| 1093 || (token.type() == NumberToken && zoom->getDoubleValue() == 1) | 1094 || (token.type() == NumberToken && toCSSPrimitiveValue(zoom)->getDou
bleValue() == 1) |
| 1094 || (token.type() == PercentageToken && zoom->getDoubleValue() == 100
))) | 1095 || (token.type() == PercentageToken && toCSSPrimitiveValue(zoom)->ge
tDoubleValue() == 100))) |
| 1095 context.useCounter()->count(UseCounter::CSSZoomNotEqualToOne); | 1096 context.useCounter()->count(UseCounter::CSSZoomNotEqualToOne); |
| 1096 if (token.id() == CSSValueReset) | 1097 if (token.id() == CSSValueReset) |
| 1097 context.useCounter()->count(UseCounter::CSSZoomReset); | 1098 context.useCounter()->count(UseCounter::CSSZoomReset); |
| 1098 if (token.id() == CSSValueDocument) | 1099 if (token.id() == CSSValueDocument) |
| 1099 context.useCounter()->count(UseCounter::CSSZoomDocument); | 1100 context.useCounter()->count(UseCounter::CSSZoomDocument); |
| 1100 } | 1101 } |
| 1101 return zoom; | 1102 return zoom; |
| 1102 } | 1103 } |
| 1103 | 1104 |
| 1104 static CSSValue* consumeAnimationIterationCount(CSSParserTokenRange& range) | 1105 static CSSValue* consumeAnimationIterationCount(CSSParserTokenRange& range) |
| 1105 { | 1106 { |
| 1106 if (range.peek().id() == CSSValueInfinite) | 1107 if (range.peek().id() == CSSValueInfinite) |
| 1107 return consumeIdent(range); | 1108 return consumeIdent(range); |
| 1108 return consumeNumber(range, ValueRangeNonNegative); | 1109 return consumeNumber(range, ValueRangeNonNegative); |
| 1109 } | 1110 } |
| 1110 | 1111 |
| 1111 static CSSValue* consumeAnimationName(CSSParserTokenRange& range, const CSSParse
rContext& context, bool allowQuotedName) | 1112 static CSSValue* consumeAnimationName(CSSParserTokenRange& range, const CSSParse
rContext& context, bool allowQuotedName) |
| 1112 { | 1113 { |
| 1113 if (range.peek().id() == CSSValueNone) | 1114 if (range.peek().id() == CSSValueNone) |
| 1114 return consumeIdent(range); | 1115 return consumeIdent(range); |
| 1115 | 1116 |
| 1116 if (allowQuotedName && range.peek().type() == StringToken) { | 1117 if (allowQuotedName && range.peek().type() == StringToken) { |
| 1117 // Legacy support for strings in prefixed animations. | 1118 // Legacy support for strings in prefixed animations. |
| 1118 if (context.useCounter()) | 1119 if (context.useCounter()) |
| 1119 context.useCounter()->count(UseCounter::QuotedAnimationName); | 1120 context.useCounter()->count(UseCounter::QuotedAnimationName); |
| 1120 | 1121 |
| 1121 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 1122 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
| 1122 if (equalIgnoringASCIICase(token.value(), "none")) | 1123 if (equalIgnoringASCIICase(token.value(), "none")) |
| 1123 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1124 return CSSIdentifierValue::create(CSSValueNone); |
| 1124 return CSSCustomIdentValue::create(token.value().toAtomicString()); | 1125 return CSSCustomIdentValue::create(token.value().toAtomicString()); |
| 1125 } | 1126 } |
| 1126 | 1127 |
| 1127 return consumeCustomIdent(range); | 1128 return consumeCustomIdent(range); |
| 1128 } | 1129 } |
| 1129 | 1130 |
| 1130 static CSSValue* consumeTransitionProperty(CSSParserTokenRange& range) | 1131 static CSSValue* consumeTransitionProperty(CSSParserTokenRange& range) |
| 1131 { | 1132 { |
| 1132 const CSSParserToken& token = range.peek(); | 1133 const CSSParserToken& token = range.peek(); |
| 1133 if (token.type() != IdentToken) | 1134 if (token.type() != IdentToken) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 ASSERT_NOT_REACHED(); | 1249 ASSERT_NOT_REACHED(); |
| 1249 return nullptr; | 1250 return nullptr; |
| 1250 } | 1251 } |
| 1251 } | 1252 } |
| 1252 | 1253 |
| 1253 static bool isValidAnimationPropertyList(CSSPropertyID property, const CSSValueL
ist& valueList) | 1254 static bool isValidAnimationPropertyList(CSSPropertyID property, const CSSValueL
ist& valueList) |
| 1254 { | 1255 { |
| 1255 if (property != CSSPropertyTransitionProperty || valueList.length() < 2) | 1256 if (property != CSSPropertyTransitionProperty || valueList.length() < 2) |
| 1256 return true; | 1257 return true; |
| 1257 for (auto& value : valueList) { | 1258 for (auto& value : valueList) { |
| 1258 if (value->isPrimitiveValue() && toCSSPrimitiveValue(*value).isValueID() | 1259 if (value->isIdentifierValue() && toCSSIdentifierValue(*value).getValueI
D() == CSSValueNone) |
| 1259 && toCSSPrimitiveValue(*value).getValueID() == CSSValueNone) | |
| 1260 return false; | 1260 return false; |
| 1261 } | 1261 } |
| 1262 return true; | 1262 return true; |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 static CSSValueList* consumeAnimationPropertyList(CSSPropertyID property, CSSPar
serTokenRange& range, const CSSParserContext& context, bool useLegacyParsing) | 1265 static CSSValueList* consumeAnimationPropertyList(CSSPropertyID property, CSSPar
serTokenRange& range, const CSSParserContext& context, bool useLegacyParsing) |
| 1266 { | 1266 { |
| 1267 CSSValueList* list = CSSValueList::createCommaSeparated(); | 1267 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1268 do { | 1268 do { |
| 1269 CSSValue* value = consumeAnimationValue(property, range, context, useLeg
acyParsing); | 1269 CSSValue* value = consumeAnimationValue(property, range, context, useLeg
acyParsing); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 | 1325 |
| 1326 static CSSValue* consumeZIndex(CSSParserTokenRange& range) | 1326 static CSSValue* consumeZIndex(CSSParserTokenRange& range) |
| 1327 { | 1327 { |
| 1328 if (range.peek().id() == CSSValueAuto) | 1328 if (range.peek().id() == CSSValueAuto) |
| 1329 return consumeIdent(range); | 1329 return consumeIdent(range); |
| 1330 return consumeInteger(range); | 1330 return consumeInteger(range); |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 static CSSShadowValue* parseSingleShadow(CSSParserTokenRange& range, CSSParserMo
de cssParserMode, bool allowInset, bool allowSpread) | 1333 static CSSShadowValue* parseSingleShadow(CSSParserTokenRange& range, CSSParserMo
de cssParserMode, bool allowInset, bool allowSpread) |
| 1334 { | 1334 { |
| 1335 CSSPrimitiveValue* style = nullptr; | 1335 CSSIdentifierValue* style = nullptr; |
| 1336 CSSValue* color = nullptr; | 1336 CSSValue* color = nullptr; |
| 1337 | 1337 |
| 1338 if (range.atEnd()) | 1338 if (range.atEnd()) |
| 1339 return nullptr; | 1339 return nullptr; |
| 1340 if (range.peek().id() == CSSValueInset) { | 1340 if (range.peek().id() == CSSValueInset) { |
| 1341 if (!allowInset) | 1341 if (!allowInset) |
| 1342 return nullptr; | 1342 return nullptr; |
| 1343 style = consumeIdent(range); | 1343 style = consumeIdent(range); |
| 1344 } | 1344 } |
| 1345 color = consumeColor(range, cssParserMode); | 1345 color = consumeColor(range, cssParserMode); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 } | 1457 } |
| 1458 | 1458 |
| 1459 static CSSValue* consumeTextDecorationLine(CSSParserTokenRange& range) | 1459 static CSSValue* consumeTextDecorationLine(CSSParserTokenRange& range) |
| 1460 { | 1460 { |
| 1461 CSSValueID id = range.peek().id(); | 1461 CSSValueID id = range.peek().id(); |
| 1462 if (id == CSSValueNone) | 1462 if (id == CSSValueNone) |
| 1463 return consumeIdent(range); | 1463 return consumeIdent(range); |
| 1464 | 1464 |
| 1465 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1465 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1466 while (true) { | 1466 while (true) { |
| 1467 CSSPrimitiveValue* ident = consumeIdent<CSSValueBlink, CSSValueUnderline
, CSSValueOverline, CSSValueLineThrough>(range); | 1467 CSSIdentifierValue* ident = consumeIdent<CSSValueBlink, CSSValueUnderlin
e, CSSValueOverline, CSSValueLineThrough>(range); |
| 1468 if (!ident) | 1468 if (!ident) |
| 1469 break; | 1469 break; |
| 1470 if (list->hasValue(*ident)) | 1470 if (list->hasValue(*ident)) |
| 1471 return nullptr; | 1471 return nullptr; |
| 1472 list->append(*ident); | 1472 list->append(*ident); |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 if (!list->length()) | 1475 if (!list->length()) |
| 1476 return nullptr; | 1476 return nullptr; |
| 1477 return list; | 1477 return list; |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 // none | strict | content | [ layout || style || paint || size ] | 1480 // none | strict | content | [ layout || style || paint || size ] |
| 1481 static CSSValue* consumeContain(CSSParserTokenRange& range) | 1481 static CSSValue* consumeContain(CSSParserTokenRange& range) |
| 1482 { | 1482 { |
| 1483 CSSValueID id = range.peek().id(); | 1483 CSSValueID id = range.peek().id(); |
| 1484 if (id == CSSValueNone) | 1484 if (id == CSSValueNone) |
| 1485 return consumeIdent(range); | 1485 return consumeIdent(range); |
| 1486 | 1486 |
| 1487 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1487 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1488 if (id == CSSValueStrict || id == CSSValueContent) { | 1488 if (id == CSSValueStrict || id == CSSValueContent) { |
| 1489 list->append(*consumeIdent(range)); | 1489 list->append(*consumeIdent(range)); |
| 1490 return list; | 1490 return list; |
| 1491 } | 1491 } |
| 1492 while (true) { | 1492 while (true) { |
| 1493 CSSPrimitiveValue* ident = consumeIdent<CSSValuePaint, CSSValueLayout, C
SSValueStyle, CSSValueSize>(range); | 1493 CSSIdentifierValue* ident = consumeIdent<CSSValuePaint, CSSValueLayout,
CSSValueStyle, CSSValueSize>(range); |
| 1494 if (!ident) | 1494 if (!ident) |
| 1495 break; | 1495 break; |
| 1496 if (list->hasValue(*ident)) | 1496 if (list->hasValue(*ident)) |
| 1497 return nullptr; | 1497 return nullptr; |
| 1498 list->append(*ident); | 1498 list->append(*ident); |
| 1499 } | 1499 } |
| 1500 | 1500 |
| 1501 if (!list->length()) | 1501 if (!list->length()) |
| 1502 return nullptr; | 1502 return nullptr; |
| 1503 return list; | 1503 return list; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1516 return nullptr; | 1516 return nullptr; |
| 1517 String pathString = functionArgs.consumeIncludingWhitespace().value().toStri
ng(); | 1517 String pathString = functionArgs.consumeIncludingWhitespace().value().toStri
ng(); |
| 1518 | 1518 |
| 1519 std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); | 1519 std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); |
| 1520 if (buildByteStreamFromString(pathString, *byteStream) != SVGParseStatus::No
Error | 1520 if (buildByteStreamFromString(pathString, *byteStream) != SVGParseStatus::No
Error |
| 1521 || !functionArgs.atEnd()) | 1521 || !functionArgs.atEnd()) |
| 1522 return nullptr; | 1522 return nullptr; |
| 1523 | 1523 |
| 1524 range = functionRange; | 1524 range = functionRange; |
| 1525 if (byteStream->isEmpty()) | 1525 if (byteStream->isEmpty()) |
| 1526 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1526 return CSSIdentifierValue::create(CSSValueNone); |
| 1527 return CSSPathValue::create(std::move(byteStream)); | 1527 return CSSPathValue::create(std::move(byteStream)); |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 static CSSValue* consumePathOrNone(CSSParserTokenRange& range) | 1530 static CSSValue* consumePathOrNone(CSSParserTokenRange& range) |
| 1531 { | 1531 { |
| 1532 CSSValueID id = range.peek().id(); | 1532 CSSValueID id = range.peek().id(); |
| 1533 if (id == CSSValueNone) | 1533 if (id == CSSValueNone) |
| 1534 return consumeIdent(range); | 1534 return consumeIdent(range); |
| 1535 | 1535 |
| 1536 return consumePath(range); | 1536 return consumePath(range); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1564 | 1564 |
| 1565 static CSSValue* consumeTextEmphasisStyle(CSSParserTokenRange& range) | 1565 static CSSValue* consumeTextEmphasisStyle(CSSParserTokenRange& range) |
| 1566 { | 1566 { |
| 1567 CSSValueID id = range.peek().id(); | 1567 CSSValueID id = range.peek().id(); |
| 1568 if (id == CSSValueNone) | 1568 if (id == CSSValueNone) |
| 1569 return consumeIdent(range); | 1569 return consumeIdent(range); |
| 1570 | 1570 |
| 1571 if (CSSValue* textEmphasisStyle = consumeString(range)) | 1571 if (CSSValue* textEmphasisStyle = consumeString(range)) |
| 1572 return textEmphasisStyle; | 1572 return textEmphasisStyle; |
| 1573 | 1573 |
| 1574 CSSPrimitiveValue* fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range); | 1574 CSSIdentifierValue* fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range)
; |
| 1575 CSSPrimitiveValue* shape = consumeIdent<CSSValueDot, CSSValueCircle, CSSValu
eDoubleCircle, CSSValueTriangle, CSSValueSesame>(range); | 1575 CSSIdentifierValue* shape = consumeIdent<CSSValueDot, CSSValueCircle, CSSVal
ueDoubleCircle, CSSValueTriangle, CSSValueSesame>(range); |
| 1576 if (!fill) | 1576 if (!fill) |
| 1577 fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range); | 1577 fill = consumeIdent<CSSValueFilled, CSSValueOpen>(range); |
| 1578 if (fill && shape) { | 1578 if (fill && shape) { |
| 1579 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); | 1579 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); |
| 1580 parsedValues->append(*fill); | 1580 parsedValues->append(*fill); |
| 1581 parsedValues->append(*shape); | 1581 parsedValues->append(*shape); |
| 1582 return parsedValues; | 1582 return parsedValues; |
| 1583 } | 1583 } |
| 1584 if (fill) | 1584 if (fill) |
| 1585 return fill; | 1585 return fill; |
| 1586 if (shape) | 1586 if (shape) |
| 1587 return shape; | 1587 return shape; |
| 1588 return nullptr; | 1588 return nullptr; |
| 1589 } | 1589 } |
| 1590 | 1590 |
| 1591 static CSSValue* consumeOutlineColor(CSSParserTokenRange& range, CSSParserMode c
ssParserMode) | 1591 static CSSValue* consumeOutlineColor(CSSParserTokenRange& range, CSSParserMode c
ssParserMode) |
| 1592 { | 1592 { |
| 1593 // Allow the special focus color even in HTML Standard parsing mode. | 1593 // Allow the special focus color even in HTML Standard parsing mode. |
| 1594 if (range.peek().id() == CSSValueWebkitFocusRingColor) | 1594 if (range.peek().id() == CSSValueWebkitFocusRingColor) |
| 1595 return consumeIdent(range); | 1595 return consumeIdent(range); |
| 1596 return consumeColor(range, cssParserMode); | 1596 return consumeColor(range, cssParserMode); |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 static CSSPrimitiveValue* consumeLineWidth(CSSParserTokenRange& range, CSSParser
Mode cssParserMode, UnitlessQuirk unitless) | 1599 static CSSValue* consumeLineWidth(CSSParserTokenRange& range, CSSParserMode cssP
arserMode, UnitlessQuirk unitless) |
| 1600 { | 1600 { |
| 1601 CSSValueID id = range.peek().id(); | 1601 CSSValueID id = range.peek().id(); |
| 1602 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) | 1602 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) |
| 1603 return consumeIdent(range); | 1603 return consumeIdent(range); |
| 1604 return consumeLength(range, cssParserMode, ValueRangeNonNegative, unitless); | 1604 return consumeLength(range, cssParserMode, ValueRangeNonNegative, unitless); |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 static CSSPrimitiveValue* consumeBorderWidth(CSSParserTokenRange& range, CSSPars
erMode cssParserMode, UnitlessQuirk unitless) | 1607 static CSSValue* consumeBorderWidth(CSSParserTokenRange& range, CSSParserMode cs
sParserMode, UnitlessQuirk unitless) |
| 1608 { | 1608 { |
| 1609 return consumeLineWidth(range, cssParserMode, unitless); | 1609 return consumeLineWidth(range, cssParserMode, unitless); |
| 1610 } | 1610 } |
| 1611 | 1611 |
| 1612 static CSSPrimitiveValue* consumeTextStrokeWidth(CSSParserTokenRange& range, CSS
ParserMode cssParserMode) | 1612 static CSSValue* consumeTextStrokeWidth(CSSParserTokenRange& range, CSSParserMod
e cssParserMode) |
| 1613 { | 1613 { |
| 1614 return consumeLineWidth(range, cssParserMode, UnitlessQuirk::Forbid); | 1614 return consumeLineWidth(range, cssParserMode, UnitlessQuirk::Forbid); |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 static CSSPrimitiveValue* consumeColumnRuleWidth(CSSParserTokenRange& range, CSS
ParserMode cssParserMode) | 1617 static CSSValue* consumeColumnRuleWidth(CSSParserTokenRange& range, CSSParserMod
e cssParserMode) |
| 1618 { | 1618 { |
| 1619 return consumeLineWidth(range, cssParserMode, UnitlessQuirk::Forbid); | 1619 return consumeLineWidth(range, cssParserMode, UnitlessQuirk::Forbid); |
| 1620 } | 1620 } |
| 1621 | 1621 |
| 1622 static bool consumeTranslate3d(CSSParserTokenRange& args, CSSParserMode cssParse
rMode, CSSFunctionValue*& transformValue) | 1622 static bool consumeTranslate3d(CSSParserTokenRange& args, CSSParserMode cssParse
rMode, CSSFunctionValue*& transformValue) |
| 1623 { | 1623 { |
| 1624 unsigned numberOfArguments = 2; | 1624 unsigned numberOfArguments = 2; |
| 1625 CSSValue* parsedValue = nullptr; | 1625 CSSValue* parsedValue = nullptr; |
| 1626 do { | 1626 do { |
| 1627 parsedValue = consumeLengthOrPercent(args, cssParserMode, ValueRangeAll)
; | 1627 parsedValue = consumeLengthOrPercent(args, cssParserMode, ValueRangeAll)
; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 } | 1825 } |
| 1826 return consumeColor(range, cssParserMode); | 1826 return consumeColor(range, cssParserMode); |
| 1827 } | 1827 } |
| 1828 | 1828 |
| 1829 static CSSValue* consumePaintOrder(CSSParserTokenRange& range) | 1829 static CSSValue* consumePaintOrder(CSSParserTokenRange& range) |
| 1830 { | 1830 { |
| 1831 if (range.peek().id() == CSSValueNormal) | 1831 if (range.peek().id() == CSSValueNormal) |
| 1832 return consumeIdent(range); | 1832 return consumeIdent(range); |
| 1833 | 1833 |
| 1834 Vector<CSSValueID, 3> paintTypeList; | 1834 Vector<CSSValueID, 3> paintTypeList; |
| 1835 CSSPrimitiveValue* fill = nullptr; | 1835 CSSIdentifierValue* fill = nullptr; |
| 1836 CSSPrimitiveValue* stroke = nullptr; | 1836 CSSIdentifierValue* stroke = nullptr; |
| 1837 CSSPrimitiveValue* markers = nullptr; | 1837 CSSIdentifierValue* markers = nullptr; |
| 1838 do { | 1838 do { |
| 1839 CSSValueID id = range.peek().id(); | 1839 CSSValueID id = range.peek().id(); |
| 1840 if (id == CSSValueFill && !fill) | 1840 if (id == CSSValueFill && !fill) |
| 1841 fill = consumeIdent(range); | 1841 fill = consumeIdent(range); |
| 1842 else if (id == CSSValueStroke && !stroke) | 1842 else if (id == CSSValueStroke && !stroke) |
| 1843 stroke = consumeIdent(range); | 1843 stroke = consumeIdent(range); |
| 1844 else if (id == CSSValueMarkers && !markers) | 1844 else if (id == CSSValueMarkers && !markers) |
| 1845 markers = consumeIdent(range); | 1845 markers = consumeIdent(range); |
| 1846 else | 1846 else |
| 1847 return nullptr; | 1847 return nullptr; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 CSSValueList* dashes = CSSValueList::createCommaSeparated(); | 1900 CSSValueList* dashes = CSSValueList::createCommaSeparated(); |
| 1901 do { | 1901 do { |
| 1902 CSSPrimitiveValue* dash = consumeLengthOrPercent(range, SVGAttributeMode
, ValueRangeNonNegative); | 1902 CSSPrimitiveValue* dash = consumeLengthOrPercent(range, SVGAttributeMode
, ValueRangeNonNegative); |
| 1903 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd())) | 1903 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd())) |
| 1904 return nullptr; | 1904 return nullptr; |
| 1905 dashes->append(*dash); | 1905 dashes->append(*dash); |
| 1906 } while (!range.atEnd()); | 1906 } while (!range.atEnd()); |
| 1907 return dashes; | 1907 return dashes; |
| 1908 } | 1908 } |
| 1909 | 1909 |
| 1910 static CSSPrimitiveValue* consumeBaselineShift(CSSParserTokenRange& range) | 1910 static CSSValue* consumeBaselineShift(CSSParserTokenRange& range) |
| 1911 { | 1911 { |
| 1912 CSSValueID id = range.peek().id(); | 1912 CSSValueID id = range.peek().id(); |
| 1913 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) | 1913 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) |
| 1914 return consumeIdent(range); | 1914 return consumeIdent(range); |
| 1915 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll); | 1915 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll); |
| 1916 } | 1916 } |
| 1917 | 1917 |
| 1918 static CSSPrimitiveValue* consumeRxOrRy(CSSParserTokenRange& range) | 1918 static CSSValue* consumeRxOrRy(CSSParserTokenRange& range) |
| 1919 { | 1919 { |
| 1920 if (range.peek().id() == CSSValueAuto) | 1920 if (range.peek().id() == CSSValueAuto) |
| 1921 return consumeIdent(range); | 1921 return consumeIdent(range); |
| 1922 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll, Unitle
ssQuirk::Forbid); | 1922 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll, Unitle
ssQuirk::Forbid); |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 static CSSValue* consumeCursor(CSSParserTokenRange& range, const CSSParserContex
t& context, bool inQuirksMode) | 1925 static CSSValue* consumeCursor(CSSParserTokenRange& range, const CSSParserContex
t& context, bool inQuirksMode) |
| 1926 { | 1926 { |
| 1927 CSSValueList* list = nullptr; | 1927 CSSValueList* list = nullptr; |
| 1928 while (CSSValue* image = consumeImage(range, context, ConsumeGeneratedImage:
:Forbid)) { | 1928 while (CSSValue* image = consumeImage(range, context, ConsumeGeneratedImage:
:Forbid)) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1949 if (!range.atEnd() && context.useCounter()) { | 1949 if (!range.atEnd() && context.useCounter()) { |
| 1950 if (id == CSSValueWebkitZoomIn) | 1950 if (id == CSSValueWebkitZoomIn) |
| 1951 context.useCounter()->count(UseCounter::PrefixedCursorZoomIn); | 1951 context.useCounter()->count(UseCounter::PrefixedCursorZoomIn); |
| 1952 else if (id == CSSValueWebkitZoomOut) | 1952 else if (id == CSSValueWebkitZoomOut) |
| 1953 context.useCounter()->count(UseCounter::PrefixedCursorZoomOut); | 1953 context.useCounter()->count(UseCounter::PrefixedCursorZoomOut); |
| 1954 } | 1954 } |
| 1955 CSSValue* cursorType = nullptr; | 1955 CSSValue* cursorType = nullptr; |
| 1956 if (id == CSSValueHand) { | 1956 if (id == CSSValueHand) { |
| 1957 if (!inQuirksMode) // Non-standard behavior | 1957 if (!inQuirksMode) // Non-standard behavior |
| 1958 return nullptr; | 1958 return nullptr; |
| 1959 cursorType = CSSPrimitiveValue::createIdentifier(CSSValuePointer); | 1959 cursorType = CSSIdentifierValue::create(CSSValuePointer); |
| 1960 range.consumeIncludingWhitespace(); | 1960 range.consumeIncludingWhitespace(); |
| 1961 } else if ((id >= CSSValueAuto && id <= CSSValueWebkitZoomOut) || id == CSSV
alueCopy || id == CSSValueNone) { | 1961 } else if ((id >= CSSValueAuto && id <= CSSValueWebkitZoomOut) || id == CSSV
alueCopy || id == CSSValueNone) { |
| 1962 cursorType = consumeIdent(range); | 1962 cursorType = consumeIdent(range); |
| 1963 } else { | 1963 } else { |
| 1964 return nullptr; | 1964 return nullptr; |
| 1965 } | 1965 } |
| 1966 | 1966 |
| 1967 if (!list) | 1967 if (!list) |
| 1968 return cursorType; | 1968 return cursorType; |
| 1969 list->append(*cursorType); | 1969 list->append(*cursorType); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1996 | 1996 |
| 1997 CSSStringValue* separator = nullptr; | 1997 CSSStringValue* separator = nullptr; |
| 1998 if (!counters) { | 1998 if (!counters) { |
| 1999 separator = CSSStringValue::create(String()); | 1999 separator = CSSStringValue::create(String()); |
| 2000 } else { | 2000 } else { |
| 2001 if (!consumeCommaIncludingWhitespace(args) || args.peek().type() != Stri
ngToken) | 2001 if (!consumeCommaIncludingWhitespace(args) || args.peek().type() != Stri
ngToken) |
| 2002 return nullptr; | 2002 return nullptr; |
| 2003 separator = CSSStringValue::create(args.consumeIncludingWhitespace().val
ue().toString()); | 2003 separator = CSSStringValue::create(args.consumeIncludingWhitespace().val
ue().toString()); |
| 2004 } | 2004 } |
| 2005 | 2005 |
| 2006 CSSPrimitiveValue* listStyle = nullptr; | 2006 CSSIdentifierValue* listStyle = nullptr; |
| 2007 if (consumeCommaIncludingWhitespace(args)) { | 2007 if (consumeCommaIncludingWhitespace(args)) { |
| 2008 CSSValueID id = args.peek().id(); | 2008 CSSValueID id = args.peek().id(); |
| 2009 if ((id != CSSValueNone && (id < CSSValueDisc || id > CSSValueKatakanaIr
oha))) | 2009 if ((id != CSSValueNone && (id < CSSValueDisc || id > CSSValueKatakanaIr
oha))) |
| 2010 return nullptr; | 2010 return nullptr; |
| 2011 listStyle = consumeIdent(args); | 2011 listStyle = consumeIdent(args); |
| 2012 } else { | 2012 } else { |
| 2013 listStyle = CSSPrimitiveValue::createIdentifier(CSSValueDecimal); | 2013 listStyle = CSSIdentifierValue::create(CSSValueDecimal); |
| 2014 } | 2014 } |
| 2015 | 2015 |
| 2016 if (!args.atEnd()) | 2016 if (!args.atEnd()) |
| 2017 return nullptr; | 2017 return nullptr; |
| 2018 return CSSCounterValue::create(identifier, listStyle, separator); | 2018 return CSSCounterValue::create(identifier, listStyle, separator); |
| 2019 } | 2019 } |
| 2020 | 2020 |
| 2021 static CSSValue* consumeContent(CSSParserTokenRange& range, CSSParserContext con
text) | 2021 static CSSValue* consumeContent(CSSParserTokenRange& range, CSSParserContext con
text) |
| 2022 { | 2022 { |
| 2023 if (identMatches<CSSValueNone, CSSValueNormal>(range.peek().id())) | 2023 if (identMatches<CSSValueNone, CSSValueNormal>(range.peek().id())) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2040 parsedValue = consumeCounterContent(consumeFunction(range), true
); | 2040 parsedValue = consumeCounterContent(consumeFunction(range), true
); |
| 2041 if (!parsedValue) | 2041 if (!parsedValue) |
| 2042 return nullptr; | 2042 return nullptr; |
| 2043 } | 2043 } |
| 2044 values->append(*parsedValue); | 2044 values->append(*parsedValue); |
| 2045 } while (!range.atEnd()); | 2045 } while (!range.atEnd()); |
| 2046 | 2046 |
| 2047 return values; | 2047 return values; |
| 2048 } | 2048 } |
| 2049 | 2049 |
| 2050 static CSSPrimitiveValue* consumePerspective(CSSParserTokenRange& range, CSSPars
erMode cssParserMode, CSSPropertyID unresolvedProperty) | 2050 static CSSValue* consumePerspective(CSSParserTokenRange& range, CSSParserMode cs
sParserMode, CSSPropertyID unresolvedProperty) |
| 2051 { | 2051 { |
| 2052 if (range.peek().id() == CSSValueNone) | 2052 if (range.peek().id() == CSSValueNone) |
| 2053 return consumeIdent(range); | 2053 return consumeIdent(range); |
| 2054 CSSPrimitiveValue* parsedValue = consumeLength(range, cssParserMode, ValueRa
ngeAll); | 2054 CSSPrimitiveValue* parsedValue = consumeLength(range, cssParserMode, ValueRa
ngeAll); |
| 2055 if (!parsedValue && (unresolvedProperty == CSSPropertyAliasWebkitPerspective
)) { | 2055 if (!parsedValue && (unresolvedProperty == CSSPropertyAliasWebkitPerspective
)) { |
| 2056 double perspective; | 2056 double perspective; |
| 2057 if (!consumeNumberRaw(range, perspective)) | 2057 if (!consumeNumberRaw(range, perspective)) |
| 2058 return nullptr; | 2058 return nullptr; |
| 2059 parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue::
UnitType::Pixels); | 2059 parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue::
UnitType::Pixels); |
| 2060 } | 2060 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2102 { | 2102 { |
| 2103 CSSValue* parsedValue1 = consumeLengthOrPercent(range, cssParserMode, ValueR
angeNonNegative); | 2103 CSSValue* parsedValue1 = consumeLengthOrPercent(range, cssParserMode, ValueR
angeNonNegative); |
| 2104 if (!parsedValue1) | 2104 if (!parsedValue1) |
| 2105 return nullptr; | 2105 return nullptr; |
| 2106 CSSValue* parsedValue2 = consumeLengthOrPercent(range, cssParserMode, ValueR
angeNonNegative); | 2106 CSSValue* parsedValue2 = consumeLengthOrPercent(range, cssParserMode, ValueR
angeNonNegative); |
| 2107 if (!parsedValue2) | 2107 if (!parsedValue2) |
| 2108 parsedValue2 = parsedValue1; | 2108 parsedValue2 = parsedValue1; |
| 2109 return CSSValuePair::create(parsedValue1, parsedValue2, CSSValuePair::DropId
enticalValues); | 2109 return CSSValuePair::create(parsedValue1, parsedValue2, CSSValuePair::DropId
enticalValues); |
| 2110 } | 2110 } |
| 2111 | 2111 |
| 2112 static CSSPrimitiveValue* consumeVerticalAlign(CSSParserTokenRange& range, CSSPa
rserMode cssParserMode) | 2112 static CSSValue* consumeVerticalAlign(CSSParserTokenRange& range, CSSParserMode
cssParserMode) |
| 2113 { | 2113 { |
| 2114 CSSPrimitiveValue* parsedValue = consumeIdentRange(range, CSSValueBaseline,
CSSValueWebkitBaselineMiddle); | 2114 CSSValue* parsedValue = consumeIdentRange(range, CSSValueBaseline, CSSValueW
ebkitBaselineMiddle); |
| 2115 if (!parsedValue) | 2115 if (!parsedValue) |
| 2116 parsedValue = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll
, UnitlessQuirk::Allow); | 2116 parsedValue = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll
, UnitlessQuirk::Allow); |
| 2117 return parsedValue; | 2117 return parsedValue; |
| 2118 } | 2118 } |
| 2119 | 2119 |
| 2120 static CSSPrimitiveValue* consumeShapeRadius(CSSParserTokenRange& args, CSSParse
rMode cssParserMode) | 2120 static CSSValue* consumeShapeRadius(CSSParserTokenRange& args, CSSParserMode css
ParserMode) |
| 2121 { | 2121 { |
| 2122 if (identMatches<CSSValueClosestSide, CSSValueFarthestSide>(args.peek().id()
)) | 2122 if (identMatches<CSSValueClosestSide, CSSValueFarthestSide>(args.peek().id()
)) |
| 2123 return consumeIdent(args); | 2123 return consumeIdent(args); |
| 2124 return consumeLengthOrPercent(args, cssParserMode, ValueRangeNonNegative); | 2124 return consumeLengthOrPercent(args, cssParserMode, ValueRangeNonNegative); |
| 2125 } | 2125 } |
| 2126 | 2126 |
| 2127 static CSSBasicShapeCircleValue* consumeBasicShapeCircle(CSSParserTokenRange& ar
gs, const CSSParserContext& context) | 2127 static CSSBasicShapeCircleValue* consumeBasicShapeCircle(CSSParserTokenRange& ar
gs, const CSSParserContext& context) |
| 2128 { | 2128 { |
| 2129 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes | 2129 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes |
| 2130 // circle( [<shape-radius>]? [at <position>]? ) | 2130 // circle( [<shape-radius>]? [at <position>]? ) |
| 2131 CSSBasicShapeCircleValue* shape = CSSBasicShapeCircleValue::create(); | 2131 CSSBasicShapeCircleValue* shape = CSSBasicShapeCircleValue::create(); |
| 2132 if (CSSPrimitiveValue* radius = consumeShapeRadius(args, context.mode())) | 2132 if (CSSValue* radius = consumeShapeRadius(args, context.mode())) |
| 2133 shape->setRadius(radius); | 2133 shape->setRadius(radius); |
| 2134 if (consumeIdent<CSSValueAt>(args)) { | 2134 if (consumeIdent<CSSValueAt>(args)) { |
| 2135 CSSValue* centerX = nullptr; | 2135 CSSValue* centerX = nullptr; |
| 2136 CSSValue* centerY = nullptr; | 2136 CSSValue* centerY = nullptr; |
| 2137 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center
X, centerY)) | 2137 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center
X, centerY)) |
| 2138 return nullptr; | 2138 return nullptr; |
| 2139 shape->setCenterX(centerX); | 2139 shape->setCenterX(centerX); |
| 2140 shape->setCenterY(centerY); | 2140 shape->setCenterY(centerY); |
| 2141 } | 2141 } |
| 2142 return shape; | 2142 return shape; |
| 2143 } | 2143 } |
| 2144 | 2144 |
| 2145 static CSSBasicShapeEllipseValue* consumeBasicShapeEllipse(CSSParserTokenRange&
args, const CSSParserContext& context) | 2145 static CSSBasicShapeEllipseValue* consumeBasicShapeEllipse(CSSParserTokenRange&
args, const CSSParserContext& context) |
| 2146 { | 2146 { |
| 2147 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes | 2147 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes |
| 2148 // ellipse( [<shape-radius>{2}]? [at <position>]? ) | 2148 // ellipse( [<shape-radius>{2}]? [at <position>]? ) |
| 2149 CSSBasicShapeEllipseValue* shape = CSSBasicShapeEllipseValue::create(); | 2149 CSSBasicShapeEllipseValue* shape = CSSBasicShapeEllipseValue::create(); |
| 2150 if (CSSPrimitiveValue* radiusX = consumeShapeRadius(args, context.mode())) { | 2150 if (CSSValue* radiusX = consumeShapeRadius(args, context.mode())) { |
| 2151 shape->setRadiusX(radiusX); | 2151 shape->setRadiusX(radiusX); |
| 2152 if (CSSPrimitiveValue* radiusY = consumeShapeRadius(args, context.mode()
)) | 2152 if (CSSValue* radiusY = consumeShapeRadius(args, context.mode())) |
| 2153 shape->setRadiusY(radiusY); | 2153 shape->setRadiusY(radiusY); |
| 2154 } | 2154 } |
| 2155 if (consumeIdent<CSSValueAt>(args)) { | 2155 if (consumeIdent<CSSValueAt>(args)) { |
| 2156 CSSValue* centerX = nullptr; | 2156 CSSValue* centerX = nullptr; |
| 2157 CSSValue* centerY = nullptr; | 2157 CSSValue* centerY = nullptr; |
| 2158 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center
X, centerY)) | 2158 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center
X, centerY)) |
| 2159 return nullptr; | 2159 return nullptr; |
| 2160 shape->setCenterX(centerX); | 2160 shape->setCenterX(centerX); |
| 2161 shape->setCenterY(centerY); | 2161 shape->setCenterY(centerY); |
| 2162 } | 2162 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2177 if (!xLength) | 2177 if (!xLength) |
| 2178 return nullptr; | 2178 return nullptr; |
| 2179 CSSPrimitiveValue* yLength = consumeLengthOrPercent(args, context.mode()
, ValueRangeAll); | 2179 CSSPrimitiveValue* yLength = consumeLengthOrPercent(args, context.mode()
, ValueRangeAll); |
| 2180 if (!yLength) | 2180 if (!yLength) |
| 2181 return nullptr; | 2181 return nullptr; |
| 2182 shape->appendPoint(xLength, yLength); | 2182 shape->appendPoint(xLength, yLength); |
| 2183 } while (consumeCommaIncludingWhitespace(args)); | 2183 } while (consumeCommaIncludingWhitespace(args)); |
| 2184 return shape; | 2184 return shape; |
| 2185 } | 2185 } |
| 2186 | 2186 |
| 2187 static void complete4Sides(CSSPrimitiveValue* side[4]) | 2187 static void complete4Sides(CSSValue* side[4]) |
| 2188 { | 2188 { |
| 2189 if (side[3]) | 2189 if (side[3]) |
| 2190 return; | 2190 return; |
| 2191 if (!side[2]) { | 2191 if (!side[2]) { |
| 2192 if (!side[1]) | 2192 if (!side[1]) |
| 2193 side[1] = side[0]; | 2193 side[1] = side[0]; |
| 2194 side[2] = side[0]; | 2194 side[2] = side[0]; |
| 2195 } | 2195 } |
| 2196 side[3] = side[1]; | 2196 side[3] = side[1]; |
| 2197 } | 2197 } |
| 2198 | 2198 |
| 2199 static bool consumeRadii(CSSPrimitiveValue* horizontalRadii[4], CSSPrimitiveValu
e* verticalRadii[4], CSSParserTokenRange& range, CSSParserMode cssParserMode, bo
ol useLegacyParsing) | 2199 static bool consumeRadii(CSSValue* horizontalRadii[4], CSSValue* verticalRadii[4
], CSSParserTokenRange& range, CSSParserMode cssParserMode, bool useLegacyParsin
g) |
| 2200 { | 2200 { |
| 2201 unsigned i = 0; | 2201 unsigned i = 0; |
| 2202 for (; i < 4 && !range.atEnd() && range.peek().type() != DelimiterToken; ++i
) { | 2202 for (; i < 4 && !range.atEnd() && range.peek().type() != DelimiterToken; ++i
) { |
| 2203 horizontalRadii[i] = consumeLengthOrPercent(range, cssParserMode, ValueR
angeNonNegative); | 2203 horizontalRadii[i] = consumeLengthOrPercent(range, cssParserMode, ValueR
angeNonNegative); |
| 2204 if (!horizontalRadii[i]) | 2204 if (!horizontalRadii[i]) |
| 2205 return false; | 2205 return false; |
| 2206 } | 2206 } |
| 2207 if (!horizontalRadii[0]) | 2207 if (!horizontalRadii[0]) |
| 2208 return false; | 2208 return false; |
| 2209 if (range.atEnd()) { | 2209 if (range.atEnd()) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 if (left) | 2250 if (left) |
| 2251 shape->updateShapeSize4Values(top, right, bottom, left); | 2251 shape->updateShapeSize4Values(top, right, bottom, left); |
| 2252 else if (bottom) | 2252 else if (bottom) |
| 2253 shape->updateShapeSize3Values(top, right, bottom); | 2253 shape->updateShapeSize3Values(top, right, bottom); |
| 2254 else if (right) | 2254 else if (right) |
| 2255 shape->updateShapeSize2Values(top, right); | 2255 shape->updateShapeSize2Values(top, right); |
| 2256 else | 2256 else |
| 2257 shape->updateShapeSize1Value(top); | 2257 shape->updateShapeSize1Value(top); |
| 2258 | 2258 |
| 2259 if (consumeIdent<CSSValueRound>(args)) { | 2259 if (consumeIdent<CSSValueRound>(args)) { |
| 2260 CSSPrimitiveValue* horizontalRadii[4] = { 0 }; | 2260 CSSValue* horizontalRadii[4] = { 0 }; |
| 2261 CSSPrimitiveValue* verticalRadii[4] = { 0 }; | 2261 CSSValue* verticalRadii[4] = { 0 }; |
| 2262 if (!consumeRadii(horizontalRadii, verticalRadii, args, context.mode(),
false)) | 2262 if (!consumeRadii(horizontalRadii, verticalRadii, args, context.mode(),
false)) |
| 2263 return nullptr; | 2263 return nullptr; |
| 2264 shape->setTopLeftRadius(CSSValuePair::create(horizontalRadii[0], vertica
lRadii[0], CSSValuePair::DropIdenticalValues)); | 2264 shape->setTopLeftRadius(CSSValuePair::create(horizontalRadii[0], vertica
lRadii[0], CSSValuePair::DropIdenticalValues)); |
| 2265 shape->setTopRightRadius(CSSValuePair::create(horizontalRadii[1], vertic
alRadii[1], CSSValuePair::DropIdenticalValues)); | 2265 shape->setTopRightRadius(CSSValuePair::create(horizontalRadii[1], vertic
alRadii[1], CSSValuePair::DropIdenticalValues)); |
| 2266 shape->setBottomRightRadius(CSSValuePair::create(horizontalRadii[2], ver
ticalRadii[2], CSSValuePair::DropIdenticalValues)); | 2266 shape->setBottomRightRadius(CSSValuePair::create(horizontalRadii[2], ver
ticalRadii[2], CSSValuePair::DropIdenticalValues)); |
| 2267 shape->setBottomLeftRadius(CSSValuePair::create(horizontalRadii[3], vert
icalRadii[3], CSSValuePair::DropIdenticalValues)); | 2267 shape->setBottomLeftRadius(CSSValuePair::create(horizontalRadii[3], vert
icalRadii[3], CSSValuePair::DropIdenticalValues)); |
| 2268 } | 2268 } |
| 2269 return shape; | 2269 return shape; |
| 2270 } | 2270 } |
| 2271 | 2271 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2351 if (position == CSSValueInvalid && distribution == CSSValueInvalid) | 2351 if (position == CSSValueInvalid && distribution == CSSValueInvalid) |
| 2352 return nullptr; | 2352 return nullptr; |
| 2353 | 2353 |
| 2354 // The grammar states that <overflow-position> must be associated to <conten
t-position>. | 2354 // The grammar states that <overflow-position> must be associated to <conten
t-position>. |
| 2355 if (overflow != CSSValueInvalid && position == CSSValueInvalid) | 2355 if (overflow != CSSValueInvalid && position == CSSValueInvalid) |
| 2356 return nullptr; | 2356 return nullptr; |
| 2357 | 2357 |
| 2358 return CSSContentDistributionValue::create(distribution, position, overflow)
; | 2358 return CSSContentDistributionValue::create(distribution, position, overflow)
; |
| 2359 } | 2359 } |
| 2360 | 2360 |
| 2361 static CSSPrimitiveValue* consumeBorderImageRepeatKeyword(CSSParserTokenRange& r
ange) | 2361 static CSSIdentifierValue* consumeBorderImageRepeatKeyword(CSSParserTokenRange&
range) |
| 2362 { | 2362 { |
| 2363 return consumeIdent<CSSValueStretch, CSSValueRepeat, CSSValueSpace, CSSValue
Round>(range); | 2363 return consumeIdent<CSSValueStretch, CSSValueRepeat, CSSValueSpace, CSSValue
Round>(range); |
| 2364 } | 2364 } |
| 2365 | 2365 |
| 2366 static CSSValue* consumeBorderImageRepeat(CSSParserTokenRange& range) | 2366 static CSSValue* consumeBorderImageRepeat(CSSParserTokenRange& range) |
| 2367 { | 2367 { |
| 2368 CSSPrimitiveValue* horizontal = consumeBorderImageRepeatKeyword(range); | 2368 CSSIdentifierValue* horizontal = consumeBorderImageRepeatKeyword(range); |
| 2369 if (!horizontal) | 2369 if (!horizontal) |
| 2370 return nullptr; | 2370 return nullptr; |
| 2371 CSSPrimitiveValue* vertical = consumeBorderImageRepeatKeyword(range); | 2371 CSSIdentifierValue* vertical = consumeBorderImageRepeatKeyword(range); |
| 2372 if (!vertical) | 2372 if (!vertical) |
| 2373 vertical = horizontal; | 2373 vertical = horizontal; |
| 2374 return CSSValuePair::create(horizontal, vertical, CSSValuePair::DropIdentica
lValues); | 2374 return CSSValuePair::create(horizontal, vertical, CSSValuePair::DropIdentica
lValues); |
| 2375 } | 2375 } |
| 2376 | 2376 |
| 2377 static CSSValue* consumeBorderImageSlice(CSSPropertyID property, CSSParserTokenR
ange& range) | 2377 static CSSValue* consumeBorderImageSlice(CSSPropertyID property, CSSParserTokenR
ange& range) |
| 2378 { | 2378 { |
| 2379 bool fill = consumeIdent<CSSValueFill>(range); | 2379 bool fill = consumeIdent<CSSValueFill>(range); |
| 2380 CSSPrimitiveValue* slices[4] = { 0 }; | 2380 CSSValue* slices[4] = { 0 }; |
| 2381 | 2381 |
| 2382 for (size_t index = 0; index < 4; ++index) { | 2382 for (size_t index = 0; index < 4; ++index) { |
| 2383 CSSPrimitiveValue* value = consumePercent(range, ValueRangeNonNegative); | 2383 CSSPrimitiveValue* value = consumePercent(range, ValueRangeNonNegative); |
| 2384 if (!value) | 2384 if (!value) |
| 2385 value = consumeNumber(range, ValueRangeNonNegative); | 2385 value = consumeNumber(range, ValueRangeNonNegative); |
| 2386 if (!value) | 2386 if (!value) |
| 2387 break; | 2387 break; |
| 2388 slices[index] = value; | 2388 slices[index] = value; |
| 2389 } | 2389 } |
| 2390 if (!slices[0]) | 2390 if (!slices[0]) |
| 2391 return nullptr; | 2391 return nullptr; |
| 2392 if (consumeIdent<CSSValueFill>(range)) { | 2392 if (consumeIdent<CSSValueFill>(range)) { |
| 2393 if (fill) | 2393 if (fill) |
| 2394 return nullptr; | 2394 return nullptr; |
| 2395 fill = true; | 2395 fill = true; |
| 2396 } | 2396 } |
| 2397 complete4Sides(slices); | 2397 complete4Sides(slices); |
| 2398 // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mask-bo
x-image and -webkit-box-reflect have to do a fill by default. | 2398 // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mask-bo
x-image and -webkit-box-reflect have to do a fill by default. |
| 2399 // FIXME: What do we do with -webkit-box-reflect and -webkit-mask-box-image?
Probably just have to leave them filling... | 2399 // FIXME: What do we do with -webkit-box-reflect and -webkit-mask-box-image?
Probably just have to leave them filling... |
| 2400 if (property == CSSPropertyWebkitBorderImage || property == CSSPropertyWebki
tMaskBoxImage || property == CSSPropertyWebkitBoxReflect) | 2400 if (property == CSSPropertyWebkitBorderImage || property == CSSPropertyWebki
tMaskBoxImage || property == CSSPropertyWebkitBoxReflect) |
| 2401 fill = true; | 2401 fill = true; |
| 2402 return CSSBorderImageSliceValue::create(CSSQuadValue::create(slices[0], slic
es[1], slices[2], slices[3], CSSQuadValue::SerializeAsQuad), fill); | 2402 return CSSBorderImageSliceValue::create(CSSQuadValue::create(slices[0], slic
es[1], slices[2], slices[3], CSSQuadValue::SerializeAsQuad), fill); |
| 2403 } | 2403 } |
| 2404 | 2404 |
| 2405 static CSSValue* consumeBorderImageOutset(CSSParserTokenRange& range) | 2405 static CSSValue* consumeBorderImageOutset(CSSParserTokenRange& range) |
| 2406 { | 2406 { |
| 2407 CSSPrimitiveValue* outsets[4] = { 0 }; | 2407 CSSValue* outsets[4] = { 0 }; |
| 2408 | 2408 |
| 2409 CSSPrimitiveValue* value = nullptr; | 2409 CSSValue* value = nullptr; |
| 2410 for (size_t index = 0; index < 4; ++index) { | 2410 for (size_t index = 0; index < 4; ++index) { |
| 2411 value = consumeNumber(range, ValueRangeNonNegative); | 2411 value = consumeNumber(range, ValueRangeNonNegative); |
| 2412 if (!value) | 2412 if (!value) |
| 2413 value = consumeLength(range, HTMLStandardMode, ValueRangeNonNegative
); | 2413 value = consumeLength(range, HTMLStandardMode, ValueRangeNonNegative
); |
| 2414 if (!value) | 2414 if (!value) |
| 2415 break; | 2415 break; |
| 2416 outsets[index] = value; | 2416 outsets[index] = value; |
| 2417 } | 2417 } |
| 2418 if (!outsets[0]) | 2418 if (!outsets[0]) |
| 2419 return nullptr; | 2419 return nullptr; |
| 2420 complete4Sides(outsets); | 2420 complete4Sides(outsets); |
| 2421 return CSSQuadValue::create(outsets[0], outsets[1], outsets[2], outsets[3],
CSSQuadValue::SerializeAsQuad); | 2421 return CSSQuadValue::create(outsets[0], outsets[1], outsets[2], outsets[3],
CSSQuadValue::SerializeAsQuad); |
| 2422 } | 2422 } |
| 2423 | 2423 |
| 2424 static CSSValue* consumeBorderImageWidth(CSSParserTokenRange& range) | 2424 static CSSValue* consumeBorderImageWidth(CSSParserTokenRange& range) |
| 2425 { | 2425 { |
| 2426 CSSPrimitiveValue* widths[4] = { 0 }; | 2426 CSSValue* widths[4] = { 0 }; |
| 2427 | 2427 |
| 2428 CSSPrimitiveValue* value = nullptr; | 2428 CSSValue* value = nullptr; |
| 2429 for (size_t index = 0; index < 4; ++index) { | 2429 for (size_t index = 0; index < 4; ++index) { |
| 2430 value = consumeNumber(range, ValueRangeNonNegative); | 2430 value = consumeNumber(range, ValueRangeNonNegative); |
| 2431 if (!value) | 2431 if (!value) |
| 2432 value = consumeLengthOrPercent(range, HTMLStandardMode, ValueRangeNo
nNegative, UnitlessQuirk::Forbid); | 2432 value = consumeLengthOrPercent(range, HTMLStandardMode, ValueRangeNo
nNegative, UnitlessQuirk::Forbid); |
| 2433 if (!value) | 2433 if (!value) |
| 2434 value = consumeIdent<CSSValueAuto>(range); | 2434 value = consumeIdent<CSSValueAuto>(range); |
| 2435 if (!value) | 2435 if (!value) |
| 2436 break; | 2436 break; |
| 2437 widths[index] = value; | 2437 widths[index] = value; |
| 2438 } | 2438 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 CSSValue* width = nullptr; | 2487 CSSValue* width = nullptr; |
| 2488 CSSValue* outset = nullptr; | 2488 CSSValue* outset = nullptr; |
| 2489 CSSValue* repeat = nullptr; | 2489 CSSValue* repeat = nullptr; |
| 2490 if (consumeBorderImageComponents(property, range, context, source, slice, wi
dth, outset, repeat)) | 2490 if (consumeBorderImageComponents(property, range, context, source, slice, wi
dth, outset, repeat)) |
| 2491 return createBorderImageValue(source, slice, width, outset, repeat); | 2491 return createBorderImageValue(source, slice, width, outset, repeat); |
| 2492 return nullptr; | 2492 return nullptr; |
| 2493 } | 2493 } |
| 2494 | 2494 |
| 2495 static CSSValue* consumeReflect(CSSParserTokenRange& range, const CSSParserConte
xt& context) | 2495 static CSSValue* consumeReflect(CSSParserTokenRange& range, const CSSParserConte
xt& context) |
| 2496 { | 2496 { |
| 2497 CSSPrimitiveValue* direction = consumeIdent<CSSValueAbove, CSSValueBelow, CS
SValueLeft, CSSValueRight>(range); | 2497 CSSIdentifierValue* direction = consumeIdent<CSSValueAbove, CSSValueBelow, C
SSValueLeft, CSSValueRight>(range); |
| 2498 if (!direction) | 2498 if (!direction) |
| 2499 return nullptr; | 2499 return nullptr; |
| 2500 | 2500 |
| 2501 CSSPrimitiveValue* offset = nullptr; | 2501 CSSPrimitiveValue* offset = nullptr; |
| 2502 if (range.atEnd()) { | 2502 if (range.atEnd()) { |
| 2503 offset = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pixel
s); | 2503 offset = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pixel
s); |
| 2504 } else { | 2504 } else { |
| 2505 offset = consumeLengthOrPercent(range, context.mode(), ValueRangeAll, Un
itlessQuirk::Forbid); | 2505 offset = consumeLengthOrPercent(range, context.mode(), ValueRangeAll, Un
itlessQuirk::Forbid); |
| 2506 if (!offset) | 2506 if (!offset) |
| 2507 return nullptr; | 2507 return nullptr; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2572 if ((property == CSSPropertyWebkitBackgroundClip || property == CSSPropertyW
ebkitMaskClip) && range.peek().id() == CSSValueText) | 2572 if ((property == CSSPropertyWebkitBackgroundClip || property == CSSPropertyW
ebkitMaskClip) && range.peek().id() == CSSValueText) |
| 2573 return consumeIdent(range); | 2573 return consumeIdent(range); |
| 2574 return nullptr; | 2574 return nullptr; |
| 2575 } | 2575 } |
| 2576 | 2576 |
| 2577 static CSSValue* consumeBackgroundSize(CSSPropertyID unresolvedProperty, CSSPars
erTokenRange& range, CSSParserMode cssParserMode) | 2577 static CSSValue* consumeBackgroundSize(CSSPropertyID unresolvedProperty, CSSPars
erTokenRange& range, CSSParserMode cssParserMode) |
| 2578 { | 2578 { |
| 2579 if (identMatches<CSSValueContain, CSSValueCover>(range.peek().id())) | 2579 if (identMatches<CSSValueContain, CSSValueCover>(range.peek().id())) |
| 2580 return consumeIdent(range); | 2580 return consumeIdent(range); |
| 2581 | 2581 |
| 2582 CSSPrimitiveValue* horizontal = consumeIdent<CSSValueAuto>(range); | 2582 CSSValue* horizontal = consumeIdent<CSSValueAuto>(range); |
| 2583 if (!horizontal) | 2583 if (!horizontal) |
| 2584 horizontal = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll,
UnitlessQuirk::Forbid); | 2584 horizontal = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll,
UnitlessQuirk::Forbid); |
| 2585 | 2585 |
| 2586 CSSPrimitiveValue* vertical = nullptr; | 2586 CSSValue* vertical = nullptr; |
| 2587 if (!range.atEnd()) { | 2587 if (!range.atEnd()) { |
| 2588 if (range.peek().id() == CSSValueAuto) // `auto' is the default | 2588 if (range.peek().id() == CSSValueAuto) // `auto' is the default |
| 2589 range.consumeIncludingWhitespace(); | 2589 range.consumeIncludingWhitespace(); |
| 2590 else | 2590 else |
| 2591 vertical = consumeLengthOrPercent(range, cssParserMode, ValueRangeAl
l, UnitlessQuirk::Forbid); | 2591 vertical = consumeLengthOrPercent(range, cssParserMode, ValueRangeAl
l, UnitlessQuirk::Forbid); |
| 2592 } else if (unresolvedProperty == CSSPropertyAliasWebkitBackgroundSize) { | 2592 } else if (unresolvedProperty == CSSPropertyAliasWebkitBackgroundSize) { |
| 2593 // Legacy syntax: "-webkit-background-size: 10px" is equivalent to "back
ground-size: 10px 10px". | 2593 // Legacy syntax: "-webkit-background-size: 10px" is equivalent to "back
ground-size: 10px 10px". |
| 2594 vertical = horizontal; | 2594 vertical = horizontal; |
| 2595 } | 2595 } |
| 2596 if (!vertical) | 2596 if (!vertical) |
| 2597 return horizontal; | 2597 return horizontal; |
| 2598 return CSSValuePair::create(horizontal, vertical, CSSValuePair::KeepIdentica
lValues); | 2598 return CSSValuePair::create(horizontal, vertical, CSSValuePair::KeepIdentica
lValues); |
| 2599 } | 2599 } |
| 2600 | 2600 |
| 2601 static CSSValueList* consumeGridAutoFlow(CSSParserTokenRange& range) | 2601 static CSSValueList* consumeGridAutoFlow(CSSParserTokenRange& range) |
| 2602 { | 2602 { |
| 2603 CSSPrimitiveValue* rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColu
mn>(range); | 2603 CSSIdentifierValue* rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueCol
umn>(range); |
| 2604 CSSPrimitiveValue* denseAlgorithm = consumeIdent<CSSValueDense>(range); | 2604 CSSIdentifierValue* denseAlgorithm = consumeIdent<CSSValueDense>(range); |
| 2605 if (!rowOrColumnValue) { | 2605 if (!rowOrColumnValue) { |
| 2606 rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColumn>(range); | 2606 rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColumn>(range); |
| 2607 if (!rowOrColumnValue && !denseAlgorithm) | 2607 if (!rowOrColumnValue && !denseAlgorithm) |
| 2608 return nullptr; | 2608 return nullptr; |
| 2609 } | 2609 } |
| 2610 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); | 2610 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); |
| 2611 if (rowOrColumnValue) | 2611 if (rowOrColumnValue) |
| 2612 parsedValues->append(*rowOrColumnValue); | 2612 parsedValues->append(*rowOrColumnValue); |
| 2613 if (denseAlgorithm) | 2613 if (denseAlgorithm) |
| 2614 parsedValues->append(*denseAlgorithm); | 2614 parsedValues->append(*denseAlgorithm); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2676 CSSValue* result = nullptr; | 2676 CSSValue* result = nullptr; |
| 2677 do { | 2677 do { |
| 2678 CSSValue* value = consumeBackgroundComponent(unresolvedProperty, range,
context); | 2678 CSSValue* value = consumeBackgroundComponent(unresolvedProperty, range,
context); |
| 2679 if (!value) | 2679 if (!value) |
| 2680 return nullptr; | 2680 return nullptr; |
| 2681 addBackgroundValue(result, value); | 2681 addBackgroundValue(result, value); |
| 2682 } while (consumeCommaIncludingWhitespace(range)); | 2682 } while (consumeCommaIncludingWhitespace(range)); |
| 2683 return result; | 2683 return result; |
| 2684 } | 2684 } |
| 2685 | 2685 |
| 2686 static CSSPrimitiveValue* consumeSelfPositionKeyword(CSSParserTokenRange& range) | 2686 static CSSIdentifierValue* consumeSelfPositionKeyword(CSSParserTokenRange& range
) |
| 2687 { | 2687 { |
| 2688 CSSValueID id = range.peek().id(); | 2688 CSSValueID id = range.peek().id(); |
| 2689 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 2689 if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
| 2690 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart | 2690 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart |
| 2691 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) | 2691 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight) |
| 2692 return consumeIdent(range); | 2692 return consumeIdent(range); |
| 2693 return nullptr; | 2693 return nullptr; |
| 2694 } | 2694 } |
| 2695 | 2695 |
| 2696 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) | 2696 static CSSValue* consumeSelfPositionOverflowPosition(CSSParserTokenRange& range) |
| 2697 { | 2697 { |
| 2698 if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch, CSSValueBase
line, CSSValueLastBaseline>(range.peek().id())) | 2698 if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch, CSSValueBase
line, CSSValueLastBaseline>(range.peek().id())) |
| 2699 return consumeIdent(range); | 2699 return consumeIdent(range); |
| 2700 | 2700 |
| 2701 CSSPrimitiveValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueS
afe>(range); | 2701 CSSIdentifierValue* overflowPosition = consumeIdent<CSSValueUnsafe, CSSValue
Safe>(range); |
| 2702 CSSPrimitiveValue* selfPosition = consumeSelfPositionKeyword(range); | 2702 CSSIdentifierValue* selfPosition = consumeSelfPositionKeyword(range); |
| 2703 if (!selfPosition) | 2703 if (!selfPosition) |
| 2704 return nullptr; | 2704 return nullptr; |
| 2705 if (!overflowPosition) | 2705 if (!overflowPosition) |
| 2706 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); | 2706 overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range); |
| 2707 if (overflowPosition) | 2707 if (overflowPosition) |
| 2708 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair
::DropIdenticalValues); | 2708 return CSSValuePair::create(selfPosition, overflowPosition, CSSValuePair
::DropIdenticalValues); |
| 2709 return selfPosition; | 2709 return selfPosition; |
| 2710 } | 2710 } |
| 2711 | 2711 |
| 2712 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) | 2712 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) |
| 2713 { | 2713 { |
| 2714 // align-items property does not allow the 'auto' value. | 2714 // align-items property does not allow the 'auto' value. |
| 2715 if (identMatches<CSSValueAuto>(range.peek().id())) | 2715 if (identMatches<CSSValueAuto>(range.peek().id())) |
| 2716 return nullptr; | 2716 return nullptr; |
| 2717 return consumeSelfPositionOverflowPosition(range); | 2717 return consumeSelfPositionOverflowPosition(range); |
| 2718 } | 2718 } |
| 2719 | 2719 |
| 2720 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) | 2720 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) |
| 2721 { | 2721 { |
| 2722 CSSParserTokenRange rangeCopy = range; | 2722 CSSParserTokenRange rangeCopy = range; |
| 2723 CSSPrimitiveValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 2723 CSSIdentifierValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
| 2724 CSSPrimitiveValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueLe
ft, CSSValueRight>(rangeCopy); | 2724 CSSIdentifierValue* positionKeyword = consumeIdent<CSSValueCenter, CSSValueL
eft, CSSValueRight>(rangeCopy); |
| 2725 if (!legacy) | 2725 if (!legacy) |
| 2726 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); | 2726 legacy = consumeIdent<CSSValueLegacy>(rangeCopy); |
| 2727 if (legacy && positionKeyword) { | 2727 if (legacy && positionKeyword) { |
| 2728 range = rangeCopy; | 2728 range = rangeCopy; |
| 2729 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI
denticalValues); | 2729 return CSSValuePair::create(legacy, positionKeyword, CSSValuePair::DropI
denticalValues); |
| 2730 } | 2730 } |
| 2731 return consumeSelfPositionOverflowPosition(range); | 2731 return consumeSelfPositionOverflowPosition(range); |
| 2732 } | 2732 } |
| 2733 | 2733 |
| 2734 static CSSValue* consumeFitContent(CSSParserTokenRange& range, CSSParserMode css
ParserMode) | 2734 static CSSValue* consumeFitContent(CSSParserTokenRange& range, CSSParserMode css
ParserMode) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2749 if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueSpan) | 2749 if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueSpan) |
| 2750 return nullptr; | 2750 return nullptr; |
| 2751 return consumeCustomIdent(range); | 2751 return consumeCustomIdent(range); |
| 2752 } | 2752 } |
| 2753 | 2753 |
| 2754 static CSSValue* consumeGridLine(CSSParserTokenRange& range) | 2754 static CSSValue* consumeGridLine(CSSParserTokenRange& range) |
| 2755 { | 2755 { |
| 2756 if (range.peek().id() == CSSValueAuto) | 2756 if (range.peek().id() == CSSValueAuto) |
| 2757 return consumeIdent(range); | 2757 return consumeIdent(range); |
| 2758 | 2758 |
| 2759 CSSPrimitiveValue* spanValue = nullptr; | 2759 CSSIdentifierValue* spanValue = nullptr; |
| 2760 CSSCustomIdentValue* gridLineName = nullptr; | 2760 CSSCustomIdentValue* gridLineName = nullptr; |
| 2761 CSSPrimitiveValue* numericValue = consumeInteger(range); | 2761 CSSPrimitiveValue* numericValue = consumeInteger(range); |
| 2762 if (numericValue) { | 2762 if (numericValue) { |
| 2763 gridLineName = consumeCustomIdentForGridLine(range); | 2763 gridLineName = consumeCustomIdentForGridLine(range); |
| 2764 spanValue = consumeIdent<CSSValueSpan>(range); | 2764 spanValue = consumeIdent<CSSValueSpan>(range); |
| 2765 } else { | 2765 } else { |
| 2766 spanValue = consumeIdent<CSSValueSpan>(range); | 2766 spanValue = consumeIdent<CSSValueSpan>(range); |
| 2767 if (spanValue) { | 2767 if (spanValue) { |
| 2768 numericValue = consumeInteger(range); | 2768 numericValue = consumeInteger(range); |
| 2769 gridLineName = consumeCustomIdentForGridLine(range); | 2769 gridLineName = consumeCustomIdentForGridLine(range); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2793 if (spanValue) | 2793 if (spanValue) |
| 2794 values->append(*spanValue); | 2794 values->append(*spanValue); |
| 2795 if (numericValue) | 2795 if (numericValue) |
| 2796 values->append(*numericValue); | 2796 values->append(*numericValue); |
| 2797 if (gridLineName) | 2797 if (gridLineName) |
| 2798 values->append(*gridLineName); | 2798 values->append(*gridLineName); |
| 2799 ASSERT(values->length()); | 2799 ASSERT(values->length()); |
| 2800 return values; | 2800 return values; |
| 2801 } | 2801 } |
| 2802 | 2802 |
| 2803 static bool isGridTrackFixedSized(const CSSPrimitiveValue& primitiveValue) | 2803 static bool isGridBreadthFixedSized(const CSSValue& value) |
| 2804 { | 2804 { |
| 2805 CSSValueID valueID = primitiveValue.getValueID(); | 2805 if (value.isIdentifierValue()) { |
| 2806 if (valueID == CSSValueMinContent || valueID == CSSValueMaxContent || valueI
D == CSSValueAuto || primitiveValue.isFlex()) | 2806 CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); |
| 2807 return false; | 2807 return !(valueID == CSSValueMinContent || valueID == CSSValueMaxContent
|| valueID == CSSValueAuto); |
| 2808 } |
| 2808 | 2809 |
| 2810 if (value.isPrimitiveValue()) { |
| 2811 return !toCSSPrimitiveValue(value).isFlex(); |
| 2812 } |
| 2813 |
| 2814 NOTREACHED(); |
| 2809 return true; | 2815 return true; |
| 2810 } | 2816 } |
| 2811 | 2817 |
| 2812 static bool isGridTrackFixedSized(const CSSValue& value) | 2818 static bool isGridTrackFixedSized(const CSSValue& value) |
| 2813 { | 2819 { |
| 2814 if (value.isPrimitiveValue()) | 2820 if (value.isPrimitiveValue() || value.isIdentifierValue()) |
| 2815 return isGridTrackFixedSized(toCSSPrimitiveValue(value)); | 2821 return isGridBreadthFixedSized(value); |
| 2816 | 2822 |
| 2817 DCHECK(value.isFunctionValue()); | 2823 DCHECK(value.isFunctionValue()); |
| 2818 auto& function = toCSSFunctionValue(value); | 2824 auto& function = toCSSFunctionValue(value); |
| 2819 if (function.functionType() == CSSValueFitContent) | 2825 if (function.functionType() == CSSValueFitContent) |
| 2820 return false; | 2826 return false; |
| 2821 | 2827 |
| 2822 const CSSPrimitiveValue& minPrimitiveValue = toCSSPrimitiveValue(function.it
em(0)); | 2828 const CSSValue& minValue = function.item(0); |
| 2823 const CSSPrimitiveValue& maxPrimitiveValue = toCSSPrimitiveValue(function.it
em(1)); | 2829 const CSSValue& maxValue = function.item(1); |
| 2824 return isGridTrackFixedSized(minPrimitiveValue) || isGridTrackFixedSized(max
PrimitiveValue); | 2830 return isGridBreadthFixedSized(minValue) || isGridBreadthFixedSized(maxValue
); |
| 2825 } | 2831 } |
| 2826 | 2832 |
| 2827 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNam
es) | 2833 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNam
es) |
| 2828 { | 2834 { |
| 2829 ASSERT(!gridRowNames.isEmpty()); | 2835 ASSERT(!gridRowNames.isEmpty()); |
| 2830 Vector<String> columnNames; | 2836 Vector<String> columnNames; |
| 2831 // Using StringImpl to avoid checks and indirection in every call to String:
:operator[]. | 2837 // Using StringImpl to avoid checks and indirection in every call to String:
:operator[]. |
| 2832 StringImpl& text = *gridRowNames.impl(); | 2838 StringImpl& text = *gridRowNames.impl(); |
| 2833 | 2839 |
| 2834 StringBuilder areaName; | 2840 StringBuilder areaName; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2911 return false; | 2917 return false; |
| 2912 | 2918 |
| 2913 gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.s
tartLine(), gridArea.rows.endLine() + 1); | 2919 gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.s
tartLine(), gridArea.rows.endLine() + 1); |
| 2914 } | 2920 } |
| 2915 currentColumn = lookAheadColumn - 1; | 2921 currentColumn = lookAheadColumn - 1; |
| 2916 } | 2922 } |
| 2917 | 2923 |
| 2918 return true; | 2924 return true; |
| 2919 } | 2925 } |
| 2920 | 2926 |
| 2921 static CSSPrimitiveValue* consumeGridBreadth(CSSParserTokenRange& range, CSSPars
erMode cssParserMode) | 2927 static CSSValue* consumeGridBreadth(CSSParserTokenRange& range, CSSParserMode cs
sParserMode) |
| 2922 { | 2928 { |
| 2923 const CSSParserToken& token = range.peek(); | 2929 const CSSParserToken& token = range.peek(); |
| 2924 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(token
.id())) | 2930 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(token
.id())) |
| 2925 return consumeIdent(range); | 2931 return consumeIdent(range); |
| 2926 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue:
:UnitType::Fraction) { | 2932 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue:
:UnitType::Fraction) { |
| 2927 if (range.peek().numericValue() < 0) | 2933 if (range.peek().numericValue() < 0) |
| 2928 return nullptr; | 2934 return nullptr; |
| 2929 return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().nume
ricValue(), CSSPrimitiveValue::UnitType::Fraction); | 2935 return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().nume
ricValue(), CSSPrimitiveValue::UnitType::Fraction); |
| 2930 } | 2936 } |
| 2931 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U
nitlessQuirk::Allow); | 2937 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U
nitlessQuirk::Allow); |
| 2932 } | 2938 } |
| 2933 | 2939 |
| 2934 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode
cssParserMode) | 2940 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode
cssParserMode) |
| 2935 { | 2941 { |
| 2936 const CSSParserToken& token = range.peek(); | 2942 const CSSParserToken& token = range.peek(); |
| 2937 if (identMatches<CSSValueAuto>(token.id())) | 2943 if (identMatches<CSSValueAuto>(token.id())) |
| 2938 return consumeIdent(range); | 2944 return consumeIdent(range); |
| 2939 | 2945 |
| 2940 if (token.functionId() == CSSValueMinmax) { | 2946 if (token.functionId() == CSSValueMinmax) { |
| 2941 CSSParserTokenRange rangeCopy = range; | 2947 CSSParserTokenRange rangeCopy = range; |
| 2942 CSSParserTokenRange args = consumeFunction(rangeCopy); | 2948 CSSParserTokenRange args = consumeFunction(rangeCopy); |
| 2943 CSSPrimitiveValue* minTrackBreadth = consumeGridBreadth(args, cssParserM
ode); | 2949 CSSValue* minTrackBreadth = consumeGridBreadth(args, cssParserMode); |
| 2944 if (!minTrackBreadth || minTrackBreadth->isFlex() || !consumeCommaInclud
ingWhitespace(args)) | 2950 if (!minTrackBreadth || (minTrackBreadth->isPrimitiveValue() && toCSSPri
mitiveValue(minTrackBreadth)->isFlex()) || !consumeCommaIncludingWhitespace(args
)) |
| 2945 return nullptr; | 2951 return nullptr; |
| 2946 CSSPrimitiveValue* maxTrackBreadth = consumeGridBreadth(args, cssParserM
ode); | 2952 CSSValue* maxTrackBreadth = consumeGridBreadth(args, cssParserMode); |
| 2947 if (!maxTrackBreadth || !args.atEnd()) | 2953 if (!maxTrackBreadth || !args.atEnd()) |
| 2948 return nullptr; | 2954 return nullptr; |
| 2949 range = rangeCopy; | 2955 range = rangeCopy; |
| 2950 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueMinmax); | 2956 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueMinmax); |
| 2951 result->append(*minTrackBreadth); | 2957 result->append(*minTrackBreadth); |
| 2952 result->append(*maxTrackBreadth); | 2958 result->append(*maxTrackBreadth); |
| 2953 return result; | 2959 return result; |
| 2954 } | 2960 } |
| 2955 | 2961 |
| 2956 if (token.functionId() == CSSValueFitContent) | 2962 if (token.functionId() == CSSValueFitContent) |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3528 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3534 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3529 return consumeGridTemplateAreas(m_range); | 3535 return consumeGridTemplateAreas(m_range); |
| 3530 case CSSPropertyGridAutoFlow: | 3536 case CSSPropertyGridAutoFlow: |
| 3531 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3537 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3532 return consumeGridAutoFlow(m_range); | 3538 return consumeGridAutoFlow(m_range); |
| 3533 default: | 3539 default: |
| 3534 return nullptr; | 3540 return nullptr; |
| 3535 } | 3541 } |
| 3536 } | 3542 } |
| 3537 | 3543 |
| 3538 static CSSPrimitiveValue* consumeFontDisplay(CSSParserTokenRange& range) | 3544 static CSSIdentifierValue* consumeFontDisplay(CSSParserTokenRange& range) |
| 3539 { | 3545 { |
| 3540 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap, CSSValueFallb
ack, CSSValueOptional>(range); | 3546 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap, CSSValueFallb
ack, CSSValueOptional>(range); |
| 3541 } | 3547 } |
| 3542 | 3548 |
| 3543 static CSSValueList* consumeFontFaceUnicodeRange(CSSParserTokenRange& range) | 3549 static CSSValueList* consumeFontFaceUnicodeRange(CSSParserTokenRange& range) |
| 3544 { | 3550 { |
| 3545 CSSValueList* values = CSSValueList::createCommaSeparated(); | 3551 CSSValueList* values = CSSValueList::createCommaSeparated(); |
| 3546 | 3552 |
| 3547 do { | 3553 do { |
| 3548 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 3554 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3633 parsedValue = consumeFontFaceUnicodeRange(m_range); | 3639 parsedValue = consumeFontFaceUnicodeRange(m_range); |
| 3634 break; | 3640 break; |
| 3635 case CSSPropertyFontDisplay: | 3641 case CSSPropertyFontDisplay: |
| 3636 parsedValue = consumeFontDisplay(m_range); | 3642 parsedValue = consumeFontDisplay(m_range); |
| 3637 break; | 3643 break; |
| 3638 case CSSPropertyFontStretch: | 3644 case CSSPropertyFontStretch: |
| 3639 case CSSPropertyFontStyle: { | 3645 case CSSPropertyFontStyle: { |
| 3640 CSSValueID id = m_range.consumeIncludingWhitespace().id(); | 3646 CSSValueID id = m_range.consumeIncludingWhitespace().id(); |
| 3641 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_co
ntext.mode())) | 3647 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_co
ntext.mode())) |
| 3642 return false; | 3648 return false; |
| 3643 parsedValue = CSSPrimitiveValue::createIdentifier(id); | 3649 parsedValue = CSSIdentifierValue::create(id); |
| 3644 break; | 3650 break; |
| 3645 } | 3651 } |
| 3646 case CSSPropertyFontVariant: | 3652 case CSSPropertyFontVariant: |
| 3647 parsedValue = consumeFontVariantList(m_range); | 3653 parsedValue = consumeFontVariantList(m_range); |
| 3648 break; | 3654 break; |
| 3649 case CSSPropertyFontWeight: | 3655 case CSSPropertyFontWeight: |
| 3650 parsedValue = consumeFontWeight(m_range); | 3656 parsedValue = consumeFontWeight(m_range); |
| 3651 break; | 3657 break; |
| 3652 case CSSPropertyFontFeatureSettings: | 3658 case CSSPropertyFontFeatureSettings: |
| 3653 parsedValue = consumeFontFeatureSettings(m_range); | 3659 parsedValue = consumeFontFeatureSettings(m_range); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3669 ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar)
; | 3675 ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar)
; |
| 3670 if (!m_range.atEnd()) | 3676 if (!m_range.atEnd()) |
| 3671 return false; | 3677 return false; |
| 3672 | 3678 |
| 3673 FontStyle fontStyle = FontStyleNormal; | 3679 FontStyle fontStyle = FontStyleNormal; |
| 3674 FontWeight fontWeight = FontWeightNormal; | 3680 FontWeight fontWeight = FontWeightNormal; |
| 3675 float fontSize = 0; | 3681 float fontSize = 0; |
| 3676 AtomicString fontFamily; | 3682 AtomicString fontFamily; |
| 3677 LayoutTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSiz
e, fontFamily); | 3683 LayoutTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSiz
e, fontFamily); |
| 3678 | 3684 |
| 3679 addProperty(CSSPropertyFontStyle, CSSPropertyFont, *CSSPrimitiveValue::creat
eIdentifier(fontStyle == FontStyleItalic ? CSSValueItalic : CSSValueNormal), imp
ortant); | 3685 addProperty(CSSPropertyFontStyle, CSSPropertyFont, *CSSIdentifierValue::crea
te(fontStyle == FontStyleItalic ? CSSValueItalic : CSSValueNormal), important); |
| 3680 addProperty(CSSPropertyFontWeight, CSSPropertyFont, *CSSPrimitiveValue::crea
te(fontWeight), important); | 3686 addProperty(CSSPropertyFontWeight, CSSPropertyFont, *CSSIdentifierValue::cre
ate(fontWeight), important); |
| 3681 addProperty(CSSPropertyFontSize, CSSPropertyFont, *CSSPrimitiveValue::create
(fontSize, CSSPrimitiveValue::UnitType::Pixels), important); | 3687 addProperty(CSSPropertyFontSize, CSSPropertyFont, *CSSPrimitiveValue::create
(fontSize, CSSPrimitiveValue::UnitType::Pixels), important); |
| 3682 CSSValueList* fontFamilyList = CSSValueList::createCommaSeparated(); | 3688 CSSValueList* fontFamilyList = CSSValueList::createCommaSeparated(); |
| 3683 fontFamilyList->append(*CSSFontFamilyValue::create(fontFamily)); | 3689 fontFamilyList->append(*CSSFontFamilyValue::create(fontFamily)); |
| 3684 addProperty(CSSPropertyFontFamily, CSSPropertyFont, *fontFamilyList, importa
nt); | 3690 addProperty(CSSPropertyFontFamily, CSSPropertyFont, *fontFamilyList, importa
nt); |
| 3685 | 3691 |
| 3686 addProperty(CSSPropertyFontStretch, CSSPropertyFont, *CSSPrimitiveValue::cre
ateIdentifier(CSSValueNormal), important); | 3692 addProperty(CSSPropertyFontStretch, CSSPropertyFont, *CSSIdentifierValue::cr
eate(CSSValueNormal), important); |
| 3687 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, *CSSPrimitiveValue:
:createIdentifier(CSSValueNormal), important); | 3693 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, *CSSIdentifierValue
::create(CSSValueNormal), important); |
| 3688 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSPrimitiveV
alue::createIdentifier(CSSValueNormal), important); | 3694 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSIdentifier
Value::create(CSSValueNormal), important); |
| 3689 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSPrimitiveVal
ue::createIdentifier(CSSValueNormal), important); | 3695 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSIdentifierVa
lue::create(CSSValueNormal), important); |
| 3690 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *CSSPrimitiveValue::crea
teIdentifier(CSSValueNormal), important); | 3696 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *CSSIdentifierValue::cre
ate(CSSValueNormal), important); |
| 3691 return true; | 3697 return true; |
| 3692 } | 3698 } |
| 3693 | 3699 |
| 3694 bool CSSPropertyParser::consumeFont(bool important) | 3700 bool CSSPropertyParser::consumeFont(bool important) |
| 3695 { | 3701 { |
| 3696 // Let's check if there is an inherit or initial somewhere in the shorthand. | 3702 // Let's check if there is an inherit or initial somewhere in the shorthand. |
| 3697 CSSParserTokenRange range = m_range; | 3703 CSSParserTokenRange range = m_range; |
| 3698 while (!range.atEnd()) { | 3704 while (!range.atEnd()) { |
| 3699 CSSValueID id = range.consumeIncludingWhitespace().id(); | 3705 CSSValueID id = range.consumeIncludingWhitespace().id(); |
| 3700 if (id == CSSValueInherit || id == CSSValueInitial) | 3706 if (id == CSSValueInherit || id == CSSValueInitial) |
| 3701 return false; | 3707 return false; |
| 3702 } | 3708 } |
| 3703 // Optional font-style, font-variant, font-stretch and font-weight. | 3709 // Optional font-style, font-variant, font-stretch and font-weight. |
| 3704 CSSPrimitiveValue* fontStyle = nullptr; | 3710 CSSIdentifierValue* fontStyle = nullptr; |
| 3705 CSSPrimitiveValue* fontVariantCaps = nullptr; | 3711 CSSIdentifierValue* fontVariantCaps = nullptr; |
| 3706 CSSPrimitiveValue* fontWeight = nullptr; | 3712 CSSIdentifierValue* fontWeight = nullptr; |
| 3707 CSSPrimitiveValue* fontStretch = nullptr; | 3713 CSSIdentifierValue* fontStretch = nullptr; |
| 3708 while (!m_range.atEnd()) { | 3714 while (!m_range.atEnd()) { |
| 3709 CSSValueID id = m_range.peek().id(); | 3715 CSSValueID id = m_range.peek().id(); |
| 3710 if (!fontStyle && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSS
PropertyFontStyle, id, m_context.mode())) { | 3716 if (!fontStyle && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSS
PropertyFontStyle, id, m_context.mode())) { |
| 3711 fontStyle = consumeIdent(m_range); | 3717 fontStyle = consumeIdent(m_range); |
| 3712 continue; | 3718 continue; |
| 3713 } | 3719 } |
| 3714 if (!fontVariantCaps && (id == CSSValueNormal || id == CSSValueSmallCaps
)) { | 3720 if (!fontVariantCaps && (id == CSSValueNormal || id == CSSValueSmallCaps
)) { |
| 3715 // Font variant in the shorthand is particular, it only accepts norm
al or small-caps. | 3721 // Font variant in the shorthand is particular, it only accepts norm
al or small-caps. |
| 3716 // See https://drafts.csswg.org/css-fonts/#propdef-font | 3722 // See https://drafts.csswg.org/css-fonts/#propdef-font |
| 3717 fontVariantCaps = consumeFontVariantCSS21(m_range); | 3723 fontVariantCaps = consumeFontVariantCSS21(m_range); |
| 3718 if (fontVariantCaps) | 3724 if (fontVariantCaps) |
| 3719 continue; | 3725 continue; |
| 3720 } | 3726 } |
| 3721 if (!fontWeight) { | 3727 if (!fontWeight) { |
| 3722 fontWeight = consumeFontWeight(m_range); | 3728 fontWeight = consumeFontWeight(m_range); |
| 3723 if (fontWeight) | 3729 if (fontWeight) |
| 3724 continue; | 3730 continue; |
| 3725 } | 3731 } |
| 3726 if (!fontStretch && CSSParserFastPaths::isValidKeywordPropertyAndValue(C
SSPropertyFontStretch, id, m_context.mode())) | 3732 if (!fontStretch && CSSParserFastPaths::isValidKeywordPropertyAndValue(C
SSPropertyFontStretch, id, m_context.mode())) |
| 3727 fontStretch = consumeIdent(m_range); | 3733 fontStretch = consumeIdent(m_range); |
| 3728 else | 3734 else |
| 3729 break; | 3735 break; |
| 3730 } | 3736 } |
| 3731 | 3737 |
| 3732 if (m_range.atEnd()) | 3738 if (m_range.atEnd()) |
| 3733 return false; | 3739 return false; |
| 3734 | 3740 |
| 3735 addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle ? *fontStyle :
*CSSPrimitiveValue::createIdentifier(CSSValueNormal), important); | 3741 addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle ? *fontStyle :
*CSSIdentifierValue::create(CSSValueNormal), important); |
| 3736 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, fontVariantCaps ? *
fontVariantCaps : *CSSPrimitiveValue::createIdentifier(CSSValueNormal), importan
t); | 3742 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, fontVariantCaps ? *
fontVariantCaps : *CSSIdentifierValue::create(CSSValueNormal), important); |
| 3737 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSPrimitiveV
alue::createIdentifier(CSSValueNormal), important); | 3743 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSIdentifier
Value::create(CSSValueNormal), important); |
| 3738 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSPrimitiveVal
ue::createIdentifier(CSSValueNormal), important); | 3744 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSIdentifierVa
lue::create(CSSValueNormal), important); |
| 3739 | 3745 |
| 3740 addProperty(CSSPropertyFontWeight, CSSPropertyFont, fontWeight ? *fontWeight
: *CSSPrimitiveValue::createIdentifier(CSSValueNormal), important); | 3746 addProperty(CSSPropertyFontWeight, CSSPropertyFont, fontWeight ? *fontWeight
: *CSSIdentifierValue::create(CSSValueNormal), important); |
| 3741 addProperty(CSSPropertyFontStretch, CSSPropertyFont, fontStretch ? *fontStre
tch : *CSSPrimitiveValue::createIdentifier(CSSValueNormal), important); | 3747 addProperty(CSSPropertyFontStretch, CSSPropertyFont, fontStretch ? *fontStre
tch : *CSSIdentifierValue::create(CSSValueNormal), important); |
| 3742 | 3748 |
| 3743 // Now a font size _must_ come. | 3749 // Now a font size _must_ come. |
| 3744 CSSValue* fontSize = consumeFontSize(m_range, m_context.mode()); | 3750 CSSValue* fontSize = consumeFontSize(m_range, m_context.mode()); |
| 3745 if (!fontSize || m_range.atEnd()) | 3751 if (!fontSize || m_range.atEnd()) |
| 3746 return false; | 3752 return false; |
| 3747 | 3753 |
| 3748 addProperty(CSSPropertyFontSize, CSSPropertyFont, *fontSize, important); | 3754 addProperty(CSSPropertyFontSize, CSSPropertyFont, *fontSize, important); |
| 3749 | 3755 |
| 3750 if (consumeSlashIncludingWhitespace(m_range)) { | 3756 if (consumeSlashIncludingWhitespace(m_range)) { |
| 3751 CSSPrimitiveValue* lineHeight = consumeLineHeight(m_range, m_context.mod
e()); | 3757 CSSValue* lineHeight = consumeLineHeight(m_range, m_context.mode()); |
| 3752 if (!lineHeight) | 3758 if (!lineHeight) |
| 3753 return false; | 3759 return false; |
| 3754 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *lineHeight, importa
nt); | 3760 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *lineHeight, importa
nt); |
| 3755 } else { | 3761 } else { |
| 3756 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *CSSPrimitiveValue::
createIdentifier(CSSValueNormal), important); | 3762 addProperty(CSSPropertyLineHeight, CSSPropertyFont, *CSSIdentifierValue:
:create(CSSValueNormal), important); |
| 3757 } | 3763 } |
| 3758 | 3764 |
| 3759 // Font family must come now. | 3765 // Font family must come now. |
| 3760 CSSValue* parsedFamilyValue = consumeFontFamily(m_range); | 3766 CSSValue* parsedFamilyValue = consumeFontFamily(m_range); |
| 3761 if (!parsedFamilyValue) | 3767 if (!parsedFamilyValue) |
| 3762 return false; | 3768 return false; |
| 3763 | 3769 |
| 3764 addProperty(CSSPropertyFontFamily, CSSPropertyFont, *parsedFamilyValue, impo
rtant); | 3770 addProperty(CSSPropertyFontFamily, CSSPropertyFont, *parsedFamilyValue, impo
rtant); |
| 3765 | 3771 |
| 3766 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requir
es that | 3772 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requir
es that |
| 3767 // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their
initial values | 3773 // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their
initial values |
| 3768 // but we don't seem to support them at the moment. They should also be adde
d here once implemented. | 3774 // but we don't seem to support them at the moment. They should also be adde
d here once implemented. |
| 3769 return m_range.atEnd(); | 3775 return m_range.atEnd(); |
| 3770 } | 3776 } |
| 3771 | 3777 |
| 3772 bool CSSPropertyParser::consumeFontVariantShorthand(bool important) | 3778 bool CSSPropertyParser::consumeFontVariantShorthand(bool important) |
| 3773 { | 3779 { |
| 3774 if (identMatches<CSSValueNormal, CSSValueNone>(m_range.peek().id())) { | 3780 if (identMatches<CSSValueNormal, CSSValueNone>(m_range.peek().id())) { |
| 3775 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *co
nsumeIdent(m_range), important); | 3781 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *co
nsumeIdent(m_range), important); |
| 3776 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, *CSSPrim
itiveValue::createIdentifier(CSSValueNormal), important); | 3782 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, *CSSIden
tifierValue::create(CSSValueNormal), important); |
| 3777 return m_range.atEnd(); | 3783 return m_range.atEnd(); |
| 3778 } | 3784 } |
| 3779 | 3785 |
| 3780 CSSPrimitiveValue* capsValue = nullptr; | 3786 CSSIdentifierValue* capsValue = nullptr; |
| 3781 FontVariantLigaturesParser ligaturesParser; | 3787 FontVariantLigaturesParser ligaturesParser; |
| 3782 FontVariantNumericParser numericParser; | 3788 FontVariantNumericParser numericParser; |
| 3783 do { | 3789 do { |
| 3784 FontVariantLigaturesParser::ParseResult ligaturesParseResult = ligatures
Parser.consumeLigature(m_range); | 3790 FontVariantLigaturesParser::ParseResult ligaturesParseResult = ligatures
Parser.consumeLigature(m_range); |
| 3785 FontVariantNumericParser::ParseResult numericParseResult = numericParser
.consumeNumeric(m_range); | 3791 FontVariantNumericParser::ParseResult numericParseResult = numericParser
.consumeNumeric(m_range); |
| 3786 if (ligaturesParseResult == FontVariantLigaturesParser::ParseResult::Con
sumedValue | 3792 if (ligaturesParseResult == FontVariantLigaturesParser::ParseResult::Con
sumedValue |
| 3787 || numericParseResult == FontVariantNumericParser::ParseResult::Cons
umedValue) | 3793 || numericParseResult == FontVariantNumericParser::ParseResult::Cons
umedValue) |
| 3788 continue; | 3794 continue; |
| 3789 | 3795 |
| 3790 if (ligaturesParseResult == FontVariantLigaturesParser::ParseResult::Dis
allowedValue | 3796 if (ligaturesParseResult == FontVariantLigaturesParser::ParseResult::Dis
allowedValue |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3804 return false; | 3810 return false; |
| 3805 capsValue = consumeIdent(m_range); | 3811 capsValue = consumeIdent(m_range); |
| 3806 break; | 3812 break; |
| 3807 default: | 3813 default: |
| 3808 return false; | 3814 return false; |
| 3809 } | 3815 } |
| 3810 } while (!m_range.atEnd()); | 3816 } while (!m_range.atEnd()); |
| 3811 | 3817 |
| 3812 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *ligatu
resParser.finalizeValue(), important); | 3818 addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *ligatu
resParser.finalizeValue(), important); |
| 3813 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFontVariant, *numericP
arser.finalizeValue(), important); | 3819 addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFontVariant, *numericP
arser.finalizeValue(), important); |
| 3814 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, capsValue ?
*capsValue : *CSSPrimitiveValue::createIdentifier(CSSValueNormal), important); | 3820 addProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, capsValue ?
*capsValue : *CSSIdentifierValue::create(CSSValueNormal), important); |
| 3815 return true; | 3821 return true; |
| 3816 } | 3822 } |
| 3817 | 3823 |
| 3818 bool CSSPropertyParser::consumeBorderSpacing(bool important) | 3824 bool CSSPropertyParser::consumeBorderSpacing(bool important) |
| 3819 { | 3825 { |
| 3820 CSSValue* horizontalSpacing = consumeLength(m_range, m_context.mode(), Value
RangeNonNegative, UnitlessQuirk::Allow); | 3826 CSSValue* horizontalSpacing = consumeLength(m_range, m_context.mode(), Value
RangeNonNegative, UnitlessQuirk::Allow); |
| 3821 if (!horizontalSpacing) | 3827 if (!horizontalSpacing) |
| 3822 return false; | 3828 return false; |
| 3823 CSSValue* verticalSpacing = horizontalSpacing; | 3829 CSSValue* verticalSpacing = horizontalSpacing; |
| 3824 if (!m_range.atEnd()) | 3830 if (!m_range.atEnd()) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3934 bool CSSPropertyParser::consumeColumns(bool important) | 3940 bool CSSPropertyParser::consumeColumns(bool important) |
| 3935 { | 3941 { |
| 3936 CSSValue* columnWidth = nullptr; | 3942 CSSValue* columnWidth = nullptr; |
| 3937 CSSValue* columnCount = nullptr; | 3943 CSSValue* columnCount = nullptr; |
| 3938 if (!consumeColumnWidthOrCount(m_range, columnWidth, columnCount)) | 3944 if (!consumeColumnWidthOrCount(m_range, columnWidth, columnCount)) |
| 3939 return false; | 3945 return false; |
| 3940 consumeColumnWidthOrCount(m_range, columnWidth, columnCount); | 3946 consumeColumnWidthOrCount(m_range, columnWidth, columnCount); |
| 3941 if (!m_range.atEnd()) | 3947 if (!m_range.atEnd()) |
| 3942 return false; | 3948 return false; |
| 3943 if (!columnWidth) | 3949 if (!columnWidth) |
| 3944 columnWidth = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 3950 columnWidth = CSSIdentifierValue::create(CSSValueAuto); |
| 3945 if (!columnCount) | 3951 if (!columnCount) |
| 3946 columnCount = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 3952 columnCount = CSSIdentifierValue::create(CSSValueAuto); |
| 3947 addProperty(CSSPropertyColumnWidth, CSSPropertyInvalid, *columnWidth, import
ant); | 3953 addProperty(CSSPropertyColumnWidth, CSSPropertyInvalid, *columnWidth, import
ant); |
| 3948 addProperty(CSSPropertyColumnCount, CSSPropertyInvalid, *columnCount, import
ant); | 3954 addProperty(CSSPropertyColumnCount, CSSPropertyInvalid, *columnCount, import
ant); |
| 3949 return true; | 3955 return true; |
| 3950 } | 3956 } |
| 3951 | 3957 |
| 3952 bool CSSPropertyParser::consumeShorthandGreedily(const StylePropertyShorthand& s
horthand, bool important) | 3958 bool CSSPropertyParser::consumeShorthandGreedily(const StylePropertyShorthand& s
horthand, bool important) |
| 3953 { | 3959 { |
| 3954 ASSERT(shorthand.length() <= 6); // Existing shorthands have at most 6 longh
ands. | 3960 ASSERT(shorthand.length() <= 6); // Existing shorthands have at most 6 longh
ands. |
| 3955 const CSSValue* longhands[6] = { nullptr, nullptr, nullptr, nullptr, nullptr
, nullptr }; | 3961 const CSSValue* longhands[6] = { nullptr, nullptr, nullptr, nullptr, nullptr
, nullptr }; |
| 3956 const CSSPropertyID* shorthandProperties = shorthand.properties(); | 3962 const CSSPropertyID* shorthandProperties = shorthand.properties(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3974 addProperty(shorthandProperties[i], shorthand.id(), *CSSInitialValue
::createLegacyImplicit(), important); | 3980 addProperty(shorthandProperties[i], shorthand.id(), *CSSInitialValue
::createLegacyImplicit(), important); |
| 3975 } | 3981 } |
| 3976 return true; | 3982 return true; |
| 3977 } | 3983 } |
| 3978 | 3984 |
| 3979 bool CSSPropertyParser::consumeFlex(bool important) | 3985 bool CSSPropertyParser::consumeFlex(bool important) |
| 3980 { | 3986 { |
| 3981 static const double unsetValue = -1; | 3987 static const double unsetValue = -1; |
| 3982 double flexGrow = unsetValue; | 3988 double flexGrow = unsetValue; |
| 3983 double flexShrink = unsetValue; | 3989 double flexShrink = unsetValue; |
| 3984 CSSPrimitiveValue* flexBasis = nullptr; | 3990 CSSValue* flexBasis = nullptr; |
| 3985 | 3991 |
| 3986 if (m_range.peek().id() == CSSValueNone) { | 3992 if (m_range.peek().id() == CSSValueNone) { |
| 3987 flexGrow = 0; | 3993 flexGrow = 0; |
| 3988 flexShrink = 0; | 3994 flexShrink = 0; |
| 3989 flexBasis = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 3995 flexBasis = CSSIdentifierValue::create(CSSValueAuto); |
| 3990 m_range.consumeIncludingWhitespace(); | 3996 m_range.consumeIncludingWhitespace(); |
| 3991 } else { | 3997 } else { |
| 3992 unsigned index = 0; | 3998 unsigned index = 0; |
| 3993 while (!m_range.atEnd() && index++ < 3) { | 3999 while (!m_range.atEnd() && index++ < 3) { |
| 3994 double num; | 4000 double num; |
| 3995 if (consumeNumberRaw(m_range, num)) { | 4001 if (consumeNumberRaw(m_range, num)) { |
| 3996 if (num < 0) | 4002 if (num < 0) |
| 3997 return false; | 4003 return false; |
| 3998 if (flexGrow == unsetValue) | 4004 if (flexGrow == unsetValue) |
| 3999 flexGrow = num; | 4005 flexGrow = num; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4169 return CSSPropertyBreakBefore; | 4175 return CSSPropertyBreakBefore; |
| 4170 ASSERT(property == CSSPropertyPageBreakInside || property == CSSPropertyWebk
itColumnBreakInside); | 4176 ASSERT(property == CSSPropertyPageBreakInside || property == CSSPropertyWebk
itColumnBreakInside); |
| 4171 return CSSPropertyBreakInside; | 4177 return CSSPropertyBreakInside; |
| 4172 } | 4178 } |
| 4173 | 4179 |
| 4174 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, bool
important) | 4180 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, bool
important) |
| 4175 { | 4181 { |
| 4176 // The fragmentation spec says that page-break-(after|before|inside) are to
be treated as | 4182 // The fragmentation spec says that page-break-(after|before|inside) are to
be treated as |
| 4177 // shorthands for their break-(after|before|inside) counterparts. We'll do t
he same for the | 4183 // shorthands for their break-(after|before|inside) counterparts. We'll do t
he same for the |
| 4178 // non-standard properties -webkit-column-break-(after|before|inside). | 4184 // non-standard properties -webkit-column-break-(after|before|inside). |
| 4179 CSSPrimitiveValue* keyword = consumeIdent(m_range); | 4185 CSSIdentifierValue* keyword = consumeIdent(m_range); |
| 4180 if (!keyword) | 4186 if (!keyword) |
| 4181 return false; | 4187 return false; |
| 4182 if (!m_range.atEnd()) | 4188 if (!m_range.atEnd()) |
| 4183 return false; | 4189 return false; |
| 4184 CSSValueID value = keyword->getValueID(); | 4190 CSSValueID value = keyword->getValueID(); |
| 4185 switch (property) { | 4191 switch (property) { |
| 4186 case CSSPropertyPageBreakAfter: | 4192 case CSSPropertyPageBreakAfter: |
| 4187 case CSSPropertyPageBreakBefore: | 4193 case CSSPropertyPageBreakBefore: |
| 4188 value = mapFromPageBreakBetween(value); | 4194 value = mapFromPageBreakBetween(value); |
| 4189 break; | 4195 break; |
| 4190 case CSSPropertyWebkitColumnBreakAfter: | 4196 case CSSPropertyWebkitColumnBreakAfter: |
| 4191 case CSSPropertyWebkitColumnBreakBefore: | 4197 case CSSPropertyWebkitColumnBreakBefore: |
| 4192 value = mapFromColumnBreakBetween(value); | 4198 value = mapFromColumnBreakBetween(value); |
| 4193 break; | 4199 break; |
| 4194 case CSSPropertyPageBreakInside: | 4200 case CSSPropertyPageBreakInside: |
| 4195 case CSSPropertyWebkitColumnBreakInside: | 4201 case CSSPropertyWebkitColumnBreakInside: |
| 4196 value = mapFromColumnOrPageBreakInside(value); | 4202 value = mapFromColumnOrPageBreakInside(value); |
| 4197 break; | 4203 break; |
| 4198 default: | 4204 default: |
| 4199 ASSERT_NOT_REACHED(); | 4205 ASSERT_NOT_REACHED(); |
| 4200 } | 4206 } |
| 4201 if (value == CSSValueInvalid) | 4207 if (value == CSSValueInvalid) |
| 4202 return false; | 4208 return false; |
| 4203 | 4209 |
| 4204 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property); | 4210 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property); |
| 4205 addProperty(genericBreakProperty, property, *CSSPrimitiveValue::createIdenti
fier(value), important); | 4211 addProperty(genericBreakProperty, property, *CSSIdentifierValue::create(valu
e), important); |
| 4206 return true; | 4212 return true; |
| 4207 } | 4213 } |
| 4208 | 4214 |
| 4209 static bool consumeBackgroundPosition(CSSParserTokenRange& range, const CSSParse
rContext& context, UnitlessQuirk unitless, CSSValue*& resultX, CSSValue*& result
Y) | 4215 static bool consumeBackgroundPosition(CSSParserTokenRange& range, const CSSParse
rContext& context, UnitlessQuirk unitless, CSSValue*& resultX, CSSValue*& result
Y) |
| 4210 { | 4216 { |
| 4211 do { | 4217 do { |
| 4212 CSSValue* positionX = nullptr; | 4218 CSSValue* positionX = nullptr; |
| 4213 CSSValue* positionY = nullptr; | 4219 CSSValue* positionY = nullptr; |
| 4214 if (!consumePosition(range, context.mode(), unitless, positionX, positio
nY)) | 4220 if (!consumePosition(range, context.mode(), unitless, positionX, positio
nY)) |
| 4215 return false; | 4221 return false; |
| 4216 addBackgroundValue(resultX, positionX); | 4222 addBackgroundValue(resultX, positionX); |
| 4217 addBackgroundValue(resultY, positionY); | 4223 addBackgroundValue(resultY, positionY); |
| 4218 } while (consumeCommaIncludingWhitespace(range)); | 4224 } while (consumeCommaIncludingWhitespace(range)); |
| 4219 return true; | 4225 return true; |
| 4220 } | 4226 } |
| 4221 | 4227 |
| 4222 static bool consumeRepeatStyleComponent(CSSParserTokenRange& range, CSSValue*& v
alue1, CSSValue*& value2, bool& implicit) | 4228 static bool consumeRepeatStyleComponent(CSSParserTokenRange& range, CSSValue*& v
alue1, CSSValue*& value2, bool& implicit) |
| 4223 { | 4229 { |
| 4224 if (consumeIdent<CSSValueRepeatX>(range)) { | 4230 if (consumeIdent<CSSValueRepeatX>(range)) { |
| 4225 value1 = CSSPrimitiveValue::createIdentifier(CSSValueRepeat); | 4231 value1 = CSSIdentifierValue::create(CSSValueRepeat); |
| 4226 value2 = CSSPrimitiveValue::createIdentifier(CSSValueNoRepeat); | 4232 value2 = CSSIdentifierValue::create(CSSValueNoRepeat); |
| 4227 implicit = true; | 4233 implicit = true; |
| 4228 return true; | 4234 return true; |
| 4229 } | 4235 } |
| 4230 if (consumeIdent<CSSValueRepeatY>(range)) { | 4236 if (consumeIdent<CSSValueRepeatY>(range)) { |
| 4231 value1 = CSSPrimitiveValue::createIdentifier(CSSValueNoRepeat); | 4237 value1 = CSSIdentifierValue::create(CSSValueNoRepeat); |
| 4232 value2 = CSSPrimitiveValue::createIdentifier(CSSValueRepeat); | 4238 value2 = CSSIdentifierValue::create(CSSValueRepeat); |
| 4233 implicit = true; | 4239 implicit = true; |
| 4234 return true; | 4240 return true; |
| 4235 } | 4241 } |
| 4236 value1 = consumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSVa
lueSpace>(range); | 4242 value1 = consumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSVa
lueSpace>(range); |
| 4237 if (!value1) | 4243 if (!value1) |
| 4238 return false; | 4244 return false; |
| 4239 | 4245 |
| 4240 value2 = consumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSVa
lueSpace>(range); | 4246 value2 = consumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSVa
lueSpace>(range); |
| 4241 if (!value2) { | 4247 if (!value2) { |
| 4242 value2 = value1; | 4248 value2 = value1; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4348 CSSValue* startValue = consumeGridLine(m_range); | 4354 CSSValue* startValue = consumeGridLine(m_range); |
| 4349 if (!startValue) | 4355 if (!startValue) |
| 4350 return false; | 4356 return false; |
| 4351 | 4357 |
| 4352 CSSValue* endValue = nullptr; | 4358 CSSValue* endValue = nullptr; |
| 4353 if (consumeSlashIncludingWhitespace(m_range)) { | 4359 if (consumeSlashIncludingWhitespace(m_range)) { |
| 4354 endValue = consumeGridLine(m_range); | 4360 endValue = consumeGridLine(m_range); |
| 4355 if (!endValue) | 4361 if (!endValue) |
| 4356 return false; | 4362 return false; |
| 4357 } else { | 4363 } else { |
| 4358 endValue = startValue->isCustomIdentValue() ? startValue : CSSPrimitiveV
alue::createIdentifier(CSSValueAuto); | 4364 endValue = startValue->isCustomIdentValue() ? startValue : CSSIdentifier
Value::create(CSSValueAuto); |
| 4359 } | 4365 } |
| 4360 if (!m_range.atEnd()) | 4366 if (!m_range.atEnd()) |
| 4361 return false; | 4367 return false; |
| 4362 addProperty(shorthand.properties()[0], shorthandId, *startValue, important); | 4368 addProperty(shorthand.properties()[0], shorthandId, *startValue, important); |
| 4363 addProperty(shorthand.properties()[1], shorthandId, *endValue, important); | 4369 addProperty(shorthand.properties()[1], shorthandId, *endValue, important); |
| 4364 return true; | 4370 return true; |
| 4365 } | 4371 } |
| 4366 | 4372 |
| 4367 bool CSSPropertyParser::consumeGridAreaShorthand(bool important) | 4373 bool CSSPropertyParser::consumeGridAreaShorthand(bool important) |
| 4368 { | 4374 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4385 if (consumeSlashIncludingWhitespace(m_range)) { | 4391 if (consumeSlashIncludingWhitespace(m_range)) { |
| 4386 columnEndValue = consumeGridLine(m_range); | 4392 columnEndValue = consumeGridLine(m_range); |
| 4387 if (!columnEndValue) | 4393 if (!columnEndValue) |
| 4388 return false; | 4394 return false; |
| 4389 } | 4395 } |
| 4390 } | 4396 } |
| 4391 } | 4397 } |
| 4392 if (!m_range.atEnd()) | 4398 if (!m_range.atEnd()) |
| 4393 return false; | 4399 return false; |
| 4394 if (!columnStartValue) | 4400 if (!columnStartValue) |
| 4395 columnStartValue = rowStartValue->isCustomIdentValue() ? rowStartValue :
CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 4401 columnStartValue = rowStartValue->isCustomIdentValue() ? rowStartValue :
CSSIdentifierValue::create(CSSValueAuto); |
| 4396 if (!rowEndValue) | 4402 if (!rowEndValue) |
| 4397 rowEndValue = rowStartValue->isCustomIdentValue() ? rowStartValue : CSSP
rimitiveValue::createIdentifier(CSSValueAuto); | 4403 rowEndValue = rowStartValue->isCustomIdentValue() ? rowStartValue : CSSI
dentifierValue::create(CSSValueAuto); |
| 4398 if (!columnEndValue) | 4404 if (!columnEndValue) |
| 4399 columnEndValue = columnStartValue->isCustomIdentValue() ? columnStartVal
ue : CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 4405 columnEndValue = columnStartValue->isCustomIdentValue() ? columnStartVal
ue : CSSIdentifierValue::create(CSSValueAuto); |
| 4400 | 4406 |
| 4401 addProperty(CSSPropertyGridRowStart, CSSPropertyGridArea, *rowStartValue, im
portant); | 4407 addProperty(CSSPropertyGridRowStart, CSSPropertyGridArea, *rowStartValue, im
portant); |
| 4402 addProperty(CSSPropertyGridColumnStart, CSSPropertyGridArea, *columnStartVal
ue, important); | 4408 addProperty(CSSPropertyGridColumnStart, CSSPropertyGridArea, *columnStartVal
ue, important); |
| 4403 addProperty(CSSPropertyGridRowEnd, CSSPropertyGridArea, *rowEndValue, import
ant); | 4409 addProperty(CSSPropertyGridRowEnd, CSSPropertyGridArea, *rowEndValue, import
ant); |
| 4404 addProperty(CSSPropertyGridColumnEnd, CSSPropertyGridArea, *columnEndValue,
important); | 4410 addProperty(CSSPropertyGridColumnEnd, CSSPropertyGridArea, *columnEndValue,
important); |
| 4405 return true; | 4411 return true; |
| 4406 } | 4412 } |
| 4407 | 4413 |
| 4408 bool CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns(CSSPropertyID
shorthandId, bool important) | 4414 bool CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns(CSSPropertyID
shorthandId, bool important) |
| 4409 { | 4415 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4424 templateRows->append(*lineNames); | 4430 templateRows->append(*lineNames); |
| 4425 | 4431 |
| 4426 // Handle a template-area's row. | 4432 // Handle a template-area's row. |
| 4427 if (m_range.peek().type() != StringToken || !parseGridTemplateAreasRow(m
_range.consumeIncludingWhitespace().value().toString(), gridAreaMap, rowCount, c
olumnCount)) | 4433 if (m_range.peek().type() != StringToken || !parseGridTemplateAreasRow(m
_range.consumeIncludingWhitespace().value().toString(), gridAreaMap, rowCount, c
olumnCount)) |
| 4428 return false; | 4434 return false; |
| 4429 ++rowCount; | 4435 ++rowCount; |
| 4430 | 4436 |
| 4431 // Handle template-rows's track-size. | 4437 // Handle template-rows's track-size. |
| 4432 CSSValue* value = consumeGridTrackSize(m_range, m_context.mode()); | 4438 CSSValue* value = consumeGridTrackSize(m_range, m_context.mode()); |
| 4433 if (!value) | 4439 if (!value) |
| 4434 value = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 4440 value = CSSIdentifierValue::create(CSSValueAuto); |
| 4435 templateRows->append(*value); | 4441 templateRows->append(*value); |
| 4436 | 4442 |
| 4437 // This will handle the trailing/leading <custom-ident>* in the grammar. | 4443 // This will handle the trailing/leading <custom-ident>* in the grammar. |
| 4438 lineNames = consumeGridLineNames(m_range); | 4444 lineNames = consumeGridLineNames(m_range); |
| 4439 if (lineNames) | 4445 if (lineNames) |
| 4440 templateRows->append(*lineNames); | 4446 templateRows->append(*lineNames); |
| 4441 } while (!m_range.atEnd() && !(m_range.peek().type() == DelimiterToken && m_
range.peek().delimiter() == '/')); | 4447 } while (!m_range.atEnd() && !(m_range.peek().type() == DelimiterToken && m_
range.peek().delimiter() == '/')); |
| 4442 | 4448 |
| 4443 CSSValue* columnsValue = nullptr; | 4449 CSSValue* columnsValue = nullptr; |
| 4444 if (!m_range.atEnd()) { | 4450 if (!m_range.atEnd()) { |
| 4445 if (!consumeSlashIncludingWhitespace(m_range)) | 4451 if (!consumeSlashIncludingWhitespace(m_range)) |
| 4446 return false; | 4452 return false; |
| 4447 columnsValue = consumeGridTrackList(m_range, m_context.mode(), GridTempl
ateNoRepeat); | 4453 columnsValue = consumeGridTrackList(m_range, m_context.mode(), GridTempl
ateNoRepeat); |
| 4448 if (!columnsValue || !m_range.atEnd()) | 4454 if (!columnsValue || !m_range.atEnd()) |
| 4449 return false; | 4455 return false; |
| 4450 } else { | 4456 } else { |
| 4451 columnsValue = CSSPrimitiveValue::createIdentifier(CSSValueNone); | 4457 columnsValue = CSSIdentifierValue::create(CSSValueNone); |
| 4452 } | 4458 } |
| 4453 addProperty(CSSPropertyGridTemplateRows, shorthandId, *templateRows, importa
nt); | 4459 addProperty(CSSPropertyGridTemplateRows, shorthandId, *templateRows, importa
nt); |
| 4454 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *columnsValue, impo
rtant); | 4460 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *columnsValue, impo
rtant); |
| 4455 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSGridTemplateAreas
Value::create(gridAreaMap, rowCount, columnCount), important); | 4461 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSGridTemplateAreas
Value::create(gridAreaMap, rowCount, columnCount), important); |
| 4456 return true; | 4462 return true; |
| 4457 } | 4463 } |
| 4458 | 4464 |
| 4459 bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId,
bool important) | 4465 bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId,
bool important) |
| 4460 { | 4466 { |
| 4461 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 4467 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 4462 ASSERT(gridTemplateShorthand().length() == 3); | 4468 ASSERT(gridTemplateShorthand().length() == 3); |
| 4463 | 4469 |
| 4464 CSSParserTokenRange rangeCopy = m_range; | 4470 CSSParserTokenRange rangeCopy = m_range; |
| 4465 CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range); | 4471 CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range); |
| 4466 | 4472 |
| 4467 // 1- 'none' case. | 4473 // 1- 'none' case. |
| 4468 if (rowsValue && m_range.atEnd()) { | 4474 if (rowsValue && m_range.atEnd()) { |
| 4469 addProperty(CSSPropertyGridTemplateRows, shorthandId, *CSSPrimitiveValue
::createIdentifier(CSSValueNone), important); | 4475 addProperty(CSSPropertyGridTemplateRows, shorthandId, *CSSIdentifierValu
e::create(CSSValueNone), important); |
| 4470 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *CSSPrimitiveVa
lue::createIdentifier(CSSValueNone), important); | 4476 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *CSSIdentifierV
alue::create(CSSValueNone), important); |
| 4471 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSPrimitiveValu
e::createIdentifier(CSSValueNone), important); | 4477 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSIdentifierVal
ue::create(CSSValueNone), important); |
| 4472 return true; | 4478 return true; |
| 4473 } | 4479 } |
| 4474 | 4480 |
| 4475 // 2- <grid-template-rows> / <grid-template-columns> | 4481 // 2- <grid-template-rows> / <grid-template-columns> |
| 4476 if (!rowsValue) | 4482 if (!rowsValue) |
| 4477 rowsValue = consumeGridTrackList(m_range, m_context.mode(), GridTemplate
); | 4483 rowsValue = consumeGridTrackList(m_range, m_context.mode(), GridTemplate
); |
| 4478 | 4484 |
| 4479 if (rowsValue) { | 4485 if (rowsValue) { |
| 4480 if (!consumeSlashIncludingWhitespace(m_range)) | 4486 if (!consumeSlashIncludingWhitespace(m_range)) |
| 4481 return false; | 4487 return false; |
| 4482 CSSValue* columnsValue = consumeGridTemplatesRowsOrColumns(m_range, m_co
ntext.mode()); | 4488 CSSValue* columnsValue = consumeGridTemplatesRowsOrColumns(m_range, m_co
ntext.mode()); |
| 4483 if (!columnsValue || !m_range.atEnd()) | 4489 if (!columnsValue || !m_range.atEnd()) |
| 4484 return false; | 4490 return false; |
| 4485 | 4491 |
| 4486 addProperty(CSSPropertyGridTemplateRows, shorthandId, *rowsValue, import
ant); | 4492 addProperty(CSSPropertyGridTemplateRows, shorthandId, *rowsValue, import
ant); |
| 4487 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *columnsValue,
important); | 4493 addProperty(CSSPropertyGridTemplateColumns, shorthandId, *columnsValue,
important); |
| 4488 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSPrimitiveValu
e::createIdentifier(CSSValueNone), important); | 4494 addProperty(CSSPropertyGridTemplateAreas, shorthandId, *CSSIdentifierVal
ue::create(CSSValueNone), important); |
| 4489 return true; | 4495 return true; |
| 4490 } | 4496 } |
| 4491 | 4497 |
| 4492 // 3- [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <track-lis
t> ]? | 4498 // 3- [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <track-lis
t> ]? |
| 4493 m_range = rangeCopy; | 4499 m_range = rangeCopy; |
| 4494 return consumeGridTemplateRowsAndAreasAndColumns(shorthandId, important); | 4500 return consumeGridTemplateRowsAndAreasAndColumns(shorthandId, important); |
| 4495 } | 4501 } |
| 4496 | 4502 |
| 4497 static CSSValueList* consumeImplicitAutoFlow(CSSParserTokenRange& range, const C
SSValue& flowDirection) | 4503 static CSSValueList* consumeImplicitAutoFlow(CSSParserTokenRange& range, const C
SSValue& flowDirection) |
| 4498 { | 4504 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4535 | 4541 |
| 4536 m_range = rangeCopy; | 4542 m_range = rangeCopy; |
| 4537 | 4543 |
| 4538 CSSValue* autoColumnsValue = nullptr; | 4544 CSSValue* autoColumnsValue = nullptr; |
| 4539 CSSValue* autoRowsValue = nullptr; | 4545 CSSValue* autoRowsValue = nullptr; |
| 4540 CSSValue* templateRows = nullptr; | 4546 CSSValue* templateRows = nullptr; |
| 4541 CSSValue* templateColumns = nullptr; | 4547 CSSValue* templateColumns = nullptr; |
| 4542 CSSValueList* gridAutoFlow = nullptr; | 4548 CSSValueList* gridAutoFlow = nullptr; |
| 4543 if (identMatches<CSSValueDense, CSSValueAutoFlow>(m_range.peek().id())) { | 4549 if (identMatches<CSSValueDense, CSSValueAutoFlow>(m_range.peek().id())) { |
| 4544 // 2- [ auto-flow && dense? ] <grid-auto-rows>? / <grid-template-columns
> | 4550 // 2- [ auto-flow && dense? ] <grid-auto-rows>? / <grid-template-columns
> |
| 4545 gridAutoFlow = consumeImplicitAutoFlow(m_range, *CSSPrimitiveValue::crea
teIdentifier(CSSValueRow)); | 4551 gridAutoFlow = consumeImplicitAutoFlow(m_range, *CSSIdentifierValue::cre
ate(CSSValueRow)); |
| 4546 if (!gridAutoFlow) | 4552 if (!gridAutoFlow) |
| 4547 return false; | 4553 return false; |
| 4548 if (consumeSlashIncludingWhitespace(m_range)) { | 4554 if (consumeSlashIncludingWhitespace(m_range)) { |
| 4549 autoRowsValue = CSSInitialValue::createLegacyImplicit(); | 4555 autoRowsValue = CSSInitialValue::createLegacyImplicit(); |
| 4550 } else { | 4556 } else { |
| 4551 autoRowsValue = consumeGridTrackList(m_range, m_context.mode(), Grid
Auto); | 4557 autoRowsValue = consumeGridTrackList(m_range, m_context.mode(), Grid
Auto); |
| 4552 if (!autoRowsValue) | 4558 if (!autoRowsValue) |
| 4553 return false; | 4559 return false; |
| 4554 if (!consumeSlashIncludingWhitespace(m_range)) | 4560 if (!consumeSlashIncludingWhitespace(m_range)) |
| 4555 return false; | 4561 return false; |
| 4556 } | 4562 } |
| 4557 if (!(templateColumns = consumeGridTemplatesRowsOrColumns(m_range, m_con
text.mode()))) | 4563 if (!(templateColumns = consumeGridTemplatesRowsOrColumns(m_range, m_con
text.mode()))) |
| 4558 return false; | 4564 return false; |
| 4559 templateRows = CSSInitialValue::createLegacyImplicit(); | 4565 templateRows = CSSInitialValue::createLegacyImplicit(); |
| 4560 autoColumnsValue = CSSInitialValue::createLegacyImplicit(); | 4566 autoColumnsValue = CSSInitialValue::createLegacyImplicit(); |
| 4561 } else { | 4567 } else { |
| 4562 // 3- <grid-template-rows> / [ auto-flow && dense? ] <grid-auto-columns>
? | 4568 // 3- <grid-template-rows> / [ auto-flow && dense? ] <grid-auto-columns>
? |
| 4563 templateRows = consumeGridTemplatesRowsOrColumns(m_range, m_context.mode
()); | 4569 templateRows = consumeGridTemplatesRowsOrColumns(m_range, m_context.mode
()); |
| 4564 if (!templateRows) | 4570 if (!templateRows) |
| 4565 return false; | 4571 return false; |
| 4566 if (!consumeSlashIncludingWhitespace(m_range)) | 4572 if (!consumeSlashIncludingWhitespace(m_range)) |
| 4567 return false; | 4573 return false; |
| 4568 gridAutoFlow = consumeImplicitAutoFlow(m_range, *CSSPrimitiveValue::crea
teIdentifier(CSSValueColumn)); | 4574 gridAutoFlow = consumeImplicitAutoFlow(m_range, *CSSIdentifierValue::cre
ate(CSSValueColumn)); |
| 4569 if (!gridAutoFlow) | 4575 if (!gridAutoFlow) |
| 4570 return false; | 4576 return false; |
| 4571 if (m_range.atEnd()) { | 4577 if (m_range.atEnd()) { |
| 4572 autoColumnsValue = CSSInitialValue::createLegacyImplicit(); | 4578 autoColumnsValue = CSSInitialValue::createLegacyImplicit(); |
| 4573 } else { | 4579 } else { |
| 4574 autoColumnsValue = consumeGridTrackList(m_range, m_context.mode(), G
ridAuto); | 4580 autoColumnsValue = consumeGridTrackList(m_range, m_context.mode(), G
ridAuto); |
| 4575 if (!autoColumnsValue) | 4581 if (!autoColumnsValue) |
| 4576 return false; | 4582 return false; |
| 4577 } | 4583 } |
| 4578 templateColumns = CSSInitialValue::createLegacyImplicit(); | 4584 templateColumns = CSSInitialValue::createLegacyImplicit(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4597 | 4603 |
| 4598 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im
portant) | 4604 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im
portant) |
| 4599 { | 4605 { |
| 4600 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 4606 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
| 4601 | 4607 |
| 4602 switch (property) { | 4608 switch (property) { |
| 4603 case CSSPropertyWebkitMarginCollapse: { | 4609 case CSSPropertyWebkitMarginCollapse: { |
| 4604 CSSValueID id = m_range.consumeIncludingWhitespace().id(); | 4610 CSSValueID id = m_range.consumeIncludingWhitespace().id(); |
| 4605 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebki
tMarginBeforeCollapse, id, m_context.mode())) | 4611 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebki
tMarginBeforeCollapse, id, m_context.mode())) |
| 4606 return false; | 4612 return false; |
| 4607 CSSValue* beforeCollapse = CSSPrimitiveValue::createIdentifier(id); | 4613 CSSValue* beforeCollapse = CSSIdentifierValue::create(id); |
| 4608 addProperty(CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarg
inCollapse, *beforeCollapse, important); | 4614 addProperty(CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarg
inCollapse, *beforeCollapse, important); |
| 4609 if (m_range.atEnd()) { | 4615 if (m_range.atEnd()) { |
| 4610 addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitM
arginCollapse, *beforeCollapse, important); | 4616 addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitM
arginCollapse, *beforeCollapse, important); |
| 4611 return true; | 4617 return true; |
| 4612 } | 4618 } |
| 4613 id = m_range.consumeIncludingWhitespace().id(); | 4619 id = m_range.consumeIncludingWhitespace().id(); |
| 4614 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebki
tMarginAfterCollapse, id, m_context.mode())) | 4620 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebki
tMarginAfterCollapse, id, m_context.mode())) |
| 4615 return false; | 4621 return false; |
| 4616 addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMargi
nCollapse, *CSSPrimitiveValue::createIdentifier(id), important); | 4622 addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMargi
nCollapse, *CSSIdentifierValue::create(id), important); |
| 4617 return true; | 4623 return true; |
| 4618 } | 4624 } |
| 4619 case CSSPropertyOverflow: { | 4625 case CSSPropertyOverflow: { |
| 4620 CSSValueID id = m_range.consumeIncludingWhitespace().id(); | 4626 CSSValueID id = m_range.consumeIncludingWhitespace().id(); |
| 4621 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyOverf
lowY, id, m_context.mode())) | 4627 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyOverf
lowY, id, m_context.mode())) |
| 4622 return false; | 4628 return false; |
| 4623 if (!m_range.atEnd()) | 4629 if (!m_range.atEnd()) |
| 4624 return false; | 4630 return false; |
| 4625 CSSValue* overflowYValue = CSSPrimitiveValue::createIdentifier(id); | 4631 CSSValue* overflowYValue = CSSIdentifierValue::create(id); |
| 4626 | 4632 |
| 4627 CSSValue* overflowXValue = nullptr; | 4633 CSSValue* overflowXValue = nullptr; |
| 4628 | 4634 |
| 4629 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I
f this value has been | 4635 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I
f this value has been |
| 4630 // set using the shorthand, then for now overflow-x will default to auto
, but once we implement | 4636 // set using the shorthand, then for now overflow-x will default to auto
, but once we implement |
| 4631 // pagination controls, it should default to hidden. If the overflow-y v
alue is anything but | 4637 // pagination controls, it should default to hidden. If the overflow-y v
alue is anything but |
| 4632 // paged-x or paged-y, then overflow-x and overflow-y should have the sa
me value. | 4638 // paged-x or paged-y, then overflow-x and overflow-y should have the sa
me value. |
| 4633 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) | 4639 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) |
| 4634 overflowXValue = CSSPrimitiveValue::createIdentifier(CSSValueAuto); | 4640 overflowXValue = CSSIdentifierValue::create(CSSValueAuto); |
| 4635 else | 4641 else |
| 4636 overflowXValue = overflowYValue; | 4642 overflowXValue = overflowYValue; |
| 4637 addProperty(CSSPropertyOverflowX, CSSPropertyOverflow, *overflowXValue,
important); | 4643 addProperty(CSSPropertyOverflowX, CSSPropertyOverflow, *overflowXValue,
important); |
| 4638 addProperty(CSSPropertyOverflowY, CSSPropertyOverflow, *overflowYValue,
important); | 4644 addProperty(CSSPropertyOverflowY, CSSPropertyOverflow, *overflowYValue,
important); |
| 4639 return true; | 4645 return true; |
| 4640 } | 4646 } |
| 4641 case CSSPropertyFont: { | 4647 case CSSPropertyFont: { |
| 4642 const CSSParserToken& token = m_range.peek(); | 4648 const CSSParserToken& token = m_range.peek(); |
| 4643 if (token.id() >= CSSValueCaption && token.id() <= CSSValueStatusBar) | 4649 if (token.id() >= CSSValueCaption && token.id() <= CSSValueStatusBar) |
| 4644 return consumeSystemFont(important); | 4650 return consumeSystemFont(important); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4690 } | 4696 } |
| 4691 case CSSPropertyFlex: | 4697 case CSSPropertyFlex: |
| 4692 return consumeFlex(important); | 4698 return consumeFlex(important); |
| 4693 case CSSPropertyFlexFlow: | 4699 case CSSPropertyFlexFlow: |
| 4694 return consumeShorthandGreedily(flexFlowShorthand(), important); | 4700 return consumeShorthandGreedily(flexFlowShorthand(), important); |
| 4695 case CSSPropertyColumnRule: | 4701 case CSSPropertyColumnRule: |
| 4696 return consumeShorthandGreedily(columnRuleShorthand(), important); | 4702 return consumeShorthandGreedily(columnRuleShorthand(), important); |
| 4697 case CSSPropertyListStyle: | 4703 case CSSPropertyListStyle: |
| 4698 return consumeShorthandGreedily(listStyleShorthand(), important); | 4704 return consumeShorthandGreedily(listStyleShorthand(), important); |
| 4699 case CSSPropertyBorderRadius: { | 4705 case CSSPropertyBorderRadius: { |
| 4700 CSSPrimitiveValue* horizontalRadii[4] = { 0 }; | 4706 CSSValue* horizontalRadii[4] = { 0 }; |
| 4701 CSSPrimitiveValue* verticalRadii[4] = { 0 }; | 4707 CSSValue* verticalRadii[4] = { 0 }; |
| 4702 if (!consumeRadii(horizontalRadii, verticalRadii, m_range, m_context.mod
e(), unresolvedProperty == CSSPropertyAliasWebkitBorderRadius)) | 4708 if (!consumeRadii(horizontalRadii, verticalRadii, m_range, m_context.mod
e(), unresolvedProperty == CSSPropertyAliasWebkitBorderRadius)) |
| 4703 return false; | 4709 return false; |
| 4704 addProperty(CSSPropertyBorderTopLeftRadius, CSSPropertyBorderRadius, *CS
SValuePair::create(horizontalRadii[0], verticalRadii[0], CSSValuePair::DropIdent
icalValues), important); | 4710 addProperty(CSSPropertyBorderTopLeftRadius, CSSPropertyBorderRadius, *CS
SValuePair::create(horizontalRadii[0], verticalRadii[0], CSSValuePair::DropIdent
icalValues), important); |
| 4705 addProperty(CSSPropertyBorderTopRightRadius, CSSPropertyBorderRadius, *C
SSValuePair::create(horizontalRadii[1], verticalRadii[1], CSSValuePair::DropIden
ticalValues), important); | 4711 addProperty(CSSPropertyBorderTopRightRadius, CSSPropertyBorderRadius, *C
SSValuePair::create(horizontalRadii[1], verticalRadii[1], CSSValuePair::DropIden
ticalValues), important); |
| 4706 addProperty(CSSPropertyBorderBottomRightRadius, CSSPropertyBorderRadius,
*CSSValuePair::create(horizontalRadii[2], verticalRadii[2], CSSValuePair::DropI
denticalValues), important); | 4712 addProperty(CSSPropertyBorderBottomRightRadius, CSSPropertyBorderRadius,
*CSSValuePair::create(horizontalRadii[2], verticalRadii[2], CSSValuePair::DropI
denticalValues), important); |
| 4707 addProperty(CSSPropertyBorderBottomLeftRadius, CSSPropertyBorderRadius,
*CSSValuePair::create(horizontalRadii[3], verticalRadii[3], CSSValuePair::DropId
enticalValues), important); | 4713 addProperty(CSSPropertyBorderBottomLeftRadius, CSSPropertyBorderRadius,
*CSSValuePair::create(horizontalRadii[3], verticalRadii[3], CSSValuePair::DropId
enticalValues), important); |
| 4708 return true; | 4714 return true; |
| 4709 } | 4715 } |
| 4710 case CSSPropertyBorderColor: | 4716 case CSSPropertyBorderColor: |
| 4711 return consume4Values(borderColorShorthand(), important); | 4717 return consume4Values(borderColorShorthand(), important); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4778 case CSSPropertyGridTemplate: | 4784 case CSSPropertyGridTemplate: |
| 4779 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 4785 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
| 4780 case CSSPropertyGrid: | 4786 case CSSPropertyGrid: |
| 4781 return consumeGridShorthand(important); | 4787 return consumeGridShorthand(important); |
| 4782 default: | 4788 default: |
| 4783 return false; | 4789 return false; |
| 4784 } | 4790 } |
| 4785 } | 4791 } |
| 4786 | 4792 |
| 4787 } // namespace blink | 4793 } // namespace blink |
| OLD | NEW |