OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/parser/CSSPropertyParserHelpers.h" | 5 #include "core/css/parser/CSSPropertyParserHelpers.h" |
6 | 6 |
7 #include "core/css/CSSCalculationValue.h" | 7 #include "core/css/CSSCalculationValue.h" |
8 #include "core/css/CSSColorValue.h" | 8 #include "core/css/CSSColorValue.h" |
9 #include "core/css/CSSCrossfadeValue.h" | 9 #include "core/css/CSSCrossfadeValue.h" |
10 #include "core/css/CSSGradientValue.h" | 10 #include "core/css/CSSGradientValue.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 return nullptr; | 290 return nullptr; |
291 } | 291 } |
292 CalcParser calcParser(range, valueRange); | 292 CalcParser calcParser(range, valueRange); |
293 if (const CSSCalcValue* calculation = calcParser.value()) { | 293 if (const CSSCalcValue* calculation = calcParser.value()) { |
294 if (calculation->category() == CalcTime) | 294 if (calculation->category() == CalcTime) |
295 return calcParser.consumeValue(); | 295 return calcParser.consumeValue(); |
296 } | 296 } |
297 return nullptr; | 297 return nullptr; |
298 } | 298 } |
299 | 299 |
300 CSSPrimitiveValue* consumeIdent(CSSParserTokenRange& range) | 300 CSSIdentifierValue* consumeIdent(CSSParserTokenRange& range) |
301 { | 301 { |
302 if (range.peek().type() != IdentToken) | 302 if (range.peek().type() != IdentToken) |
303 return nullptr; | 303 return nullptr; |
304 return CSSPrimitiveValue::createIdentifier(range.consumeIncludingWhitespace(
).id()); | 304 return CSSIdentifierValue::create(range.consumeIncludingWhitespace().id()); |
305 } | 305 } |
306 | 306 |
307 CSSPrimitiveValue* consumeIdentRange(CSSParserTokenRange& range, CSSValueID lowe
r, CSSValueID upper) | 307 CSSIdentifierValue* consumeIdentRange(CSSParserTokenRange& range, CSSValueID low
er, CSSValueID upper) |
308 { | 308 { |
309 if (range.peek().id() < lower || range.peek().id() > upper) | 309 if (range.peek().id() < lower || range.peek().id() > upper) |
310 return nullptr; | 310 return nullptr; |
311 return consumeIdent(range); | 311 return consumeIdent(range); |
312 } | 312 } |
313 | 313 |
314 CSSCustomIdentValue* consumeCustomIdent(CSSParserTokenRange& range) | 314 CSSCustomIdentValue* consumeCustomIdent(CSSParserTokenRange& range) |
315 { | 315 { |
316 if (range.peek().type() != IdentToken || isCSSWideKeyword(range.peek().value
())) | 316 if (range.peek().type() != IdentToken || isCSSWideKeyword(range.peek().value
())) |
317 return nullptr; | 317 return nullptr; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 if (!isValueAllowedInMode(id, cssParserMode)) | 483 if (!isValueAllowedInMode(id, cssParserMode)) |
484 return nullptr; | 484 return nullptr; |
485 return consumeIdent(range); | 485 return consumeIdent(range); |
486 } | 486 } |
487 RGBA32 color = Color::transparent; | 487 RGBA32 color = Color::transparent; |
488 if (!parseHexColor(range, color, acceptQuirkyColors) && !parseColorFunction(
range, color)) | 488 if (!parseHexColor(range, color, acceptQuirkyColors) && !parseColorFunction(
range, color)) |
489 return nullptr; | 489 return nullptr; |
490 return CSSColorValue::create(color); | 490 return CSSColorValue::create(color); |
491 } | 491 } |
492 | 492 |
493 static CSSPrimitiveValue* consumePositionComponent(CSSParserTokenRange& range, C
SSParserMode cssParserMode, UnitlessQuirk unitless, bool& horizontalEdge, bool&
verticalEdge) | 493 static CSSValue* consumePositionComponent(CSSParserTokenRange& range, CSSParserM
ode cssParserMode, UnitlessQuirk unitless, bool& horizontalEdge, bool& verticalE
dge) |
494 { | 494 { |
495 if (range.peek().type() != IdentToken) | 495 if (range.peek().type() != IdentToken) |
496 return consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, unitl
ess); | 496 return consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, unitl
ess); |
497 | 497 |
498 CSSValueID id = range.peek().id(); | 498 CSSValueID id = range.peek().id(); |
499 if (id == CSSValueLeft || id == CSSValueRight) { | 499 if (id == CSSValueLeft || id == CSSValueRight) { |
500 if (horizontalEdge) | 500 if (horizontalEdge) |
501 return nullptr; | 501 return nullptr; |
502 horizontalEdge = true; | 502 horizontalEdge = true; |
503 } else if (id == CSSValueTop || id == CSSValueBottom) { | 503 } else if (id == CSSValueTop || id == CSSValueBottom) { |
504 if (verticalEdge) | 504 if (verticalEdge) |
505 return nullptr; | 505 return nullptr; |
506 verticalEdge = true; | 506 verticalEdge = true; |
507 } else if (id != CSSValueCenter) { | 507 } else if (id != CSSValueCenter) { |
508 return nullptr; | 508 return nullptr; |
509 } | 509 } |
510 return consumeIdent(range); | 510 return consumeIdent(range); |
511 } | 511 } |
512 | 512 |
513 static bool isHorizontalPositionKeywordOnly(const CSSPrimitiveValue& value) | 513 static bool isHorizontalPositionKeywordOnly(const CSSValue& value) |
514 { | 514 { |
515 return value.isValueID() && (value.getValueID() == CSSValueLeft || value.get
ValueID() == CSSValueRight); | 515 if (!value.isIdentifierValue()) |
| 516 return false; |
| 517 CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); |
| 518 return valueID == CSSValueLeft || valueID == CSSValueRight; |
516 } | 519 } |
517 | 520 |
518 static bool isVerticalPositionKeywordOnly(const CSSPrimitiveValue& value) | 521 static bool isVerticalPositionKeywordOnly(const CSSValue& value) |
519 { | 522 { |
520 return value.isValueID() && (value.getValueID() == CSSValueTop || value.getV
alueID() == CSSValueBottom); | 523 if (!value.isIdentifierValue()) |
| 524 return false; |
| 525 CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); |
| 526 return valueID == CSSValueTop || valueID == CSSValueBottom; |
521 } | 527 } |
522 | 528 |
523 static void positionFromOneValue(CSSPrimitiveValue* value, CSSValue*& resultX, C
SSValue*& resultY) | 529 static void positionFromOneValue(CSSValue* value, CSSValue*& resultX, CSSValue*&
resultY) |
524 { | 530 { |
525 bool valueAppliesToYAxisOnly = isVerticalPositionKeywordOnly(*value); | 531 bool valueAppliesToYAxisOnly = isVerticalPositionKeywordOnly(*value); |
526 resultX = value; | 532 resultX = value; |
527 resultY = CSSPrimitiveValue::createIdentifier(CSSValueCenter); | 533 resultY = CSSIdentifierValue::create(CSSValueCenter); |
528 if (valueAppliesToYAxisOnly) | 534 if (valueAppliesToYAxisOnly) |
529 std::swap(resultX, resultY); | 535 std::swap(resultX, resultY); |
530 } | 536 } |
531 | 537 |
532 static void positionFromTwoValues(CSSPrimitiveValue* value1, CSSPrimitiveValue*
value2, | 538 static void positionFromTwoValues(CSSValue* value1, CSSValue* value2, |
533 CSSValue*& resultX, CSSValue*& resultY) | 539 CSSValue*& resultX, CSSValue*& resultY) |
534 { | 540 { |
535 bool mustOrderAsXY = isHorizontalPositionKeywordOnly(*value1) || isVerticalP
ositionKeywordOnly(*value2) | 541 bool mustOrderAsXY = isHorizontalPositionKeywordOnly(*value1) || isVerticalP
ositionKeywordOnly(*value2) |
536 || !value1->isValueID() || !value2->isValueID(); | 542 || !value1->isIdentifierValue() || !value2->isIdentifierValue(); |
537 bool mustOrderAsYX = isVerticalPositionKeywordOnly(*value1) || isHorizontalP
ositionKeywordOnly(*value2); | 543 bool mustOrderAsYX = isVerticalPositionKeywordOnly(*value1) || isHorizontalP
ositionKeywordOnly(*value2); |
538 DCHECK(!mustOrderAsXY || !mustOrderAsYX); | 544 DCHECK(!mustOrderAsXY || !mustOrderAsYX); |
539 resultX = value1; | 545 resultX = value1; |
540 resultY = value2; | 546 resultY = value2; |
541 if (mustOrderAsYX) | 547 if (mustOrderAsYX) |
542 std::swap(resultX, resultY); | 548 std::swap(resultX, resultY); |
543 } | 549 } |
544 | 550 |
545 static void positionFromThreeOrFourValues(CSSPrimitiveValue** values, CSSValue*&
resultX, CSSValue*& resultY) | 551 static void positionFromThreeOrFourValues(CSSValue** values, CSSValue*& resultX,
CSSValue*& resultY) |
546 { | 552 { |
547 CSSPrimitiveValue* center = nullptr; | 553 CSSIdentifierValue* center = nullptr; |
548 for (int i = 0; values[i]; i++) { | 554 for (int i = 0; values[i]; i++) { |
549 CSSPrimitiveValue* currentValue = values[i]; | 555 CSSIdentifierValue* currentValue = toCSSIdentifierValue(values[i]); |
550 DCHECK(currentValue->isValueID()); | |
551 CSSValueID id = currentValue->getValueID(); | 556 CSSValueID id = currentValue->getValueID(); |
552 | 557 |
553 if (id == CSSValueCenter) { | 558 if (id == CSSValueCenter) { |
554 DCHECK(!center); | 559 DCHECK(!center); |
555 center = currentValue; | 560 center = currentValue; |
556 continue; | 561 continue; |
557 } | 562 } |
558 | 563 |
559 CSSValue* result = nullptr; | 564 CSSValue* result = nullptr; |
560 if (values[i + 1] && !values[i + 1]->isValueID()) { | 565 if (values[i + 1] && !values[i + 1]->isIdentifierValue()) { |
561 result = CSSValuePair::create(currentValue, values[++i], CSSValuePai
r::KeepIdenticalValues); | 566 result = CSSValuePair::create(currentValue, values[++i], CSSValuePai
r::KeepIdenticalValues); |
562 } else { | 567 } else { |
563 result = currentValue; | 568 result = currentValue; |
564 } | 569 } |
565 | 570 |
566 if (id == CSSValueLeft || id == CSSValueRight) { | 571 if (id == CSSValueLeft || id == CSSValueRight) { |
567 DCHECK(!resultX); | 572 DCHECK(!resultX); |
568 resultX = result; | 573 resultX = result; |
569 } else { | 574 } else { |
570 DCHECK(id == CSSValueTop || id == CSSValueBottom); | 575 DCHECK(id == CSSValueTop || id == CSSValueBottom); |
(...skipping 10 matching lines...) Expand all Loading... |
581 resultY = center; | 586 resultY = center; |
582 } | 587 } |
583 | 588 |
584 DCHECK(resultX && resultY); | 589 DCHECK(resultX && resultY); |
585 } | 590 } |
586 | 591 |
587 bool consumePosition(CSSParserTokenRange& range, CSSParserMode cssParserMode, Un
itlessQuirk unitless, CSSValue*& resultX, CSSValue*& resultY) | 592 bool consumePosition(CSSParserTokenRange& range, CSSParserMode cssParserMode, Un
itlessQuirk unitless, CSSValue*& resultX, CSSValue*& resultY) |
588 { | 593 { |
589 bool horizontalEdge = false; | 594 bool horizontalEdge = false; |
590 bool verticalEdge = false; | 595 bool verticalEdge = false; |
591 CSSPrimitiveValue* value1 = consumePositionComponent(range, cssParserMode, u
nitless, horizontalEdge, verticalEdge); | 596 CSSValue* value1 = consumePositionComponent(range, cssParserMode, unitless,
horizontalEdge, verticalEdge); |
592 if (!value1) | 597 if (!value1) |
593 return false; | 598 return false; |
594 if (!value1->isValueID()) | 599 if (!value1->isIdentifierValue()) |
595 horizontalEdge = true; | 600 horizontalEdge = true; |
596 | 601 |
597 CSSParserTokenRange rangeAfterFirstConsume = range; | 602 CSSParserTokenRange rangeAfterFirstConsume = range; |
598 CSSPrimitiveValue* value2 = consumePositionComponent(range, cssParserMode, u
nitless, horizontalEdge, verticalEdge); | 603 CSSValue* value2 = consumePositionComponent(range, cssParserMode, unitless,
horizontalEdge, verticalEdge); |
599 if (!value2) { | 604 if (!value2) { |
600 positionFromOneValue(value1, resultX, resultY); | 605 positionFromOneValue(value1, resultX, resultY); |
601 return true; | 606 return true; |
602 } | 607 } |
603 | 608 |
604 CSSPrimitiveValue* value3 = nullptr; | 609 CSSValue* value3 = nullptr; |
605 if (value1->isValueID() | 610 if (value1->isIdentifierValue() |
606 && value2->isValueID() != (range.peek().type() == IdentToken) | 611 && value2->isIdentifierValue() != (range.peek().type() == IdentToken) |
607 && (value2->isValueID() ? value2->getValueID() : value1->getValueID()) !
= CSSValueCenter) | 612 && (value2->isIdentifierValue() ? toCSSIdentifierValue(value2)->getValue
ID() : toCSSIdentifierValue(value1)->getValueID()) != CSSValueCenter) |
608 value3 = consumePositionComponent(range, cssParserMode, unitless, horizo
ntalEdge, verticalEdge); | 613 value3 = consumePositionComponent(range, cssParserMode, unitless, horizo
ntalEdge, verticalEdge); |
609 if (!value3) { | 614 if (!value3) { |
610 if (verticalEdge && !value2->isValueID()) { | 615 if (verticalEdge && !value2->isIdentifierValue()) { |
611 range = rangeAfterFirstConsume; | 616 range = rangeAfterFirstConsume; |
612 positionFromOneValue(value1, resultX, resultY); | 617 positionFromOneValue(value1, resultX, resultY); |
613 return true; | 618 return true; |
614 } | 619 } |
615 positionFromTwoValues(value1, value2, resultX, resultY); | 620 positionFromTwoValues(value1, value2, resultX, resultY); |
616 return true; | 621 return true; |
617 } | 622 } |
618 | 623 |
619 CSSPrimitiveValue* value4 = nullptr; | 624 CSSValue* value4 = nullptr; |
620 if (value3->isValueID() && value3->getValueID() != CSSValueCenter && range.p
eek().type() != IdentToken) | 625 if (value3->isIdentifierValue() && toCSSIdentifierValue(value3)->getValueID(
) != CSSValueCenter && range.peek().type() != IdentToken) |
621 value4 = consumePositionComponent(range, cssParserMode, unitless, horizo
ntalEdge, verticalEdge); | 626 value4 = consumePositionComponent(range, cssParserMode, unitless, horizo
ntalEdge, verticalEdge); |
622 CSSPrimitiveValue* values[5]; | 627 CSSValue* values[5]; |
623 values[0] = value1; | 628 values[0] = value1; |
624 values[1] = value2; | 629 values[1] = value2; |
625 values[2] = value3; | 630 values[2] = value3; |
626 values[3] = value4; | 631 values[3] = value4; |
627 values[4] = nullptr; | 632 values[4] = nullptr; |
628 positionFromThreeOrFourValues(values, resultX, resultY); | 633 positionFromThreeOrFourValues(values, resultX, resultY); |
629 return true; | 634 return true; |
630 } | 635 } |
631 | 636 |
632 CSSValuePair* consumePosition(CSSParserTokenRange& range, CSSParserMode cssParse
rMode, UnitlessQuirk unitless) | 637 CSSValuePair* consumePosition(CSSParserTokenRange& range, CSSParserMode cssParse
rMode, UnitlessQuirk unitless) |
633 { | 638 { |
634 CSSValue* resultX = nullptr; | 639 CSSValue* resultX = nullptr; |
635 CSSValue* resultY = nullptr; | 640 CSSValue* resultY = nullptr; |
636 if (consumePosition(range, cssParserMode, unitless, resultX, resultY)) | 641 if (consumePosition(range, cssParserMode, unitless, resultX, resultY)) |
637 return CSSValuePair::create(resultX, resultY, CSSValuePair::KeepIdentica
lValues); | 642 return CSSValuePair::create(resultX, resultY, CSSValuePair::KeepIdentica
lValues); |
638 return nullptr; | 643 return nullptr; |
639 } | 644 } |
640 | 645 |
641 bool consumeOneOrTwoValuedPosition(CSSParserTokenRange& range, CSSParserMode css
ParserMode, UnitlessQuirk unitless, CSSValue*& resultX, CSSValue*& resultY) | 646 bool consumeOneOrTwoValuedPosition(CSSParserTokenRange& range, CSSParserMode css
ParserMode, UnitlessQuirk unitless, CSSValue*& resultX, CSSValue*& resultY) |
642 { | 647 { |
643 bool horizontalEdge = false; | 648 bool horizontalEdge = false; |
644 bool verticalEdge = false; | 649 bool verticalEdge = false; |
645 CSSPrimitiveValue* value1 = consumePositionComponent(range, cssParserMode, u
nitless, horizontalEdge, verticalEdge); | 650 CSSValue* value1 = consumePositionComponent(range, cssParserMode, unitless,
horizontalEdge, verticalEdge); |
646 if (!value1) | 651 if (!value1) |
647 return false; | 652 return false; |
648 if (!value1->isValueID()) | 653 if (!value1->isIdentifierValue()) |
649 horizontalEdge = true; | 654 horizontalEdge = true; |
650 | 655 |
651 CSSPrimitiveValue* value2 = nullptr; | 656 CSSValue* value2 = nullptr; |
652 if (!verticalEdge || range.peek().type() == IdentToken) | 657 if (!verticalEdge || range.peek().type() == IdentToken) |
653 value2 = consumePositionComponent(range, cssParserMode, unitless, horizo
ntalEdge, verticalEdge); | 658 value2 = consumePositionComponent(range, cssParserMode, unitless, horizo
ntalEdge, verticalEdge); |
654 if (!value2) { | 659 if (!value2) { |
655 positionFromOneValue(value1, resultX, resultY); | 660 positionFromOneValue(value1, resultX, resultY); |
656 return true; | 661 return true; |
657 } | 662 } |
658 positionFromTwoValues(value1, value2, resultX, resultY); | 663 positionFromTwoValues(value1, value2, resultX, resultY); |
659 return true; | 664 return true; |
660 } | 665 } |
661 | 666 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 809 |
805 static CSSValue* consumeDeprecatedRadialGradient(CSSParserTokenRange& args, CSSP
arserMode cssParserMode, CSSGradientRepeat repeating) | 810 static CSSValue* consumeDeprecatedRadialGradient(CSSParserTokenRange& args, CSSP
arserMode cssParserMode, CSSGradientRepeat repeating) |
806 { | 811 { |
807 CSSRadialGradientValue* result = CSSRadialGradientValue::create(repeating, C
SSPrefixedRadialGradient); | 812 CSSRadialGradientValue* result = CSSRadialGradientValue::create(repeating, C
SSPrefixedRadialGradient); |
808 CSSValue* centerX = nullptr; | 813 CSSValue* centerX = nullptr; |
809 CSSValue* centerY = nullptr; | 814 CSSValue* centerY = nullptr; |
810 consumeOneOrTwoValuedPosition(args, cssParserMode, UnitlessQuirk::Forbid, ce
nterX, centerY); | 815 consumeOneOrTwoValuedPosition(args, cssParserMode, UnitlessQuirk::Forbid, ce
nterX, centerY); |
811 if ((centerX || centerY) && !consumeCommaIncludingWhitespace(args)) | 816 if ((centerX || centerY) && !consumeCommaIncludingWhitespace(args)) |
812 return nullptr; | 817 return nullptr; |
813 | 818 |
814 result->setFirstX(toCSSPrimitiveValue(centerX)); | 819 result->setFirstX(centerX); |
815 result->setSecondX(toCSSPrimitiveValue(centerX)); | 820 result->setSecondX(centerX); |
816 result->setFirstY(toCSSPrimitiveValue(centerY)); | 821 result->setFirstY(centerY); |
817 result->setSecondY(toCSSPrimitiveValue(centerY)); | 822 result->setSecondY(centerY); |
818 | 823 |
819 CSSPrimitiveValue* shape = consumeIdent<CSSValueCircle, CSSValueEllipse>(arg
s); | 824 CSSIdentifierValue* shape = consumeIdent<CSSValueCircle, CSSValueEllipse>(ar
gs); |
820 CSSPrimitiveValue* sizeKeyword = consumeIdent<CSSValueClosestSide, CSSValueC
losestCorner, CSSValueFarthestSide, CSSValueFarthestCorner, CSSValueContain, CSS
ValueCover>(args); | 825 CSSIdentifierValue* sizeKeyword = consumeIdent<CSSValueClosestSide, CSSValue
ClosestCorner, CSSValueFarthestSide, CSSValueFarthestCorner, CSSValueContain, CS
SValueCover>(args); |
821 if (!shape) | 826 if (!shape) |
822 shape = consumeIdent<CSSValueCircle, CSSValueEllipse>(args); | 827 shape = consumeIdent<CSSValueCircle, CSSValueEllipse>(args); |
823 result->setShape(shape); | 828 result->setShape(shape); |
824 result->setSizingBehavior(sizeKeyword); | 829 result->setSizingBehavior(sizeKeyword); |
825 | 830 |
826 // Or, two lengths or percentages | 831 // Or, two lengths or percentages |
827 if (!shape && !sizeKeyword) { | 832 if (!shape && !sizeKeyword) { |
828 CSSPrimitiveValue* horizontalSize = consumeLengthOrPercent(args, cssPars
erMode, ValueRangeAll); | 833 CSSPrimitiveValue* horizontalSize = consumeLengthOrPercent(args, cssPars
erMode, ValueRangeAll); |
829 CSSPrimitiveValue* verticalSize = nullptr; | 834 CSSPrimitiveValue* verticalSize = nullptr; |
830 if (horizontalSize) { | 835 if (horizontalSize) { |
(...skipping 10 matching lines...) Expand all Loading... |
841 if (!consumeGradientColorStops(args, cssParserMode, result)) | 846 if (!consumeGradientColorStops(args, cssParserMode, result)) |
842 return nullptr; | 847 return nullptr; |
843 | 848 |
844 return result; | 849 return result; |
845 } | 850 } |
846 | 851 |
847 static CSSValue* consumeRadialGradient(CSSParserTokenRange& args, CSSParserMode
cssParserMode, CSSGradientRepeat repeating) | 852 static CSSValue* consumeRadialGradient(CSSParserTokenRange& args, CSSParserMode
cssParserMode, CSSGradientRepeat repeating) |
848 { | 853 { |
849 CSSRadialGradientValue* result = CSSRadialGradientValue::create(repeating, C
SSRadialGradient); | 854 CSSRadialGradientValue* result = CSSRadialGradientValue::create(repeating, C
SSRadialGradient); |
850 | 855 |
851 CSSPrimitiveValue* shape = nullptr; | 856 CSSIdentifierValue* shape = nullptr; |
852 CSSPrimitiveValue* sizeKeyword = nullptr; | 857 CSSIdentifierValue* sizeKeyword = nullptr; |
853 CSSPrimitiveValue* horizontalSize = nullptr; | 858 CSSPrimitiveValue* horizontalSize = nullptr; |
854 CSSPrimitiveValue* verticalSize = nullptr; | 859 CSSPrimitiveValue* verticalSize = nullptr; |
855 | 860 |
856 // First part of grammar, the size/shape clause: | 861 // First part of grammar, the size/shape clause: |
857 // [ circle || <length> ] | | 862 // [ circle || <length> ] | |
858 // [ ellipse || [ <length> | <percentage> ]{2} ] | | 863 // [ ellipse || [ <length> | <percentage> ]{2} ] | |
859 // [ [ circle | ellipse] || <size-keyword> ] | 864 // [ [ circle | ellipse] || <size-keyword> ] |
860 for (int i = 0; i < 3; ++i) { | 865 for (int i = 0; i < 3; ++i) { |
861 if (args.peek().type() == IdentToken) { | 866 if (args.peek().type() == IdentToken) { |
862 CSSValueID id = args.peek().id(); | 867 CSSValueID id = args.peek().id(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 | 935 |
931 static CSSValue* consumeLinearGradient(CSSParserTokenRange& args, CSSParserMode
cssParserMode, CSSGradientRepeat repeating, CSSGradientType gradientType) | 936 static CSSValue* consumeLinearGradient(CSSParserTokenRange& args, CSSParserMode
cssParserMode, CSSGradientRepeat repeating, CSSGradientType gradientType) |
932 { | 937 { |
933 CSSLinearGradientValue* result = CSSLinearGradientValue::create(repeating, g
radientType); | 938 CSSLinearGradientValue* result = CSSLinearGradientValue::create(repeating, g
radientType); |
934 | 939 |
935 bool expectComma = true; | 940 bool expectComma = true; |
936 CSSPrimitiveValue* angle = consumeAngle(args); | 941 CSSPrimitiveValue* angle = consumeAngle(args); |
937 if (angle) { | 942 if (angle) { |
938 result->setAngle(angle); | 943 result->setAngle(angle); |
939 } else if (gradientType == CSSPrefixedLinearGradient || consumeIdent<CSSValu
eTo>(args)) { | 944 } else if (gradientType == CSSPrefixedLinearGradient || consumeIdent<CSSValu
eTo>(args)) { |
940 CSSPrimitiveValue* endX = consumeIdent<CSSValueLeft, CSSValueRight>(args
); | 945 CSSIdentifierValue* endX = consumeIdent<CSSValueLeft, CSSValueRight>(arg
s); |
941 CSSPrimitiveValue* endY = consumeIdent<CSSValueBottom, CSSValueTop>(args
); | 946 CSSIdentifierValue* endY = consumeIdent<CSSValueBottom, CSSValueTop>(arg
s); |
942 if (!endX && !endY) { | 947 if (!endX && !endY) { |
943 if (gradientType == CSSLinearGradient) | 948 if (gradientType == CSSLinearGradient) |
944 return nullptr; | 949 return nullptr; |
945 endY = CSSPrimitiveValue::createIdentifier(CSSValueTop); | 950 endY = CSSIdentifierValue::create(CSSValueTop); |
946 expectComma = false; | 951 expectComma = false; |
947 } else if (!endX) { | 952 } else if (!endX) { |
948 endX = consumeIdent<CSSValueLeft, CSSValueRight>(args); | 953 endX = consumeIdent<CSSValueLeft, CSSValueRight>(args); |
949 } | 954 } |
950 | 955 |
951 result->setFirstX(endX); | 956 result->setFirstX(endX); |
952 result->setFirstY(endY); | 957 result->setFirstY(endY); |
953 } else { | 958 } else { |
954 expectComma = false; | 959 expectComma = false; |
955 } | 960 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 { | 1119 { |
1115 return equalIgnoringASCIICase(keyword, "initial") | 1120 return equalIgnoringASCIICase(keyword, "initial") |
1116 || equalIgnoringASCIICase(keyword, "inherit") | 1121 || equalIgnoringASCIICase(keyword, "inherit") |
1117 || equalIgnoringASCIICase(keyword, "unset") | 1122 || equalIgnoringASCIICase(keyword, "unset") |
1118 || equalIgnoringASCIICase(keyword, "default"); | 1123 || equalIgnoringASCIICase(keyword, "default"); |
1119 } | 1124 } |
1120 | 1125 |
1121 } // namespace CSSPropertyParserHelpers | 1126 } // namespace CSSPropertyParserHelpers |
1122 | 1127 |
1123 } // namespace blink | 1128 } // namespace blink |
OLD | NEW |