OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 if (isKeywordPropertyID(propId)) { | 486 if (isKeywordPropertyID(propId)) { |
487 if (!isValidKeywordPropertyAndValue(propId, id, m_context)) | 487 if (!isValidKeywordPropertyAndValue(propId, id, m_context)) |
488 return false; | 488 return false; |
489 if (m_valueList->next() && !inShorthand()) | 489 if (m_valueList->next() && !inShorthand()) |
490 return false; | 490 return false; |
491 addProperty(propId, cssValuePool().createIdentifierValue(id), important) ; | 491 addProperty(propId, cssValuePool().createIdentifierValue(id), important) ; |
492 return true; | 492 return true; |
493 } | 493 } |
494 | 494 |
495 bool validPrimitive = false; | 495 bool validPrimitive = false; |
496 RefPtrWillBeRawPtr<CSSValue> parsedValue; | 496 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
497 | 497 |
498 switch (propId) { | 498 switch (propId) { |
499 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size > || [ portrait | landscape] ] | 499 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size > || [ portrait | landscape] ] |
500 return parseSize(propId, important); | 500 return parseSize(propId, important); |
501 | 501 |
502 case CSSPropertyQuotes: // [<string> <string>]+ | none | inher it | 502 case CSSPropertyQuotes: // [<string> <string>]+ | none | inher it |
503 if (id) | 503 if (id) |
504 validPrimitive = true; | 504 validPrimitive = true; |
505 else | 505 else |
506 return parseQuotes(propId, important); | 506 return parseQuotes(propId, important); |
(...skipping 20 matching lines...) Expand all Loading... | |
527 break; | 527 break; |
528 | 528 |
529 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work | 529 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work |
530 * correctly and allows optimization in WebCore::applyRule(..) | 530 * correctly and allows optimization in WebCore::applyRule(..) |
531 */ | 531 */ |
532 case CSSPropertyOverflow: { | 532 case CSSPropertyOverflow: { |
533 ShorthandScope scope(this, propId); | 533 ShorthandScope scope(this, propId); |
534 if (num != 1 || !parseValue(CSSPropertyOverflowY, important)) | 534 if (num != 1 || !parseValue(CSSPropertyOverflowY, important)) |
535 return false; | 535 return false; |
536 | 536 |
537 RefPtrWillBeRawPtr<CSSValue> overflowXValue; | 537 RefPtrWillBeRawPtr<CSSValue> overflowXValue = nullptr; |
538 | 538 |
539 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I f this value has been | 539 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I f this value has been |
540 // set using the shorthand, then for now overflow-x will default to auto , but once we implement | 540 // set using the shorthand, then for now overflow-x will default to auto , but once we implement |
541 // pagination controls, it should default to hidden. If the overflow-y v alue is anything but | 541 // pagination controls, it should default to hidden. If the overflow-y v alue is anything but |
542 // paged-x or paged-y, then overflow-x and overflow-y should have the sa me value. | 542 // paged-x or paged-y, then overflow-x and overflow-y should have the sa me value. |
543 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) | 543 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) |
544 overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto); | 544 overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto); |
545 else | 545 else |
546 overflowXValue = m_parsedProperties.last().value(); | 546 overflowXValue = m_parsedProperties.last().value(); |
547 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important); | 547 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 break; | 622 break; |
623 | 623 |
624 case CSSPropertyCursor: { | 624 case CSSPropertyCursor: { |
625 // Grammar defined by CSS3 UI and modified by CSS4 images: | 625 // Grammar defined by CSS3 UI and modified by CSS4 images: |
626 // [ [<image> [<x> <y>]?,]* | 626 // [ [<image> [<x> <y>]?,]* |
627 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize | | 627 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize | |
628 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize | | 628 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize | |
629 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex t | wait | help | | 629 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex t | wait | help | |
630 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al lowed | -webkit-zoom-in | 630 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al lowed | -webkit-zoom-in |
631 // -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit | 631 // -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit |
632 RefPtrWillBeRawPtr<CSSValueList> list; | 632 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; |
633 while (value) { | 633 while (value) { |
634 RefPtrWillBeRawPtr<CSSValue> image = nullptr; | 634 RefPtrWillBeRawPtr<CSSValue> image = nullptr; |
635 if (value->unit == CSSPrimitiveValue::CSS_URI) { | 635 if (value->unit == CSSPrimitiveValue::CSS_URI) { |
636 String uri = value->string; | 636 String uri = value->string; |
637 if (!uri.isNull()) | 637 if (!uri.isNull()) |
638 image = CSSImageValue::create(uri, completeURL(uri)); | 638 image = CSSImageValue::create(uri, completeURL(uri)); |
639 } else if (value->unit == CSSParserValue::Function && equalIgnoringC ase(value->function->name, "-webkit-image-set(")) { | 639 } else if (value->unit == CSSParserValue::Function && equalIgnoringC ase(value->function->name, "-webkit-image-set(")) { |
640 image = parseImageSet(m_valueList.get()); | 640 image = parseImageSet(m_valueList.get()); |
641 if (!image) | 641 if (!image) |
642 break; | 642 break; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
715 case CSSPropertyWebkitMaskImage: | 715 case CSSPropertyWebkitMaskImage: |
716 case CSSPropertyWebkitMaskOrigin: | 716 case CSSPropertyWebkitMaskOrigin: |
717 case CSSPropertyWebkitMaskPosition: | 717 case CSSPropertyWebkitMaskPosition: |
718 case CSSPropertyWebkitMaskPositionX: | 718 case CSSPropertyWebkitMaskPositionX: |
719 case CSSPropertyWebkitMaskPositionY: | 719 case CSSPropertyWebkitMaskPositionY: |
720 case CSSPropertyWebkitMaskSize: | 720 case CSSPropertyWebkitMaskSize: |
721 case CSSPropertyWebkitMaskRepeat: | 721 case CSSPropertyWebkitMaskRepeat: |
722 case CSSPropertyWebkitMaskRepeatX: | 722 case CSSPropertyWebkitMaskRepeatX: |
723 case CSSPropertyWebkitMaskRepeatY: | 723 case CSSPropertyWebkitMaskRepeatY: |
724 { | 724 { |
725 RefPtrWillBeRawPtr<CSSValue> val1; | 725 RefPtrWillBeRawPtr<CSSValue> val1 = nullptr; |
726 RefPtrWillBeRawPtr<CSSValue> val2; | 726 RefPtrWillBeRawPtr<CSSValue> val2 = nullptr; |
727 CSSPropertyID propId1, propId2; | 727 CSSPropertyID propId1, propId2; |
728 bool result = false; | 728 bool result = false; |
729 if (parseFillProperty(propId, propId1, propId2, val1, val2)) { | 729 if (parseFillProperty(propId, propId1, propId2, val1, val2)) { |
730 OwnPtr<ShorthandScope> shorthandScope; | 730 OwnPtr<ShorthandScope> shorthandScope; |
731 if (propId == CSSPropertyBackgroundPosition || | 731 if (propId == CSSPropertyBackgroundPosition || |
732 propId == CSSPropertyBackgroundRepeat || | 732 propId == CSSPropertyBackgroundRepeat || |
733 propId == CSSPropertyWebkitMaskPosition || | 733 propId == CSSPropertyWebkitMaskPosition || |
734 propId == CSSPropertyWebkitMaskRepeat) { | 734 propId == CSSPropertyWebkitMaskRepeat) { |
735 shorthandScope = adoptPtr(new ShorthandScope(this, propId)); | 735 shorthandScope = adoptPtr(new ShorthandScope(this, propId)); |
736 } | 736 } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
942 case CSSPropertyWebkitBorderImage: { | 942 case CSSPropertyWebkitBorderImage: { |
943 if (RefPtrWillBeRawPtr<CSSValue> result = parseBorderImage(propId)) { | 943 if (RefPtrWillBeRawPtr<CSSValue> result = parseBorderImage(propId)) { |
944 addProperty(propId, result, important); | 944 addProperty(propId, result, important); |
945 return true; | 945 return true; |
946 } | 946 } |
947 return false; | 947 return false; |
948 } | 948 } |
949 | 949 |
950 case CSSPropertyBorderImageOutset: | 950 case CSSPropertyBorderImageOutset: |
951 case CSSPropertyWebkitMaskBoxImageOutset: { | 951 case CSSPropertyWebkitMaskBoxImageOutset: { |
952 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; | 952 RefPtrWillBeRawPtr<CSSPrimitiveValue> result = nullptr; |
953 if (parseBorderImageOutset(result)) { | 953 if (parseBorderImageOutset(result)) { |
954 addProperty(propId, result, important); | 954 addProperty(propId, result, important); |
955 return true; | 955 return true; |
956 } | 956 } |
957 break; | 957 break; |
958 } | 958 } |
959 case CSSPropertyBorderImageRepeat: | 959 case CSSPropertyBorderImageRepeat: |
960 case CSSPropertyWebkitMaskBoxImageRepeat: { | 960 case CSSPropertyWebkitMaskBoxImageRepeat: { |
961 RefPtrWillBeRawPtr<CSSValue> result; | 961 RefPtrWillBeRawPtr<CSSValue> result = nullptr; |
962 if (parseBorderImageRepeat(result)) { | 962 if (parseBorderImageRepeat(result)) { |
963 addProperty(propId, result, important); | 963 addProperty(propId, result, important); |
964 return true; | 964 return true; |
965 } | 965 } |
966 break; | 966 break; |
967 } | 967 } |
968 case CSSPropertyBorderImageSlice: | 968 case CSSPropertyBorderImageSlice: |
969 case CSSPropertyWebkitMaskBoxImageSlice: { | 969 case CSSPropertyWebkitMaskBoxImageSlice: { |
970 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result; | 970 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result = nullptr; |
971 if (parseBorderImageSlice(propId, result)) { | 971 if (parseBorderImageSlice(propId, result)) { |
972 addProperty(propId, result, important); | 972 addProperty(propId, result, important); |
973 return true; | 973 return true; |
974 } | 974 } |
975 break; | 975 break; |
976 } | 976 } |
977 case CSSPropertyBorderImageWidth: | 977 case CSSPropertyBorderImageWidth: |
978 case CSSPropertyWebkitMaskBoxImageWidth: { | 978 case CSSPropertyWebkitMaskBoxImageWidth: { |
979 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; | 979 RefPtrWillBeRawPtr<CSSPrimitiveValue> result = nullptr; |
980 if (parseBorderImageWidth(result)) { | 980 if (parseBorderImageWidth(result)) { |
981 addProperty(propId, result, important); | 981 addProperty(propId, result, important); |
982 return true; | 982 return true; |
983 } | 983 } |
984 break; | 984 break; |
985 } | 985 } |
986 case CSSPropertyBorderTopRightRadius: | 986 case CSSPropertyBorderTopRightRadius: |
987 case CSSPropertyBorderTopLeftRadius: | 987 case CSSPropertyBorderTopLeftRadius: |
988 case CSSPropertyBorderBottomLeftRadius: | 988 case CSSPropertyBorderBottomLeftRadius: |
989 case CSSPropertyBorderBottomRightRadius: { | 989 case CSSPropertyBorderBottomRightRadius: { |
990 if (num != 1 && num != 2) | 990 if (num != 1 && num != 2) |
991 return false; | 991 return false; |
992 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 992 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
993 if (!validPrimitive) | 993 if (!validPrimitive) |
994 return false; | 994 return false; |
995 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNume ricValue(value); | 995 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNume ricValue(value); |
996 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2; | 996 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = nullptr; |
997 if (num == 2) { | 997 if (num == 2) { |
998 value = m_valueList->next(); | 998 value = m_valueList->next(); |
999 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 999 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
1000 if (!validPrimitive) | 1000 if (!validPrimitive) |
1001 return false; | 1001 return false; |
1002 parsedValue2 = createPrimitiveNumericValue(value); | 1002 parsedValue2 = createPrimitiveNumericValue(value); |
1003 } else | 1003 } else |
1004 parsedValue2 = parsedValue1; | 1004 parsedValue2 = parsedValue1; |
1005 | 1005 |
1006 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par sedValue2.release()), important); | 1006 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par sedValue2.release()), important); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1113 addProperty(propId, transformValue.release(), important); | 1113 addProperty(propId, transformValue.release(), important); |
1114 return true; | 1114 return true; |
1115 } | 1115 } |
1116 return false; | 1116 return false; |
1117 } | 1117 } |
1118 break; | 1118 break; |
1119 case CSSPropertyWebkitTransformOrigin: | 1119 case CSSPropertyWebkitTransformOrigin: |
1120 case CSSPropertyWebkitTransformOriginX: | 1120 case CSSPropertyWebkitTransformOriginX: |
1121 case CSSPropertyWebkitTransformOriginY: | 1121 case CSSPropertyWebkitTransformOriginY: |
1122 case CSSPropertyWebkitTransformOriginZ: { | 1122 case CSSPropertyWebkitTransformOriginZ: { |
1123 RefPtrWillBeRawPtr<CSSValue> val1; | 1123 RefPtrWillBeRawPtr<CSSValue> val1 = nullptr; |
1124 RefPtrWillBeRawPtr<CSSValue> val2; | 1124 RefPtrWillBeRawPtr<CSSValue> val2 = nullptr; |
1125 RefPtrWillBeRawPtr<CSSValue> val3; | 1125 RefPtrWillBeRawPtr<CSSValue> val3 = nullptr; |
1126 CSSPropertyID propId1, propId2, propId3; | 1126 CSSPropertyID propId1, propId2, propId3; |
1127 if (parseTransformOrigin(propId, propId1, propId2, propId3, val1, val2, val3)) { | 1127 if (parseTransformOrigin(propId, propId1, propId2, propId3, val1, val2, val3)) { |
1128 addProperty(propId1, val1.release(), important); | 1128 addProperty(propId1, val1.release(), important); |
1129 if (val2) | 1129 if (val2) |
1130 addProperty(propId2, val2.release(), important); | 1130 addProperty(propId2, val2.release(), important); |
1131 if (val3) | 1131 if (val3) |
1132 addProperty(propId3, val3.release(), important); | 1132 addProperty(propId3, val3.release(), important); |
1133 return true; | 1133 return true; |
1134 } | 1134 } |
1135 return false; | 1135 return false; |
1136 } | 1136 } |
1137 case CSSPropertyWebkitPerspective: | 1137 case CSSPropertyWebkitPerspective: |
1138 if (id == CSSValueNone) | 1138 if (id == CSSValueNone) |
1139 validPrimitive = true; | 1139 validPrimitive = true; |
1140 else { | 1140 else { |
1141 // Accepting valueless numbers is a quirk of the -webkit prefixed ve rsion of the property. | 1141 // Accepting valueless numbers is a quirk of the -webkit prefixed ve rsion of the property. |
1142 if (validUnit(value, FNumber | FLength | FNonNeg)) { | 1142 if (validUnit(value, FNumber | FLength | FNonNeg)) { |
1143 RefPtrWillBeRawPtr<CSSValue> val = createPrimitiveNumericValue(v alue); | 1143 RefPtrWillBeRawPtr<CSSValue> val = createPrimitiveNumericValue(v alue); |
1144 if (val) { | 1144 if (val) { |
1145 addProperty(propId, val.release(), important); | 1145 addProperty(propId, val.release(), important); |
1146 return true; | 1146 return true; |
1147 } | 1147 } |
1148 return false; | 1148 return false; |
1149 } | 1149 } |
1150 } | 1150 } |
1151 break; | 1151 break; |
1152 case CSSPropertyWebkitPerspectiveOrigin: | 1152 case CSSPropertyWebkitPerspectiveOrigin: |
1153 case CSSPropertyWebkitPerspectiveOriginX: | 1153 case CSSPropertyWebkitPerspectiveOriginX: |
1154 case CSSPropertyWebkitPerspectiveOriginY: { | 1154 case CSSPropertyWebkitPerspectiveOriginY: { |
1155 RefPtrWillBeRawPtr<CSSValue> val1; | 1155 RefPtrWillBeRawPtr<CSSValue> val1 = nullptr; |
1156 RefPtrWillBeRawPtr<CSSValue> val2; | 1156 RefPtrWillBeRawPtr<CSSValue> val2 = nullptr; |
1157 CSSPropertyID propId1, propId2; | 1157 CSSPropertyID propId1, propId2; |
1158 if (parsePerspectiveOrigin(propId, propId1, propId2, val1, val2)) { | 1158 if (parsePerspectiveOrigin(propId, propId1, propId2, val1, val2)) { |
1159 addProperty(propId1, val1.release(), important); | 1159 addProperty(propId1, val1.release(), important); |
1160 if (val2) | 1160 if (val2) |
1161 addProperty(propId2, val2.release(), important); | 1161 addProperty(propId2, val2.release(), important); |
1162 return true; | 1162 return true; |
1163 } | 1163 } |
1164 return false; | 1164 return false; |
1165 } | 1165 } |
1166 case CSSPropertyAnimationDelay: | 1166 case CSSPropertyAnimationDelay: |
(...skipping 15 matching lines...) Expand all Loading... | |
1182 case CSSPropertyWebkitAnimationIterationCount: | 1182 case CSSPropertyWebkitAnimationIterationCount: |
1183 case CSSPropertyWebkitAnimationTimingFunction: | 1183 case CSSPropertyWebkitAnimationTimingFunction: |
1184 case CSSPropertyTransitionDelay: | 1184 case CSSPropertyTransitionDelay: |
1185 case CSSPropertyTransitionDuration: | 1185 case CSSPropertyTransitionDuration: |
1186 case CSSPropertyTransitionTimingFunction: | 1186 case CSSPropertyTransitionTimingFunction: |
1187 case CSSPropertyTransitionProperty: | 1187 case CSSPropertyTransitionProperty: |
1188 case CSSPropertyWebkitTransitionDelay: | 1188 case CSSPropertyWebkitTransitionDelay: |
1189 case CSSPropertyWebkitTransitionDuration: | 1189 case CSSPropertyWebkitTransitionDuration: |
1190 case CSSPropertyWebkitTransitionTimingFunction: | 1190 case CSSPropertyWebkitTransitionTimingFunction: |
1191 case CSSPropertyWebkitTransitionProperty: { | 1191 case CSSPropertyWebkitTransitionProperty: { |
1192 RefPtrWillBeRawPtr<CSSValue> val; | 1192 RefPtrWillBeRawPtr<CSSValue> val = nullptr; |
1193 AnimationParseContext context; | 1193 AnimationParseContext context; |
1194 if (parseAnimationProperty(propId, val, context)) { | 1194 if (parseAnimationProperty(propId, val, context)) { |
1195 addPropertyWithPrefixingVariant(propId, val.release(), important); | 1195 addPropertyWithPrefixingVariant(propId, val.release(), important); |
1196 return true; | 1196 return true; |
1197 } | 1197 } |
1198 return false; | 1198 return false; |
1199 } | 1199 } |
1200 | 1200 |
1201 case CSSPropertyJustifySelf: | 1201 case CSSPropertyJustifySelf: |
1202 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1202 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1662 bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper tyID* properties, int numProperties, bool important) | 1662 bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper tyID* properties, int numProperties, bool important) |
1663 { | 1663 { |
1664 ASSERT(numProperties <= cMaxFillProperties); | 1664 ASSERT(numProperties <= cMaxFillProperties); |
1665 if (numProperties > cMaxFillProperties) | 1665 if (numProperties > cMaxFillProperties) |
1666 return false; | 1666 return false; |
1667 | 1667 |
1668 ShorthandScope scope(this, propId); | 1668 ShorthandScope scope(this, propId); |
1669 | 1669 |
1670 bool parsedProperty[cMaxFillProperties] = { false }; | 1670 bool parsedProperty[cMaxFillProperties] = { false }; |
1671 RefPtrWillBeRawPtr<CSSValue> values[cMaxFillProperties]; | 1671 RefPtrWillBeRawPtr<CSSValue> values[cMaxFillProperties]; |
1672 RefPtrWillBeRawPtr<CSSValue> clipValue; | 1672 #if ENABLE(OILPAN) |
1673 RefPtrWillBeRawPtr<CSSValue> positionYValue; | 1673 // Zero initialize the array of raw pointers. |
1674 RefPtrWillBeRawPtr<CSSValue> repeatYValue; | 1674 memset(&values, 0, sizeof(values)); |
1675 #endif | |
1676 RefPtrWillBeRawPtr<CSSValue> clipValue = nullptr; | |
1677 RefPtrWillBeRawPtr<CSSValue> positionYValue = nullptr; | |
1678 RefPtrWillBeRawPtr<CSSValue> repeatYValue = nullptr; | |
1675 bool foundClip = false; | 1679 bool foundClip = false; |
1676 int i; | 1680 int i; |
1677 bool foundPositionCSSProperty = false; | 1681 bool foundPositionCSSProperty = false; |
1678 | 1682 |
1679 while (m_valueList->current()) { | 1683 while (m_valueList->current()) { |
1680 CSSParserValue* val = m_valueList->current(); | 1684 CSSParserValue* val = m_valueList->current(); |
1681 if (val->unit == CSSParserValue::Operator && val->iValue == ',') { | 1685 if (val->unit == CSSParserValue::Operator && val->iValue == ',') { |
1682 // We hit the end. Fill in all remaining values with the initial va lue. | 1686 // We hit the end. Fill in all remaining values with the initial va lue. |
1683 m_valueList->next(); | 1687 m_valueList->next(); |
1684 for (i = 0; i < numProperties; ++i) { | 1688 for (i = 0; i < numProperties; ++i) { |
(...skipping 28 matching lines...) Expand all Loading... | |
1713 foundPositionCSSProperty = false; | 1717 foundPositionCSSProperty = false; |
1714 bool found = false; | 1718 bool found = false; |
1715 for (i = 0; !found && i < numProperties; ++i) { | 1719 for (i = 0; !found && i < numProperties; ++i) { |
1716 | 1720 |
1717 if (sizeCSSPropertyExpected && (properties[i] != CSSPropertyBackgrou ndSize && properties[i] != CSSPropertyWebkitMaskSize)) | 1721 if (sizeCSSPropertyExpected && (properties[i] != CSSPropertyBackgrou ndSize && properties[i] != CSSPropertyWebkitMaskSize)) |
1718 continue; | 1722 continue; |
1719 if (!sizeCSSPropertyExpected && (properties[i] == CSSPropertyBackgro undSize || properties[i] == CSSPropertyWebkitMaskSize)) | 1723 if (!sizeCSSPropertyExpected && (properties[i] == CSSPropertyBackgro undSize || properties[i] == CSSPropertyWebkitMaskSize)) |
1720 continue; | 1724 continue; |
1721 | 1725 |
1722 if (!parsedProperty[i]) { | 1726 if (!parsedProperty[i]) { |
1723 RefPtrWillBeRawPtr<CSSValue> val1; | 1727 RefPtrWillBeRawPtr<CSSValue> val1 = nullptr; |
1724 RefPtrWillBeRawPtr<CSSValue> val2; | 1728 RefPtrWillBeRawPtr<CSSValue> val2 = nullptr; |
1725 CSSPropertyID propId1, propId2; | 1729 CSSPropertyID propId1, propId2; |
1726 CSSParserValue* parserValue = m_valueList->current(); | 1730 CSSParserValue* parserValue = m_valueList->current(); |
1727 // parseFillProperty() may modify m_implicitShorthand, so we MUS T reset it | 1731 // parseFillProperty() may modify m_implicitShorthand, so we MUS T reset it |
1728 // before EACH return below. | 1732 // before EACH return below. |
1729 if (parseFillProperty(properties[i], propId1, propId2, val1, val 2)) { | 1733 if (parseFillProperty(properties[i], propId1, propId2, val1, val 2)) { |
1730 parsedProperty[i] = found = true; | 1734 parsedProperty[i] = found = true; |
1731 addFillValue(values[i], val1.release()); | 1735 addFillValue(values[i], val1.release()); |
1732 if (properties[i] == CSSPropertyBackgroundPosition || proper ties[i] == CSSPropertyWebkitMaskPosition) | 1736 if (properties[i] == CSSPropertyBackgroundPosition || proper ties[i] == CSSPropertyWebkitMaskPosition) |
1733 addFillValue(positionYValue, val2.release()); | 1737 addFillValue(positionYValue, val2.release()); |
1734 if (properties[i] == CSSPropertyBackgroundRepeat || properti es[i] == CSSPropertyWebkitMaskRepeat) | 1738 if (properties[i] == CSSPropertyBackgroundRepeat || properti es[i] == CSSPropertyWebkitMaskRepeat) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1834 // length as the list with animation name in last position, even though they are | 1838 // length as the list with animation name in last position, even though they are |
1835 // in a different order. | 1839 // in a different order. |
1836 ASSERT(numProperties == animationProperties.length()); | 1840 ASSERT(numProperties == animationProperties.length()); |
1837 ASSERT(numProperties == shorthandForProperty(propId).length()); | 1841 ASSERT(numProperties == shorthandForProperty(propId).length()); |
1838 | 1842 |
1839 ShorthandScope scope(this, propId); | 1843 ShorthandScope scope(this, propId); |
1840 | 1844 |
1841 bool parsedProperty[numProperties] = { false }; | 1845 bool parsedProperty[numProperties] = { false }; |
1842 AnimationParseContext context; | 1846 AnimationParseContext context; |
1843 RefPtrWillBeRawPtr<CSSValue> values[numProperties]; | 1847 RefPtrWillBeRawPtr<CSSValue> values[numProperties]; |
1848 #if ENABLE(OILPAN) | |
1849 // Zero initialize the array of raw pointers. | |
1850 memset(&values, 0, sizeof(values)); | |
1851 #endif | |
1844 | 1852 |
1845 unsigned i; | 1853 unsigned i; |
1846 while (m_valueList->current()) { | 1854 while (m_valueList->current()) { |
1847 CSSParserValue* val = m_valueList->current(); | 1855 CSSParserValue* val = m_valueList->current(); |
1848 if (val->unit == CSSParserValue::Operator && val->iValue == ',') { | 1856 if (val->unit == CSSParserValue::Operator && val->iValue == ',') { |
1849 // We hit the end. Fill in all remaining values with the initial va lue. | 1857 // We hit the end. Fill in all remaining values with the initial va lue. |
1850 m_valueList->next(); | 1858 m_valueList->next(); |
1851 for (i = 0; i < numProperties; ++i) { | 1859 for (i = 0; i < numProperties; ++i) { |
1852 if (!parsedProperty[i]) | 1860 if (!parsedProperty[i]) |
1853 addAnimationValue(values[i], cssValuePool().createImplicitIn itialValue()); | 1861 addAnimationValue(values[i], cssValuePool().createImplicitIn itialValue()); |
1854 parsedProperty[i] = false; | 1862 parsedProperty[i] = false; |
1855 } | 1863 } |
1856 if (!m_valueList->current()) | 1864 if (!m_valueList->current()) |
1857 break; | 1865 break; |
1858 context.commitFirstAnimation(); | 1866 context.commitFirstAnimation(); |
1859 } | 1867 } |
1860 | 1868 |
1861 bool found = false; | 1869 bool found = false; |
1862 for (i = 0; i < numProperties; ++i) { | 1870 for (i = 0; i < numProperties; ++i) { |
1863 if (!parsedProperty[i]) { | 1871 if (!parsedProperty[i]) { |
1864 RefPtrWillBeRawPtr<CSSValue> val; | 1872 RefPtrWillBeRawPtr<CSSValue> val = nullptr; |
1865 if (parseAnimationProperty(animationProperties.properties()[i], val, context)) { | 1873 if (parseAnimationProperty(animationProperties.properties()[i], val, context)) { |
1866 parsedProperty[i] = found = true; | 1874 parsedProperty[i] = found = true; |
1867 addAnimationValue(values[i], val.release()); | 1875 addAnimationValue(values[i], val.release()); |
1868 break; | 1876 break; |
1869 } | 1877 } |
1870 } | 1878 } |
1871 } | 1879 } |
1872 | 1880 |
1873 // if we didn't find at least one match, this is an | 1881 // if we didn't find at least one match, this is an |
1874 // invalid shorthand and we have to ignore it | 1882 // invalid shorthand and we have to ignore it |
(...skipping 19 matching lines...) Expand all Loading... | |
1894 { | 1902 { |
1895 const unsigned numProperties = 4; | 1903 const unsigned numProperties = 4; |
1896 const StylePropertyShorthand& shorthand = shorthandForProperty(propId); | 1904 const StylePropertyShorthand& shorthand = shorthandForProperty(propId); |
1897 ASSERT(numProperties == shorthand.length()); | 1905 ASSERT(numProperties == shorthand.length()); |
1898 | 1906 |
1899 ShorthandScope scope(this, propId); | 1907 ShorthandScope scope(this, propId); |
1900 | 1908 |
1901 bool parsedProperty[numProperties] = { false }; | 1909 bool parsedProperty[numProperties] = { false }; |
1902 AnimationParseContext context; | 1910 AnimationParseContext context; |
1903 RefPtrWillBeRawPtr<CSSValue> values[numProperties]; | 1911 RefPtrWillBeRawPtr<CSSValue> values[numProperties]; |
1912 #if ENABLE(OILPAN) | |
1913 // Zero initialize the array of raw pointers. | |
1914 memset(&values, 0, sizeof(values)); | |
1915 #endif | |
1904 | 1916 |
1905 unsigned i; | 1917 unsigned i; |
1906 while (m_valueList->current()) { | 1918 while (m_valueList->current()) { |
1907 CSSParserValue* val = m_valueList->current(); | 1919 CSSParserValue* val = m_valueList->current(); |
1908 if (val->unit == CSSParserValue::Operator && val->iValue == ',') { | 1920 if (val->unit == CSSParserValue::Operator && val->iValue == ',') { |
1909 // We hit the end. Fill in all remaining values with the initial val ue. | 1921 // We hit the end. Fill in all remaining values with the initial val ue. |
1910 m_valueList->next(); | 1922 m_valueList->next(); |
1911 for (i = 0; i < numProperties; ++i) { | 1923 for (i = 0; i < numProperties; ++i) { |
1912 if (!parsedProperty[i]) | 1924 if (!parsedProperty[i]) |
1913 addAnimationValue(values[i], cssValuePool().createImplicitIn itialValue()); | 1925 addAnimationValue(values[i], cssValuePool().createImplicitIn itialValue()); |
1914 parsedProperty[i] = false; | 1926 parsedProperty[i] = false; |
1915 } | 1927 } |
1916 if (!m_valueList->current()) | 1928 if (!m_valueList->current()) |
1917 break; | 1929 break; |
1918 context.commitFirstAnimation(); | 1930 context.commitFirstAnimation(); |
1919 } | 1931 } |
1920 | 1932 |
1921 bool found = false; | 1933 bool found = false; |
1922 for (i = 0; !found && i < numProperties; ++i) { | 1934 for (i = 0; !found && i < numProperties; ++i) { |
1923 if (!parsedProperty[i]) { | 1935 if (!parsedProperty[i]) { |
1924 RefPtrWillBeRawPtr<CSSValue> val; | 1936 RefPtrWillBeRawPtr<CSSValue> val = nullptr; |
1925 if (parseAnimationProperty(shorthand.properties()[i], val, conte xt)) { | 1937 if (parseAnimationProperty(shorthand.properties()[i], val, conte xt)) { |
1926 parsedProperty[i] = found = true; | 1938 parsedProperty[i] = found = true; |
1927 addAnimationValue(values[i], val.release()); | 1939 addAnimationValue(values[i], val.release()); |
1928 } | 1940 } |
1929 | 1941 |
1930 // There are more values to process but 'none' or 'all' were alr eady defined as the animation property, the declaration becomes invalid. | 1942 // There are more values to process but 'none' or 'all' were alr eady defined as the animation property, the declaration becomes invalid. |
1931 if (!context.animationPropertyKeywordAllowed() && context.hasCom mittedFirstAnimation()) | 1943 if (!context.animationPropertyKeywordAllowed() && context.hasCom mittedFirstAnimation()) |
1932 return false; | 1944 return false; |
1933 } | 1945 } |
1934 } | 1946 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1973 || (!value->id && validUnit(value, FPositiveInteger, HTMLQuirksMode))) { | 1985 || (!value->id && validUnit(value, FPositiveInteger, HTMLQuirksMode))) { |
1974 RefPtrWillBeRawPtr<CSSValue> parsedValue = parseValidPrimitive(value->id , value); | 1986 RefPtrWillBeRawPtr<CSSValue> parsedValue = parseValidPrimitive(value->id , value); |
1975 m_valueList->next(); | 1987 m_valueList->next(); |
1976 return parsedValue; | 1988 return parsedValue; |
1977 } | 1989 } |
1978 return nullptr; | 1990 return nullptr; |
1979 } | 1991 } |
1980 | 1992 |
1981 bool CSSPropertyParser::parseColumnsShorthand(bool important) | 1993 bool CSSPropertyParser::parseColumnsShorthand(bool important) |
1982 { | 1994 { |
1983 RefPtrWillBeRawPtr<CSSValue> columnWidth; | 1995 RefPtrWillBeRawPtr<CSSValue> columnWidth = nullptr; |
1984 RefPtrWillBeRawPtr<CSSValue> columnCount; | 1996 RefPtrWillBeRawPtr<CSSValue> columnCount = nullptr; |
1985 bool hasPendingExplicitAuto = false; | 1997 bool hasPendingExplicitAuto = false; |
1986 | 1998 |
1987 for (unsigned propertiesParsed = 0; CSSParserValue* value = m_valueList->cur rent(); propertiesParsed++) { | 1999 for (unsigned propertiesParsed = 0; CSSParserValue* value = m_valueList->cur rent(); propertiesParsed++) { |
1988 if (propertiesParsed >= 2) | 2000 if (propertiesParsed >= 2) |
1989 return false; // Too many values for this shorthand. Invalid declara tion. | 2001 return false; // Too many values for this shorthand. Invalid declara tion. |
1990 if (!propertiesParsed && value->id == CSSValueAuto) { | 2002 if (!propertiesParsed && value->id == CSSValueAuto) { |
1991 // 'auto' is a valid value for any of the two longhands, and at this point we | 2003 // 'auto' is a valid value for any of the two longhands, and at this point we |
1992 // don't know which one(s) it is meant for. We need to see if there are other | 2004 // don't know which one(s) it is meant for. We need to see if there are other |
1993 // values first. | 2005 // values first. |
1994 m_valueList->next(); | 2006 m_valueList->next(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2232 return None; | 2244 return None; |
2233 } | 2245 } |
2234 } | 2246 } |
2235 | 2247 |
2236 // [ <string> <string> ]+ | inherit | none | 2248 // [ <string> <string> ]+ | inherit | none |
2237 // inherit and none are handled in parseValue. | 2249 // inherit and none are handled in parseValue. |
2238 bool CSSPropertyParser::parseQuotes(CSSPropertyID propId, bool important) | 2250 bool CSSPropertyParser::parseQuotes(CSSPropertyID propId, bool important) |
2239 { | 2251 { |
2240 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); | 2252 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); |
2241 while (CSSParserValue* val = m_valueList->current()) { | 2253 while (CSSParserValue* val = m_valueList->current()) { |
2242 RefPtrWillBeRawPtr<CSSValue> parsedValue; | 2254 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
2243 if (val->unit == CSSPrimitiveValue::CSS_STRING) | 2255 if (val->unit == CSSPrimitiveValue::CSS_STRING) |
2244 parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveVal ue::CSS_STRING); | 2256 parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveVal ue::CSS_STRING); |
2245 else | 2257 else |
2246 break; | 2258 break; |
2247 values->append(parsedValue.release()); | 2259 values->append(parsedValue.release()); |
2248 m_valueList->next(); | 2260 m_valueList->next(); |
2249 } | 2261 } |
2250 if (values->length()) { | 2262 if (values->length()) { |
2251 addProperty(propId, values.release(), important); | 2263 addProperty(propId, values.release(), important); |
2252 m_valueList->next(); | 2264 m_valueList->next(); |
2253 return true; | 2265 return true; |
2254 } | 2266 } |
2255 return false; | 2267 return false; |
2256 } | 2268 } |
2257 | 2269 |
2258 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open -quote | no-close-quote ]+ | inherit | 2270 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open -quote | no-close-quote ]+ | inherit |
2259 // in CSS 2.1 this got somewhat reduced: | 2271 // in CSS 2.1 this got somewhat reduced: |
2260 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu ote ]+ | inherit | 2272 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu ote ]+ | inherit |
2261 bool CSSPropertyParser::parseContent(CSSPropertyID propId, bool important) | 2273 bool CSSPropertyParser::parseContent(CSSPropertyID propId, bool important) |
2262 { | 2274 { |
2263 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); | 2275 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); |
2264 | 2276 |
2265 while (CSSParserValue* val = m_valueList->current()) { | 2277 while (CSSParserValue* val = m_valueList->current()) { |
2266 RefPtrWillBeRawPtr<CSSValue> parsedValue; | 2278 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
2267 if (val->unit == CSSPrimitiveValue::CSS_URI) { | 2279 if (val->unit == CSSPrimitiveValue::CSS_URI) { |
2268 // url | 2280 // url |
2269 parsedValue = CSSImageValue::create(val->string, completeURL(val->st ring)); | 2281 parsedValue = CSSImageValue::create(val->string, completeURL(val->st ring)); |
2270 } else if (val->unit == CSSParserValue::Function) { | 2282 } else if (val->unit == CSSParserValue::Function) { |
2271 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie nt(...) | 2283 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie nt(...) |
2272 CSSParserValueList* args = val->function->args.get(); | 2284 CSSParserValueList* args = val->function->args.get(); |
2273 if (!args) | 2285 if (!args) |
2274 return false; | 2286 return false; |
2275 if (equalIgnoringCase(val->function->name, "attr(")) { | 2287 if (equalIgnoringCase(val->function->name, "attr(")) { |
2276 parsedValue = parseAttr(args); | 2288 parsedValue = parseAttr(args); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2572 return; | 2584 return; |
2573 | 2585 |
2574 secondPositionKeyword = CSSValueTop; | 2586 secondPositionKeyword = CSSValueTop; |
2575 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) { | 2587 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) { |
2576 secondPositionKeyword = CSSValueLeft; | 2588 secondPositionKeyword = CSSValueLeft; |
2577 swapNeeded = true; | 2589 swapNeeded = true; |
2578 } | 2590 } |
2579 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); | 2591 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); |
2580 value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(s econdPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PER CENTAGE)); | 2592 value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(s econdPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PER CENTAGE)); |
2581 } else { | 2593 } else { |
2582 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPositionValue; | 2594 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPositionValue = nullptr; |
2583 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPositionValue; | 2595 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPositionValue = nullptr; |
2584 | 2596 |
2585 if (isFillPositionKeyword(ident2)) { | 2597 if (isFillPositionKeyword(ident2)) { |
2586 // To match CSS grammar, we should only accept: [ center | left | ri ght | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ] . | 2598 // To match CSS grammar, we should only accept: [ center | left | ri ght | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ] . |
2587 ASSERT(ident2 != CSSValueCenter); | 2599 ASSERT(ident2 != CSSValueCenter); |
2588 | 2600 |
2589 if (isFillPositionKeyword(ident3)) | 2601 if (isFillPositionKeyword(ident3)) |
2590 return; | 2602 return; |
2591 | 2603 |
2592 secondPositionValue = value3; | 2604 secondPositionValue = value3; |
2593 secondPositionKeyword = ident2; | 2605 secondPositionKeyword = ident2; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2774 } | 2786 } |
2775 | 2787 |
2776 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillSize(CSSPropertyID propId, bool& allowComma) | 2788 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillSize(CSSPropertyID propId, bool& allowComma) |
2777 { | 2789 { |
2778 allowComma = true; | 2790 allowComma = true; |
2779 CSSParserValue* value = m_valueList->current(); | 2791 CSSParserValue* value = m_valueList->current(); |
2780 | 2792 |
2781 if (value->id == CSSValueContain || value->id == CSSValueCover) | 2793 if (value->id == CSSValueContain || value->id == CSSValueCover) |
2782 return cssValuePool().createIdentifierValue(value->id); | 2794 return cssValuePool().createIdentifierValue(value->id); |
2783 | 2795 |
2784 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1; | 2796 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = nullptr; |
2785 | 2797 |
2786 if (value->id == CSSValueAuto) | 2798 if (value->id == CSSValueAuto) |
2787 parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto); | 2799 parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto); |
2788 else { | 2800 else { |
2789 if (!validUnit(value, FLength | FPercent)) | 2801 if (!validUnit(value, FLength | FPercent)) |
2790 return nullptr; | 2802 return nullptr; |
2791 parsedValue1 = createPrimitiveNumericValue(value); | 2803 parsedValue1 = createPrimitiveNumericValue(value); |
2792 } | 2804 } |
2793 | 2805 |
2794 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2; | 2806 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = nullptr; |
2795 if ((value = m_valueList->next())) { | 2807 if ((value = m_valueList->next())) { |
2796 if (value->unit == CSSParserValue::Operator && value->iValue == ',') | 2808 if (value->unit == CSSParserValue::Operator && value->iValue == ',') |
2797 allowComma = false; | 2809 allowComma = false; |
2798 else if (value->id != CSSValueAuto) { | 2810 else if (value->id != CSSValueAuto) { |
2799 if (!validUnit(value, FLength | FPercent)) { | 2811 if (!validUnit(value, FLength | FPercent)) { |
2800 if (!inShorthand()) | 2812 if (!inShorthand()) |
2801 return nullptr; | 2813 return nullptr; |
2802 // We need to rewind the value list, so that when it is advanced we'll end up back at this value. | 2814 // We need to rewind the value list, so that when it is advanced we'll end up back at this value. |
2803 m_valueList->previous(); | 2815 m_valueList->previous(); |
2804 } else | 2816 } else |
2805 parsedValue2 = createPrimitiveNumericValue(value); | 2817 parsedValue2 = createPrimitiveNumericValue(value); |
2806 } | 2818 } |
2807 } else if (!parsedValue2 && propId == CSSPropertyWebkitBackgroundSize) { | 2819 } else if (!parsedValue2 && propId == CSSPropertyWebkitBackgroundSize) { |
2808 // For backwards compatibility we set the second value to the first if i t is omitted. | 2820 // For backwards compatibility we set the second value to the first if i t is omitted. |
2809 // We only need to do this for -webkit-background-size. It should be saf e to let masks match | 2821 // We only need to do this for -webkit-background-size. It should be saf e to let masks match |
2810 // the real property. | 2822 // the real property. |
2811 parsedValue2 = parsedValue1; | 2823 parsedValue2 = parsedValue1; |
2812 } | 2824 } |
2813 | 2825 |
2814 if (!parsedValue2) | 2826 if (!parsedValue2) |
2815 return parsedValue1; | 2827 return parsedValue1; |
2816 return createPrimitiveValuePair(parsedValue1.release(), parsedValue2.release ()); | 2828 return createPrimitiveValuePair(parsedValue1.release(), parsedValue2.release ()); |
2817 } | 2829 } |
2818 | 2830 |
2819 bool CSSPropertyParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& p ropId1, CSSPropertyID& propId2, | 2831 bool CSSPropertyParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& p ropId1, CSSPropertyID& propId2, |
2820 RefPtrWillBeRawPtr<CSSValue>& retValue1, RefPtrWillBeRawPtr<CSSValue>& retVa lue2) | 2832 RefPtrWillBeRawPtr<CSSValue>& retValue1, RefPtrWillBeRawPtr<CSSValue>& retVa lue2) |
2821 { | 2833 { |
2822 RefPtrWillBeRawPtr<CSSValueList> values; | 2834 RefPtrWillBeRawPtr<CSSValueList> values = nullptr; |
2823 RefPtrWillBeRawPtr<CSSValueList> values2; | 2835 RefPtrWillBeRawPtr<CSSValueList> values2 = nullptr; |
2824 CSSParserValue* val; | 2836 CSSParserValue* val; |
2825 RefPtrWillBeRawPtr<CSSValue> value; | 2837 RefPtrWillBeRawPtr<CSSValue> value = nullptr; |
2826 RefPtrWillBeRawPtr<CSSValue> value2; | 2838 RefPtrWillBeRawPtr<CSSValue> value2 = nullptr; |
2827 | 2839 |
2828 bool allowComma = false; | 2840 bool allowComma = false; |
2829 | 2841 |
2830 retValue1 = retValue2 = nullptr; | 2842 retValue1 = retValue2 = nullptr; |
2831 propId1 = propId; | 2843 propId1 = propId; |
2832 propId2 = propId; | 2844 propId2 = propId; |
2833 if (propId == CSSPropertyBackgroundPosition) { | 2845 if (propId == CSSPropertyBackgroundPosition) { |
2834 propId1 = CSSPropertyBackgroundPositionX; | 2846 propId1 = CSSPropertyBackgroundPositionX; |
2835 propId2 = CSSPropertyBackgroundPositionY; | 2847 propId2 = CSSPropertyBackgroundPositionY; |
2836 } else if (propId == CSSPropertyWebkitMaskPosition) { | 2848 } else if (propId == CSSPropertyWebkitMaskPosition) { |
2837 propId1 = CSSPropertyWebkitMaskPositionX; | 2849 propId1 = CSSPropertyWebkitMaskPositionX; |
2838 propId2 = CSSPropertyWebkitMaskPositionY; | 2850 propId2 = CSSPropertyWebkitMaskPositionY; |
2839 } else if (propId == CSSPropertyBackgroundRepeat) { | 2851 } else if (propId == CSSPropertyBackgroundRepeat) { |
2840 propId1 = CSSPropertyBackgroundRepeatX; | 2852 propId1 = CSSPropertyBackgroundRepeatX; |
2841 propId2 = CSSPropertyBackgroundRepeatY; | 2853 propId2 = CSSPropertyBackgroundRepeatY; |
2842 } else if (propId == CSSPropertyWebkitMaskRepeat) { | 2854 } else if (propId == CSSPropertyWebkitMaskRepeat) { |
2843 propId1 = CSSPropertyWebkitMaskRepeatX; | 2855 propId1 = CSSPropertyWebkitMaskRepeatX; |
2844 propId2 = CSSPropertyWebkitMaskRepeatY; | 2856 propId2 = CSSPropertyWebkitMaskRepeatY; |
2845 } | 2857 } |
2846 | 2858 |
2847 while ((val = m_valueList->current())) { | 2859 while ((val = m_valueList->current())) { |
2848 RefPtrWillBeRawPtr<CSSValue> currValue; | 2860 RefPtrWillBeRawPtr<CSSValue> currValue = nullptr; |
2849 RefPtrWillBeRawPtr<CSSValue> currValue2; | 2861 RefPtrWillBeRawPtr<CSSValue> currValue2 = nullptr; |
2850 | 2862 |
2851 if (allowComma) { | 2863 if (allowComma) { |
2852 if (!isComma(val)) | 2864 if (!isComma(val)) |
2853 return false; | 2865 return false; |
2854 m_valueList->next(); | 2866 m_valueList->next(); |
2855 allowComma = false; | 2867 allowComma = false; |
2856 } else { | 2868 } else { |
2857 allowComma = true; | 2869 allowComma = true; |
2858 switch (propId) { | 2870 switch (propId) { |
2859 case CSSPropertyBackgroundColor: | 2871 case CSSPropertyBackgroundColor: |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3199 return nullptr; | 3211 return nullptr; |
3200 | 3212 |
3201 return CSSCubicBezierTimingFunctionValue::create(x1, y1, x2, y2); | 3213 return CSSCubicBezierTimingFunctionValue::create(x1, y1, x2, y2); |
3202 } | 3214 } |
3203 | 3215 |
3204 return nullptr; | 3216 return nullptr; |
3205 } | 3217 } |
3206 | 3218 |
3207 bool CSSPropertyParser::parseAnimationProperty(CSSPropertyID propId, RefPtrWillB eRawPtr<CSSValue>& result, AnimationParseContext& context) | 3219 bool CSSPropertyParser::parseAnimationProperty(CSSPropertyID propId, RefPtrWillB eRawPtr<CSSValue>& result, AnimationParseContext& context) |
3208 { | 3220 { |
3209 RefPtrWillBeRawPtr<CSSValueList> values; | 3221 RefPtrWillBeRawPtr<CSSValueList> values = nullptr; |
3210 CSSParserValue* val; | 3222 CSSParserValue* val; |
3211 RefPtrWillBeRawPtr<CSSValue> value; | 3223 RefPtrWillBeRawPtr<CSSValue> value = nullptr; |
3212 bool allowComma = false; | 3224 bool allowComma = false; |
3213 | 3225 |
3214 result = nullptr; | 3226 result = nullptr; |
3215 | 3227 |
3216 while ((val = m_valueList->current())) { | 3228 while ((val = m_valueList->current())) { |
3217 RefPtrWillBeRawPtr<CSSValue> currValue; | 3229 RefPtrWillBeRawPtr<CSSValue> currValue = nullptr; |
3218 if (allowComma) { | 3230 if (allowComma) { |
3219 if (!isComma(val)) | 3231 if (!isComma(val)) |
3220 return false; | 3232 return false; |
3221 m_valueList->next(); | 3233 m_valueList->next(); |
3222 allowComma = false; | 3234 allowComma = false; |
3223 } | 3235 } |
3224 else { | 3236 else { |
3225 switch (propId) { | 3237 switch (propId) { |
3226 case CSSPropertyAnimationDelay: | 3238 case CSSPropertyAnimationDelay: |
3227 case CSSPropertyWebkitAnimationDelay: | 3239 case CSSPropertyWebkitAnimationDelay: |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3358 if (value->id == CSSValueAuto) { | 3370 if (value->id == CSSValueAuto) { |
3359 m_valueList->next(); | 3371 m_valueList->next(); |
3360 return cssValuePool().createIdentifierValue(CSSValueAuto); | 3372 return cssValuePool().createIdentifierValue(CSSValueAuto); |
3361 } | 3373 } |
3362 | 3374 |
3363 if (value->id != CSSValueSpan && value->unit == CSSPrimitiveValue::CSS_IDENT ) { | 3375 if (value->id != CSSValueSpan && value->unit == CSSPrimitiveValue::CSS_IDENT ) { |
3364 m_valueList->next(); | 3376 m_valueList->next(); |
3365 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_ STRING); | 3377 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_ STRING); |
3366 } | 3378 } |
3367 | 3379 |
3368 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue; | 3380 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = nullptr; |
3369 RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName; | 3381 RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName = nullptr; |
3370 bool hasSeenSpanKeyword = false; | 3382 bool hasSeenSpanKeyword = false; |
3371 | 3383 |
3372 if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) { | 3384 if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) { |
3373 value = m_valueList->current(); | 3385 value = m_valueList->current(); |
3374 if (value && value->id == CSSValueSpan) { | 3386 if (value && value->id == CSSValueSpan) { |
3375 hasSeenSpanKeyword = true; | 3387 hasSeenSpanKeyword = true; |
3376 m_valueList->next(); | 3388 m_valueList->next(); |
3377 } | 3389 } |
3378 } else if (value->id == CSSValueSpan) { | 3390 } else if (value->id == CSSValueSpan) { |
3379 hasSeenSpanKeyword = true; | 3391 hasSeenSpanKeyword = true; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3416 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId , bool important) | 3428 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId , bool important) |
3417 { | 3429 { |
3418 ShorthandScope scope(this, shorthandId); | 3430 ShorthandScope scope(this, shorthandId); |
3419 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); | 3431 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); |
3420 ASSERT(shorthand.length() == 2); | 3432 ASSERT(shorthand.length() == 2); |
3421 | 3433 |
3422 RefPtrWillBeRawPtr<CSSValue> startValue = parseGridPosition(); | 3434 RefPtrWillBeRawPtr<CSSValue> startValue = parseGridPosition(); |
3423 if (!startValue) | 3435 if (!startValue) |
3424 return false; | 3436 return false; |
3425 | 3437 |
3426 RefPtrWillBeRawPtr<CSSValue> endValue; | 3438 RefPtrWillBeRawPtr<CSSValue> endValue = nullptr; |
3427 if (m_valueList->current()) { | 3439 if (m_valueList->current()) { |
3428 if (!isForwardSlashOperator(m_valueList->current())) | 3440 if (!isForwardSlashOperator(m_valueList->current())) |
3429 return false; | 3441 return false; |
3430 | 3442 |
3431 if (!m_valueList->next()) | 3443 if (!m_valueList->next()) |
3432 return false; | 3444 return false; |
3433 | 3445 |
3434 endValue = parseGridPosition(); | 3446 endValue = parseGridPosition(); |
3435 if (!endValue || m_valueList->current()) | 3447 if (!endValue || m_valueList->current()) |
3436 return false; | 3448 return false; |
(...skipping 11 matching lines...) Expand all Loading... | |
3448 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3460 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3449 | 3461 |
3450 ShorthandScope scope(this, CSSPropertyGridArea); | 3462 ShorthandScope scope(this, CSSPropertyGridArea); |
3451 const StylePropertyShorthand& shorthand = gridAreaShorthand(); | 3463 const StylePropertyShorthand& shorthand = gridAreaShorthand(); |
3452 ASSERT_UNUSED(shorthand, shorthand.length() == 4); | 3464 ASSERT_UNUSED(shorthand, shorthand.length() == 4); |
3453 | 3465 |
3454 RefPtrWillBeRawPtr<CSSValue> rowStartValue = parseGridPosition(); | 3466 RefPtrWillBeRawPtr<CSSValue> rowStartValue = parseGridPosition(); |
3455 if (!rowStartValue) | 3467 if (!rowStartValue) |
3456 return false; | 3468 return false; |
3457 | 3469 |
3458 RefPtrWillBeRawPtr<CSSValue> columnStartValue; | 3470 RefPtrWillBeRawPtr<CSSValue> columnStartValue = nullptr; |
3459 if (!parseSingleGridAreaLonghand(columnStartValue)) | 3471 if (!parseSingleGridAreaLonghand(columnStartValue)) |
3460 return false; | 3472 return false; |
3461 | 3473 |
3462 RefPtrWillBeRawPtr<CSSValue> rowEndValue; | 3474 RefPtrWillBeRawPtr<CSSValue> rowEndValue = nullptr; |
3463 if (!parseSingleGridAreaLonghand(rowEndValue)) | 3475 if (!parseSingleGridAreaLonghand(rowEndValue)) |
3464 return false; | 3476 return false; |
3465 | 3477 |
3466 RefPtrWillBeRawPtr<CSSValue> columnEndValue; | 3478 RefPtrWillBeRawPtr<CSSValue> columnEndValue = nullptr; |
3467 if (!parseSingleGridAreaLonghand(columnEndValue)) | 3479 if (!parseSingleGridAreaLonghand(columnEndValue)) |
3468 return false; | 3480 return false; |
3469 | 3481 |
3470 if (!columnStartValue) | 3482 if (!columnStartValue) |
3471 columnStartValue = gridMissingGridPositionValue(rowStartValue.get()); | 3483 columnStartValue = gridMissingGridPositionValue(rowStartValue.get()); |
3472 | 3484 |
3473 if (!rowEndValue) | 3485 if (!rowEndValue) |
3474 rowEndValue = gridMissingGridPositionValue(rowStartValue.get()); | 3486 rowEndValue = gridMissingGridPositionValue(rowStartValue.get()); |
3475 | 3487 |
3476 if (!columnEndValue) | 3488 if (!columnEndValue) |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3740 if (counters && numArgs != 3 && numArgs != 5) | 3752 if (counters && numArgs != 3 && numArgs != 5) |
3741 return nullptr; | 3753 return nullptr; |
3742 if (!counters && numArgs != 1 && numArgs != 3) | 3754 if (!counters && numArgs != 1 && numArgs != 3) |
3743 return nullptr; | 3755 return nullptr; |
3744 | 3756 |
3745 CSSParserValue* i = args->current(); | 3757 CSSParserValue* i = args->current(); |
3746 if (i->unit != CSSPrimitiveValue::CSS_IDENT) | 3758 if (i->unit != CSSPrimitiveValue::CSS_IDENT) |
3747 return nullptr; | 3759 return nullptr; |
3748 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValu e(i); | 3760 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValu e(i); |
3749 | 3761 |
3750 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator; | 3762 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = nullptr; |
3751 if (!counters) | 3763 if (!counters) |
3752 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_ STRING); | 3764 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_ STRING); |
3753 else { | 3765 else { |
3754 i = args->next(); | 3766 i = args->next(); |
3755 if (i->unit != CSSParserValue::Operator || i->iValue != ',') | 3767 if (i->unit != CSSParserValue::Operator || i->iValue != ',') |
3756 return nullptr; | 3768 return nullptr; |
3757 | 3769 |
3758 i = args->next(); | 3770 i = args->next(); |
3759 if (i->unit != CSSPrimitiveValue::CSS_STRING) | 3771 if (i->unit != CSSPrimitiveValue::CSS_STRING) |
3760 return nullptr; | 3772 return nullptr; |
3761 | 3773 |
3762 separator = createPrimitiveStringValue(i); | 3774 separator = createPrimitiveStringValue(i); |
3763 } | 3775 } |
3764 | 3776 |
3765 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle; | 3777 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr; |
3766 i = args->next(); | 3778 i = args->next(); |
3767 if (!i) // Make the list style default decimal | 3779 if (!i) // Make the list style default decimal |
3768 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); | 3780 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); |
3769 else { | 3781 else { |
3770 if (i->unit != CSSParserValue::Operator || i->iValue != ',') | 3782 if (i->unit != CSSParserValue::Operator || i->iValue != ',') |
3771 return nullptr; | 3783 return nullptr; |
3772 | 3784 |
3773 i = args->next(); | 3785 i = args->next(); |
3774 if (i->unit != CSSPrimitiveValue::CSS_IDENT) | 3786 if (i->unit != CSSPrimitiveValue::CSS_IDENT) |
3775 return nullptr; | 3787 return nullptr; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3861 radiusArguments.addValue(*argument); | 3873 radiusArguments.addValue(*argument); |
3862 argument = args->next(); | 3874 argument = args->next(); |
3863 } | 3875 } |
3864 | 3876 |
3865 unsigned num = radiusArguments.size(); | 3877 unsigned num = radiusArguments.size(); |
3866 if (!num || num > 9) | 3878 if (!num || num > 9) |
3867 return nullptr; | 3879 return nullptr; |
3868 | 3880 |
3869 // FIXME: Refactor completeBorderRadii and the array | 3881 // FIXME: Refactor completeBorderRadii and the array |
3870 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4]; | 3882 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4]; |
3883 #if ENABLE(OILPAN) | |
3884 // Zero initialize the array of raw pointers. | |
3885 memset(&radii, 0, sizeof(radii)); | |
3886 #endif | |
3871 | 3887 |
3872 unsigned indexAfterSlash = 0; | 3888 unsigned indexAfterSlash = 0; |
3873 for (unsigned i = 0; i < num; ++i) { | 3889 for (unsigned i = 0; i < num; ++i) { |
3874 CSSParserValue* value = radiusArguments.valueAt(i); | 3890 CSSParserValue* value = radiusArguments.valueAt(i); |
3875 if (value->unit == CSSParserValue::Operator) { | 3891 if (value->unit == CSSParserValue::Operator) { |
3876 if (value->iValue != '/') | 3892 if (value->iValue != '/') |
3877 return nullptr; | 3893 return nullptr; |
3878 | 3894 |
3879 if (!i || indexAfterSlash || i + 1 == num) | 3895 if (!i || indexAfterSlash || i + 1 == num) |
3880 return nullptr; | 3896 return nullptr; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4053 if (!args->currentIndex() && argument->id != CSSValueAt) { | 4069 if (!args->currentIndex() && argument->id != CSSValueAt) { |
4054 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius( argument)) { | 4070 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius( argument)) { |
4055 shape->setRadius(radius); | 4071 shape->setRadius(radius); |
4056 continue; | 4072 continue; |
4057 } | 4073 } |
4058 | 4074 |
4059 return nullptr; | 4075 return nullptr; |
4060 } | 4076 } |
4061 | 4077 |
4062 if (argument->id == CSSValueAt && args->next()) { | 4078 if (argument->id == CSSValueAt && args->next()) { |
4063 RefPtrWillBeRawPtr<CSSValue> centerX; | 4079 RefPtrWillBeRawPtr<CSSValue> centerX = nullptr; |
4064 RefPtrWillBeRawPtr<CSSValue> centerY; | 4080 RefPtrWillBeRawPtr<CSSValue> centerY = nullptr; |
4065 parseFillPosition(args, centerX, centerY); | 4081 parseFillPosition(args, centerX, centerY); |
4066 if (centerX && centerY && !args->current()) { | 4082 if (centerX && centerY && !args->current()) { |
4067 ASSERT(centerX->isPrimitiveValue()); | 4083 ASSERT(centerX->isPrimitiveValue()); |
4068 ASSERT(centerY->isPrimitiveValue()); | 4084 ASSERT(centerY->isPrimitiveValue()); |
4069 shape->setCenterX(toCSSPrimitiveValue(centerX.get())); | 4085 shape->setCenterX(toCSSPrimitiveValue(centerX.get())); |
4070 shape->setCenterY(toCSSPrimitiveValue(centerY.get())); | 4086 shape->setCenterY(toCSSPrimitiveValue(centerY.get())); |
4071 } else { | 4087 } else { |
4072 return nullptr; | 4088 return nullptr; |
4073 } | 4089 } |
4074 } else { | 4090 } else { |
(...skipping 30 matching lines...) Expand all Loading... | |
4105 else | 4121 else |
4106 shape->setRadiusY(radius); | 4122 shape->setRadiusY(radius); |
4107 continue; | 4123 continue; |
4108 } | 4124 } |
4109 | 4125 |
4110 return nullptr; | 4126 return nullptr; |
4111 } | 4127 } |
4112 | 4128 |
4113 if (argument->id != CSSValueAt || !args->next()) // expecting ellipse(.. at <position>) | 4129 if (argument->id != CSSValueAt || !args->next()) // expecting ellipse(.. at <position>) |
4114 return nullptr; | 4130 return nullptr; |
4115 RefPtrWillBeRawPtr<CSSValue> centerX; | 4131 RefPtrWillBeRawPtr<CSSValue> centerX = nullptr; |
4116 RefPtrWillBeRawPtr<CSSValue> centerY; | 4132 RefPtrWillBeRawPtr<CSSValue> centerY = nullptr; |
4117 parseFillPosition(args, centerX, centerY); | 4133 parseFillPosition(args, centerX, centerY); |
4118 if (!centerX || !centerY || args->current()) | 4134 if (!centerX || !centerY || args->current()) |
4119 return nullptr; | 4135 return nullptr; |
4120 | 4136 |
4121 ASSERT(centerX->isPrimitiveValue()); | 4137 ASSERT(centerX->isPrimitiveValue()); |
4122 ASSERT(centerY->isPrimitiveValue()); | 4138 ASSERT(centerY->isPrimitiveValue()); |
4123 shape->setCenterX(toCSSPrimitiveValue(centerX.get())); | 4139 shape->setCenterX(toCSSPrimitiveValue(centerX.get())); |
4124 shape->setCenterY(toCSSPrimitiveValue(centerY.get())); | 4140 shape->setCenterY(toCSSPrimitiveValue(centerY.get())); |
4125 } | 4141 } |
4126 | 4142 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4193 return false; | 4209 return false; |
4194 } | 4210 } |
4195 | 4211 |
4196 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseShapeProperty(CSSProper tyID propId) | 4212 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseShapeProperty(CSSProper tyID propId) |
4197 { | 4213 { |
4198 if (!RuntimeEnabledFeatures::cssShapesEnabled()) | 4214 if (!RuntimeEnabledFeatures::cssShapesEnabled()) |
4199 return nullptr; | 4215 return nullptr; |
4200 | 4216 |
4201 CSSParserValue* value = m_valueList->current(); | 4217 CSSParserValue* value = m_valueList->current(); |
4202 CSSValueID valueId = value->id; | 4218 CSSValueID valueId = value->id; |
4203 RefPtrWillBeRawPtr<CSSPrimitiveValue> boxValue; | |
4204 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; | |
4205 | 4219 |
4206 if (valueId == CSSValueNone | 4220 if (valueId == CSSValueNone |
4207 || (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside) ) { | 4221 || (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside) ) { |
4208 RefPtrWillBeRawPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive (valueId, value); | 4222 RefPtrWillBeRawPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive (valueId, value); |
4209 m_valueList->next(); | 4223 m_valueList->next(); |
4210 return keywordValue.release(); | 4224 return keywordValue.release(); |
4211 } | 4225 } |
4212 | 4226 |
4213 RefPtrWillBeRawPtr<CSSValue> imageValue; | 4227 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr; |
4214 if (valueId != CSSValueNone && parseFillImage(m_valueList.get(), imageValue) ) { | 4228 if (valueId != CSSValueNone && parseFillImage(m_valueList.get(), imageValue) ) { |
4215 m_valueList->next(); | 4229 m_valueList->next(); |
4216 return imageValue.release(); | 4230 return imageValue.release(); |
4217 } | 4231 } |
4218 | 4232 |
4219 return parseBasicShapeAndOrBox(); | 4233 return parseBasicShapeAndOrBox(); |
4220 } | 4234 } |
4221 | 4235 |
4222 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseBasicShapeAndOrBox() | 4236 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseBasicShapeAndOrBox() |
4223 { | 4237 { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4257 | 4271 |
4258 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseBasicShape() | 4272 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseBasicShape() |
4259 { | 4273 { |
4260 CSSParserValue* value = m_valueList->current(); | 4274 CSSParserValue* value = m_valueList->current(); |
4261 ASSERT(value->unit == CSSParserValue::Function); | 4275 ASSERT(value->unit == CSSParserValue::Function); |
4262 CSSParserValueList* args = value->function->args.get(); | 4276 CSSParserValueList* args = value->function->args.get(); |
4263 | 4277 |
4264 if (!args) | 4278 if (!args) |
4265 return nullptr; | 4279 return nullptr; |
4266 | 4280 |
4267 RefPtrWillBeRawPtr<CSSBasicShape> shape; | 4281 RefPtrWillBeRawPtr<CSSBasicShape> shape = nullptr; |
4268 if (equalIgnoringCase(value->function->name, "circle(")) | 4282 if (equalIgnoringCase(value->function->name, "circle(")) |
4269 shape = parseBasicShapeCircle(args); | 4283 shape = parseBasicShapeCircle(args); |
4270 else if (equalIgnoringCase(value->function->name, "ellipse(")) | 4284 else if (equalIgnoringCase(value->function->name, "ellipse(")) |
4271 shape = parseBasicShapeEllipse(args); | 4285 shape = parseBasicShapeEllipse(args); |
4272 else if (equalIgnoringCase(value->function->name, "polygon(")) | 4286 else if (equalIgnoringCase(value->function->name, "polygon(")) |
4273 shape = parseBasicShapePolygon(args); | 4287 shape = parseBasicShapePolygon(args); |
4274 else if (equalIgnoringCase(value->function->name, "inset(")) | 4288 else if (equalIgnoringCase(value->function->name, "inset(")) |
4275 shape = parseBasicShapeInset(args); | 4289 shape = parseBasicShapeInset(args); |
4276 | 4290 |
4277 if (!shape) | 4291 if (!shape) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4490 validPrimitive = true; | 4504 validPrimitive = true; |
4491 else | 4505 else |
4492 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 4506 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
4493 if (validPrimitive && (!m_valueList->next() || inShorthand())) | 4507 if (validPrimitive && (!m_valueList->next() || inShorthand())) |
4494 addProperty(CSSPropertyFontSize, parseValidPrimitive(id, value), importa nt); | 4508 addProperty(CSSPropertyFontSize, parseValidPrimitive(id, value), importa nt); |
4495 return validPrimitive; | 4509 return validPrimitive; |
4496 } | 4510 } |
4497 | 4511 |
4498 bool CSSPropertyParser::parseFontVariant(bool important) | 4512 bool CSSPropertyParser::parseFontVariant(bool important) |
4499 { | 4513 { |
4500 RefPtrWillBeRawPtr<CSSValueList> values; | 4514 RefPtrWillBeRawPtr<CSSValueList> values = nullptr; |
4501 if (m_valueList->size() > 1) | 4515 if (m_valueList->size() > 1) |
4502 values = CSSValueList::createCommaSeparated(); | 4516 values = CSSValueList::createCommaSeparated(); |
4503 CSSParserValue* val; | 4517 CSSParserValue* val; |
4504 bool expectComma = false; | 4518 bool expectComma = false; |
4505 while ((val = m_valueList->current())) { | 4519 while ((val = m_valueList->current())) { |
4506 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue; | 4520 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue = nullptr; |
4507 if (!expectComma) { | 4521 if (!expectComma) { |
4508 expectComma = true; | 4522 expectComma = true; |
4509 if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) | 4523 if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) |
4510 parsedValue = cssValuePool().createIdentifierValue(val->id); | 4524 parsedValue = cssValuePool().createIdentifierValue(val->id); |
4511 else if (val->id == CSSValueAll && !values) { | 4525 else if (val->id == CSSValueAll && !values) { |
4512 // 'all' is only allowed in @font-face and with no other values. Make a value list to | 4526 // 'all' is only allowed in @font-face and with no other values. Make a value list to |
4513 // indicate that we are in the @font-face case. | 4527 // indicate that we are in the @font-face case. |
4514 values = CSSValueList::createCommaSeparated(); | 4528 values = CSSValueList::createCommaSeparated(); |
4515 parsedValue = cssValuePool().createIdentifierValue(val->id); | 4529 parsedValue = cssValuePool().createIdentifierValue(val->id); |
4516 } | 4530 } |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5321 else { | 5335 else { |
5322 allowBlur = false; | 5336 allowBlur = false; |
5323 allowSpread = false; | 5337 allowSpread = false; |
5324 allowColor = false; | 5338 allowColor = false; |
5325 } | 5339 } |
5326 } | 5340 } |
5327 | 5341 |
5328 CSSPropertyID property; | 5342 CSSPropertyID property; |
5329 CSSPropertyParser* m_parser; | 5343 CSSPropertyParser* m_parser; |
5330 | 5344 |
5331 RefPtrWillBeRawPtr<CSSValueList> values; | 5345 RefPtrWillBeRawPtr<CSSValueList> values = nullptr; |
5332 RefPtrWillBeRawPtr<CSSPrimitiveValue> x; | 5346 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = nullptr; |
5333 RefPtrWillBeRawPtr<CSSPrimitiveValue> y; | 5347 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = nullptr; |
5334 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur; | 5348 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = nullptr; |
5335 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread; | 5349 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = nullptr; |
5336 RefPtrWillBeRawPtr<CSSPrimitiveValue> style; | 5350 RefPtrWillBeRawPtr<CSSPrimitiveValue> style = nullptr; |
5337 RefPtrWillBeRawPtr<CSSPrimitiveValue> color; | 5351 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = nullptr; |
haraken
2014/03/24 13:52:54
These could be RefPtrWillBeMembers, since the obje
Mads Ager (chromium)
2014/03/24 14:27:30
Absolutely!
| |
5338 | 5352 |
5339 bool allowX; | 5353 bool allowX; |
5340 bool allowY; | 5354 bool allowY; |
5341 bool allowBlur; | 5355 bool allowBlur; |
5342 bool allowSpread; | 5356 bool allowSpread; |
5343 bool allowColor; | 5357 bool allowColor; |
5344 bool allowStyle; // inset or not. | 5358 bool allowStyle; // inset or not. |
5345 bool allowBreak; | 5359 bool allowBreak; |
5346 }; | 5360 }; |
5347 | 5361 |
(...skipping 22 matching lines...) Expand all Loading... | |
5370 | 5384 |
5371 // A length is allowed here. Construct the value and add it. | 5385 // A length is allowed here. Construct the value and add it. |
5372 context.commitLength(val); | 5386 context.commitLength(val); |
5373 } else if (val->id == CSSValueInset) { | 5387 } else if (val->id == CSSValueInset) { |
5374 if (!context.allowStyle) | 5388 if (!context.allowStyle) |
5375 return nullptr; | 5389 return nullptr; |
5376 | 5390 |
5377 context.commitStyle(val); | 5391 context.commitStyle(val); |
5378 } else { | 5392 } else { |
5379 // The only other type of value that's ok is a color value. | 5393 // The only other type of value that's ok is a color value. |
5380 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedColor; | 5394 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedColor = nullptr; |
5381 bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindo wtext) || val->id == CSSValueMenu | 5395 bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindo wtext) || val->id == CSSValueMenu |
5382 || (val->id >= CSSValueWebkitFocusRingColor && val-> id <= CSSValueWebkitText && inQuirksMode()) | 5396 || (val->id >= CSSValueWebkitFocusRingColor && val-> id <= CSSValueWebkitText && inQuirksMode()) |
5383 || val->id == CSSValueCurrentcolor); | 5397 || val->id == CSSValueCurrentcolor); |
5384 if (isColor) { | 5398 if (isColor) { |
5385 if (!context.allowColor) | 5399 if (!context.allowColor) |
5386 return nullptr; | 5400 return nullptr; |
5387 parsedColor = cssValuePool().createIdentifierValue(val->id); | 5401 parsedColor = cssValuePool().createIdentifierValue(val->id); |
5388 } | 5402 } |
5389 | 5403 |
5390 if (!parsedColor) | 5404 if (!parsedColor) |
(...skipping 18 matching lines...) Expand all Loading... | |
5409 | 5423 |
5410 return nullptr; | 5424 return nullptr; |
5411 } | 5425 } |
5412 | 5426 |
5413 bool CSSPropertyParser::parseReflect(CSSPropertyID propId, bool important) | 5427 bool CSSPropertyParser::parseReflect(CSSPropertyID propId, bool important) |
5414 { | 5428 { |
5415 // box-reflect: <direction> <offset> <mask> | 5429 // box-reflect: <direction> <offset> <mask> |
5416 | 5430 |
5417 // Direction comes first. | 5431 // Direction comes first. |
5418 CSSParserValue* val = m_valueList->current(); | 5432 CSSParserValue* val = m_valueList->current(); |
5419 RefPtrWillBeRawPtr<CSSPrimitiveValue> direction; | 5433 RefPtrWillBeRawPtr<CSSPrimitiveValue> direction = nullptr; |
5420 switch (val->id) { | 5434 switch (val->id) { |
5421 case CSSValueAbove: | 5435 case CSSValueAbove: |
5422 case CSSValueBelow: | 5436 case CSSValueBelow: |
5423 case CSSValueLeft: | 5437 case CSSValueLeft: |
5424 case CSSValueRight: | 5438 case CSSValueRight: |
5425 direction = cssValuePool().createIdentifierValue(val->id); | 5439 direction = cssValuePool().createIdentifierValue(val->id); |
5426 break; | 5440 break; |
5427 default: | 5441 default: |
5428 return false; | 5442 return false; |
5429 } | 5443 } |
5430 | 5444 |
5431 // The offset comes next. | 5445 // The offset comes next. |
5432 val = m_valueList->next(); | 5446 val = m_valueList->next(); |
5433 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset; | 5447 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr; |
5434 if (!val) | 5448 if (!val) |
5435 offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); | 5449 offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); |
5436 else { | 5450 else { |
5437 if (!validUnit(val, FLength | FPercent)) | 5451 if (!validUnit(val, FLength | FPercent)) |
5438 return false; | 5452 return false; |
5439 offset = createPrimitiveNumericValue(val); | 5453 offset = createPrimitiveNumericValue(val); |
5440 } | 5454 } |
5441 | 5455 |
5442 // Now for the mask. | 5456 // Now for the mask. |
5443 RefPtrWillBeRawPtr<CSSValue> mask; | 5457 RefPtrWillBeRawPtr<CSSValue> mask = nullptr; |
5444 val = m_valueList->next(); | 5458 val = m_valueList->next(); |
5445 if (val) { | 5459 if (val) { |
5446 mask = parseBorderImage(propId); | 5460 mask = parseBorderImage(propId); |
5447 if (!mask) | 5461 if (!mask) |
5448 return false; | 5462 return false; |
5449 } | 5463 } |
5450 | 5464 |
5451 RefPtrWillBeRawPtr<CSSReflectValue> reflectValue = CSSReflectValue::create(d irection.release(), offset.release(), mask.release()); | 5465 RefPtrWillBeRawPtr<CSSReflectValue> reflectValue = CSSReflectValue::create(d irection.release(), offset.release(), mask.release()); |
5452 addProperty(propId, reflectValue.release(), important); | 5466 addProperty(propId, reflectValue.release(), important); |
5453 m_valueList->next(); | 5467 m_valueList->next(); |
5454 return true; | 5468 return true; |
5455 } | 5469 } |
5456 | 5470 |
5457 bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important) | 5471 bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important) |
5458 { | 5472 { |
5459 if (!args || !args->size() || args->size() > 3) | 5473 if (!args || !args->size() || args->size() > 3) |
5460 return false; | 5474 return false; |
5461 static const double unsetValue = -1; | 5475 static const double unsetValue = -1; |
5462 double flexGrow = unsetValue; | 5476 double flexGrow = unsetValue; |
5463 double flexShrink = unsetValue; | 5477 double flexShrink = unsetValue; |
5464 RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis; | 5478 RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis = nullptr; |
5465 | 5479 |
5466 while (CSSParserValue* arg = args->current()) { | 5480 while (CSSParserValue* arg = args->current()) { |
5467 if (validUnit(arg, FNumber | FNonNeg)) { | 5481 if (validUnit(arg, FNumber | FNonNeg)) { |
5468 if (flexGrow == unsetValue) | 5482 if (flexGrow == unsetValue) |
5469 flexGrow = arg->fValue; | 5483 flexGrow = arg->fValue; |
5470 else if (flexShrink == unsetValue) | 5484 else if (flexShrink == unsetValue) |
5471 flexShrink = arg->fValue; | 5485 flexShrink = arg->fValue; |
5472 else if (!arg->fValue) { | 5486 else if (!arg->fValue) { |
5473 // flex only allows a basis of 0 (sans units) if flex-grow and f lex-shrink values have already been set. | 5487 // flex only allows a basis of 0 (sans units) if flex-grow and f lex-shrink values have already been set. |
5474 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS _PX); | 5488 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS _PX); |
(...skipping 18 matching lines...) Expand all Loading... | |
5493 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); | 5507 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); |
5494 | 5508 |
5495 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle xGrow), CSSPrimitiveValue::CSS_NUMBER), important); | 5509 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle xGrow), CSSPrimitiveValue::CSS_NUMBER), important); |
5496 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f lexShrink), CSSPrimitiveValue::CSS_NUMBER), important); | 5510 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f lexShrink), CSSPrimitiveValue::CSS_NUMBER), important); |
5497 addProperty(CSSPropertyFlexBasis, flexBasis, important); | 5511 addProperty(CSSPropertyFlexBasis, flexBasis, important); |
5498 return true; | 5512 return true; |
5499 } | 5513 } |
5500 | 5514 |
5501 bool CSSPropertyParser::parseObjectPosition(bool important) | 5515 bool CSSPropertyParser::parseObjectPosition(bool important) |
5502 { | 5516 { |
5503 RefPtrWillBeRawPtr<CSSValue> xValue; | 5517 RefPtrWillBeRawPtr<CSSValue> xValue = nullptr; |
5504 RefPtrWillBeRawPtr<CSSValue> yValue; | 5518 RefPtrWillBeRawPtr<CSSValue> yValue = nullptr; |
5505 parseFillPosition(m_valueList.get(), xValue, yValue); | 5519 parseFillPosition(m_valueList.get(), xValue, yValue); |
5506 if (!xValue || !yValue) | 5520 if (!xValue || !yValue) |
5507 return false; | 5521 return false; |
5508 addProperty( | 5522 addProperty( |
5509 CSSPropertyObjectPosition, | 5523 CSSPropertyObjectPosition, |
5510 createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimiti veValue(yValue.get()), Pair::KeepIdenticalValues), | 5524 createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimiti veValue(yValue.get()), Pair::KeepIdenticalValues), |
5511 important); | 5525 important); |
5512 return true; | 5526 return true; |
5513 } | 5527 } |
5514 | 5528 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5633 | 5647 |
5634 bool m_allowCommit; | 5648 bool m_allowCommit; |
5635 bool m_allowImage; | 5649 bool m_allowImage; |
5636 bool m_allowImageSlice; | 5650 bool m_allowImageSlice; |
5637 bool m_allowRepeat; | 5651 bool m_allowRepeat; |
5638 bool m_allowForwardSlashOperator; | 5652 bool m_allowForwardSlashOperator; |
5639 | 5653 |
5640 bool m_requireWidth; | 5654 bool m_requireWidth; |
5641 bool m_requireOutset; | 5655 bool m_requireOutset; |
5642 | 5656 |
5643 RefPtrWillBeRawPtr<CSSValue> m_image; | 5657 RefPtrWillBeRawPtr<CSSValue> m_image = nullptr; |
5644 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice; | 5658 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice = nullptr; |
5645 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_borderSlice; | 5659 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_borderSlice = nullptr; |
5646 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_outset; | 5660 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_outset = nullptr; |
5647 | 5661 |
5648 RefPtrWillBeRawPtr<CSSValue> m_repeat; | 5662 RefPtrWillBeRawPtr<CSSValue> m_repeat = nullptr; |
haraken
2014/03/24 13:52:54
Ditto.
Mads Ager (chromium)
2014/03/24 14:27:30
Yes, good catch. This is stack allocated as well.
| |
5649 }; | 5663 }; |
5650 | 5664 |
5651 bool BorderImageParseContext::buildFromParser(CSSPropertyParser& parser, CSSProp ertyID propId, BorderImageParseContext& context) | 5665 bool BorderImageParseContext::buildFromParser(CSSPropertyParser& parser, CSSProp ertyID propId, BorderImageParseContext& context) |
5652 { | 5666 { |
5653 CSSPropertyParser::ShorthandScope scope(&parser, propId); | 5667 CSSPropertyParser::ShorthandScope scope(&parser, propId); |
5654 while (CSSParserValue* val = parser.m_valueList->current()) { | 5668 while (CSSParserValue* val = parser.m_valueList->current()) { |
5655 context.setCanAdvance(false); | 5669 context.setCanAdvance(false); |
5656 | 5670 |
5657 if (!context.canAdvance() && context.allowForwardSlashOperator() && isFo rwardSlashOperator(val)) | 5671 if (!context.canAdvance() && context.allowForwardSlashOperator() && isFo rwardSlashOperator(val)) |
5658 context.commitForwardSlashOperator(); | 5672 context.commitForwardSlashOperator(); |
5659 | 5673 |
5660 if (!context.canAdvance() && context.allowImage()) { | 5674 if (!context.canAdvance() && context.allowImage()) { |
5661 if (val->unit == CSSPrimitiveValue::CSS_URI) { | 5675 if (val->unit == CSSPrimitiveValue::CSS_URI) { |
5662 context.commitImage(CSSImageValue::create(val->string, parser.m_ context.completeURL(val->string))); | 5676 context.commitImage(CSSImageValue::create(val->string, parser.m_ context.completeURL(val->string))); |
5663 } else if (isGeneratedImageValue(val)) { | 5677 } else if (isGeneratedImageValue(val)) { |
5664 RefPtrWillBeRawPtr<CSSValue> value; | 5678 RefPtrWillBeRawPtr<CSSValue> value = nullptr; |
5665 if (parser.parseGeneratedImage(parser.m_valueList.get(), value)) | 5679 if (parser.parseGeneratedImage(parser.m_valueList.get(), value)) |
5666 context.commitImage(value.release()); | 5680 context.commitImage(value.release()); |
5667 else | 5681 else |
5668 return false; | 5682 return false; |
5669 } else if (val->unit == CSSParserValue::Function && equalIgnoringCas e(val->function->name, "-webkit-image-set(")) { | 5683 } else if (val->unit == CSSParserValue::Function && equalIgnoringCas e(val->function->name, "-webkit-image-set(")) { |
5670 RefPtrWillBeRawPtr<CSSValue> value = parser.parseImageSet(parser .m_valueList.get()); | 5684 RefPtrWillBeRawPtr<CSSValue> value = parser.parseImageSet(parser .m_valueList.get()); |
5671 if (value) | 5685 if (value) |
5672 context.commitImage(value.release()); | 5686 context.commitImage(value.release()); |
5673 else | 5687 else |
5674 return false; | 5688 return false; |
5675 } else if (val->id == CSSValueNone) | 5689 } else if (val->id == CSSValueNone) |
5676 context.commitImage(cssValuePool().createIdentifierValue(CSSValu eNone)); | 5690 context.commitImage(cssValuePool().createIdentifierValue(CSSValu eNone)); |
5677 } | 5691 } |
5678 | 5692 |
5679 if (!context.canAdvance() && context.allowImageSlice()) { | 5693 if (!context.canAdvance() && context.allowImageSlice()) { |
5680 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlice; | 5694 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlice = nullptr; |
5681 if (parser.parseBorderImageSlice(propId, imageSlice)) | 5695 if (parser.parseBorderImageSlice(propId, imageSlice)) |
5682 context.commitImageSlice(imageSlice.release()); | 5696 context.commitImageSlice(imageSlice.release()); |
5683 } | 5697 } |
5684 | 5698 |
5685 if (!context.canAdvance() && context.allowRepeat()) { | 5699 if (!context.canAdvance() && context.allowRepeat()) { |
5686 RefPtrWillBeRawPtr<CSSValue> repeat; | 5700 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; |
5687 if (parser.parseBorderImageRepeat(repeat)) | 5701 if (parser.parseBorderImageRepeat(repeat)) |
5688 context.commitRepeat(repeat.release()); | 5702 context.commitRepeat(repeat.release()); |
5689 } | 5703 } |
5690 | 5704 |
5691 if (!context.canAdvance() && context.requireWidth()) { | 5705 if (!context.canAdvance() && context.requireWidth()) { |
5692 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice; | 5706 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice = nullptr; |
5693 if (parser.parseBorderImageWidth(borderSlice)) | 5707 if (parser.parseBorderImageWidth(borderSlice)) |
5694 context.commitBorderWidth(borderSlice.release()); | 5708 context.commitBorderWidth(borderSlice.release()); |
5695 } | 5709 } |
5696 | 5710 |
5697 if (!context.canAdvance() && context.requireOutset()) { | 5711 if (!context.canAdvance() && context.requireOutset()) { |
5698 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset; | 5712 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; |
5699 if (parser.parseBorderImageOutset(borderOutset)) | 5713 if (parser.parseBorderImageOutset(borderOutset)) |
5700 context.commitBorderOutset(borderOutset.release()); | 5714 context.commitBorderOutset(borderOutset.release()); |
5701 } | 5715 } |
5702 | 5716 |
5703 if (!context.canAdvance()) | 5717 if (!context.canAdvance()) |
5704 return false; | 5718 return false; |
5705 | 5719 |
5706 parser.m_valueList->next(); | 5720 parser.m_valueList->next(); |
5707 } | 5721 } |
5708 | 5722 |
(...skipping 28 matching lines...) Expand all Loading... | |
5737 return nullptr; | 5751 return nullptr; |
5738 } | 5752 } |
5739 | 5753 |
5740 static bool isBorderImageRepeatKeyword(int id) | 5754 static bool isBorderImageRepeatKeyword(int id) |
5741 { | 5755 { |
5742 return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace || id == CSSValueRound; | 5756 return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace || id == CSSValueRound; |
5743 } | 5757 } |
5744 | 5758 |
5745 bool CSSPropertyParser::parseBorderImageRepeat(RefPtrWillBeRawPtr<CSSValue>& res ult) | 5759 bool CSSPropertyParser::parseBorderImageRepeat(RefPtrWillBeRawPtr<CSSValue>& res ult) |
5746 { | 5760 { |
5747 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue; | 5761 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue = nullptr; |
5748 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue; | 5762 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue = nullptr; |
5749 CSSParserValue* val = m_valueList->current(); | 5763 CSSParserValue* val = m_valueList->current(); |
5750 if (!val) | 5764 if (!val) |
5751 return false; | 5765 return false; |
5752 if (isBorderImageRepeatKeyword(val->id)) | 5766 if (isBorderImageRepeatKeyword(val->id)) |
5753 firstValue = cssValuePool().createIdentifierValue(val->id); | 5767 firstValue = cssValuePool().createIdentifierValue(val->id); |
5754 else | 5768 else |
5755 return false; | 5769 return false; |
5756 | 5770 |
5757 val = m_valueList->next(); | 5771 val = m_valueList->next(); |
5758 if (val) { | 5772 if (val) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5837 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad. release()), m_fill); | 5851 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad. release()), m_fill); |
5838 } | 5852 } |
5839 | 5853 |
5840 private: | 5854 private: |
5841 CSSPropertyParser* m_parser; | 5855 CSSPropertyParser* m_parser; |
5842 | 5856 |
5843 bool m_allowNumber; | 5857 bool m_allowNumber; |
5844 bool m_allowFill; | 5858 bool m_allowFill; |
5845 bool m_allowFinalCommit; | 5859 bool m_allowFinalCommit; |
5846 | 5860 |
5847 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top; | 5861 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top = nullptr; |
5848 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right; | 5862 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right = nullptr; |
5849 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom; | 5863 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom = nullptr; |
5850 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left; | 5864 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left = nullptr; |
haraken
2014/03/24 13:52:54
Ditto.
Mads Ager (chromium)
2014/03/24 14:27:30
Yes.
| |
5851 | 5865 |
5852 bool m_fill; | 5866 bool m_fill; |
5853 }; | 5867 }; |
5854 | 5868 |
5855 bool CSSPropertyParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBe RawPtr<CSSBorderImageSliceValue>& result) | 5869 bool CSSPropertyParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBe RawPtr<CSSBorderImageSliceValue>& result) |
5856 { | 5870 { |
5857 BorderImageSliceParseContext context(this); | 5871 BorderImageSliceParseContext context(this); |
5858 CSSParserValue* val; | 5872 CSSParserValue* val; |
5859 while ((val = m_valueList->current())) { | 5873 while ((val = m_valueList->current())) { |
5860 // FIXME calc() http://webkit.org/b/16662 : calc is parsed but values ar e not created yet. | 5874 // FIXME calc() http://webkit.org/b/16662 : calc is parsed but values ar e not created yet. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5897 , m_allowNumber(true) | 5911 , m_allowNumber(true) |
5898 , m_allowFinalCommit(false) | 5912 , m_allowFinalCommit(false) |
5899 { } | 5913 { } |
5900 | 5914 |
5901 bool allowNumber() const { return m_allowNumber; } | 5915 bool allowNumber() const { return m_allowNumber; } |
5902 bool allowFinalCommit() const { return m_allowFinalCommit; } | 5916 bool allowFinalCommit() const { return m_allowFinalCommit; } |
5903 CSSPrimitiveValue* top() const { return m_top.get(); } | 5917 CSSPrimitiveValue* top() const { return m_top.get(); } |
5904 | 5918 |
5905 void commitNumber(CSSParserValue* v) | 5919 void commitNumber(CSSParserValue* v) |
5906 { | 5920 { |
5907 RefPtrWillBeRawPtr<CSSPrimitiveValue> val; | 5921 RefPtrWillBeRawPtr<CSSPrimitiveValue> val = nullptr; |
5908 if (v->id == CSSValueAuto) | 5922 if (v->id == CSSValueAuto) |
5909 val = cssValuePool().createIdentifierValue(v->id); | 5923 val = cssValuePool().createIdentifierValue(v->id); |
5910 else | 5924 else |
5911 val = m_parser->createPrimitiveNumericValue(v); | 5925 val = m_parser->createPrimitiveNumericValue(v); |
5912 | 5926 |
5913 if (!m_top) | 5927 if (!m_top) |
5914 m_top = val; | 5928 m_top = val; |
5915 else if (!m_right) | 5929 else if (!m_right) |
5916 m_right = val; | 5930 m_right = val; |
5917 else if (!m_bottom) | 5931 else if (!m_bottom) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5954 // Make our new value now. | 5968 // Make our new value now. |
5955 return cssValuePool().createValue(quad.release()); | 5969 return cssValuePool().createValue(quad.release()); |
5956 } | 5970 } |
5957 | 5971 |
5958 private: | 5972 private: |
5959 CSSPropertyParser* m_parser; | 5973 CSSPropertyParser* m_parser; |
5960 | 5974 |
5961 bool m_allowNumber; | 5975 bool m_allowNumber; |
5962 bool m_allowFinalCommit; | 5976 bool m_allowFinalCommit; |
5963 | 5977 |
5964 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top; | 5978 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top = nullptr; |
5965 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right; | 5979 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right = nullptr; |
5966 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom; | 5980 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom = nullptr; |
5967 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left; | 5981 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left = nullptr; |
haraken
2014/03/24 13:52:54
Ditto.
Mads Ager (chromium)
2014/03/24 14:27:30
And yes. :)
| |
5968 }; | 5982 }; |
5969 | 5983 |
5970 bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPt r<CSSPrimitiveValue>& result) | 5984 bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPt r<CSSPrimitiveValue>& result) |
5971 { | 5985 { |
5972 BorderImageQuadParseContext context(this); | 5986 BorderImageQuadParseContext context(this); |
5973 CSSParserValue* val; | 5987 CSSParserValue* val; |
5974 while ((val = m_valueList->current())) { | 5988 while ((val = m_valueList->current())) { |
5975 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod e) || val->id == CSSValueAuto)) { | 5989 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod e) || val->id == CSSValueAuto)) { |
5976 context.commitNumber(val); | 5990 context.commitNumber(val); |
5977 } else if (!inShorthand()) { | 5991 } else if (!inShorthand()) { |
(...skipping 26 matching lines...) Expand all Loading... | |
6004 } | 6018 } |
6005 | 6019 |
6006 bool CSSPropertyParser::parseBorderRadius(CSSPropertyID propId, bool important) | 6020 bool CSSPropertyParser::parseBorderRadius(CSSPropertyID propId, bool important) |
6007 { | 6021 { |
6008 unsigned num = m_valueList->size(); | 6022 unsigned num = m_valueList->size(); |
6009 if (num > 9) | 6023 if (num > 9) |
6010 return false; | 6024 return false; |
6011 | 6025 |
6012 ShorthandScope scope(this, propId); | 6026 ShorthandScope scope(this, propId); |
6013 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4]; | 6027 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4]; |
6028 #if ENABLE(OILPAN) | |
6029 // Zero initialize the array of raw pointers. | |
6030 memset(&radii, 0, sizeof(radii)); | |
6031 #endif | |
6014 | 6032 |
6015 unsigned indexAfterSlash = 0; | 6033 unsigned indexAfterSlash = 0; |
6016 for (unsigned i = 0; i < num; ++i) { | 6034 for (unsigned i = 0; i < num; ++i) { |
6017 CSSParserValue* value = m_valueList->valueAt(i); | 6035 CSSParserValue* value = m_valueList->valueAt(i); |
6018 if (value->unit == CSSParserValue::Operator) { | 6036 if (value->unit == CSSParserValue::Operator) { |
6019 if (value->iValue != '/') | 6037 if (value->iValue != '/') |
6020 return false; | 6038 return false; |
6021 | 6039 |
6022 if (!i || indexAfterSlash || i + 1 == num || num > i + 5) | 6040 if (!i || indexAfterSlash || i + 1 == num || num > i + 5) |
6023 return false; | 6041 return false; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6089 addProperty(CSSPropertyWebkitAspectRatio, CSSAspectRatioValue::create(narrow PrecisionToFloat(lvalue->fValue), narrowPrecisionToFloat(rvalue->fValue)), impor tant); | 6107 addProperty(CSSPropertyWebkitAspectRatio, CSSAspectRatioValue::create(narrow PrecisionToFloat(lvalue->fValue), narrowPrecisionToFloat(rvalue->fValue)), impor tant); |
6090 | 6108 |
6091 return true; | 6109 return true; |
6092 } | 6110 } |
6093 | 6111 |
6094 bool CSSPropertyParser::parseCounter(CSSPropertyID propId, int defaultValue, boo l important) | 6112 bool CSSPropertyParser::parseCounter(CSSPropertyID propId, int defaultValue, boo l important) |
6095 { | 6113 { |
6096 enum { ID, VAL } state = ID; | 6114 enum { ID, VAL } state = ID; |
6097 | 6115 |
6098 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; | 6116 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; |
6099 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName; | 6117 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = nullptr; |
6100 | 6118 |
6101 while (true) { | 6119 while (true) { |
6102 CSSParserValue* val = m_valueList->current(); | 6120 CSSParserValue* val = m_valueList->current(); |
6103 switch (state) { | 6121 switch (state) { |
6104 case ID: | 6122 case ID: |
6105 if (val && val->unit == CSSPrimitiveValue::CSS_IDENT) { | 6123 if (val && val->unit == CSSPrimitiveValue::CSS_IDENT) { |
6106 counterName = createPrimitiveStringValue(val); | 6124 counterName = createPrimitiveStringValue(val); |
6107 state = VAL; | 6125 state = VAL; |
6108 m_valueList->next(); | 6126 m_valueList->next(); |
6109 continue; | 6127 continue; |
(...skipping 19 matching lines...) Expand all Loading... | |
6129 addProperty(propId, list.release(), important); | 6147 addProperty(propId, list.release(), important); |
6130 return true; | 6148 return true; |
6131 } | 6149 } |
6132 | 6150 |
6133 return false; | 6151 return false; |
6134 } | 6152 } |
6135 | 6153 |
6136 // This should go away once we drop support for -webkit-gradient | 6154 // This should go away once we drop support for -webkit-gradient |
6137 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CS SParserValue* a, bool horizontal) | 6155 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CS SParserValue* a, bool horizontal) |
6138 { | 6156 { |
6139 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; | 6157 RefPtrWillBeRawPtr<CSSPrimitiveValue> result = nullptr; |
6140 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { | 6158 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { |
6141 if ((equalIgnoringCase(a, "left") && horizontal) | 6159 if ((equalIgnoringCase(a, "left") && horizontal) |
6142 || (equalIgnoringCase(a, "top") && !horizontal)) | 6160 || (equalIgnoringCase(a, "top") && !horizontal)) |
6143 result = cssValuePool().createValue(0., CSSPrimitiveValue::CSS_PERCE NTAGE); | 6161 result = cssValuePool().createValue(0., CSSPrimitiveValue::CSS_PERCE NTAGE); |
6144 else if ((equalIgnoringCase(a, "right") && horizontal) | 6162 else if ((equalIgnoringCase(a, "right") && horizontal) |
6145 || (equalIgnoringCase(a, "bottom") && !horizontal)) | 6163 || (equalIgnoringCase(a, "bottom") && !horizontal)) |
6146 result = cssValuePool().createValue(100., CSSPrimitiveValue::CSS_PER CENTAGE); | 6164 result = cssValuePool().createValue(100., CSSPrimitiveValue::CSS_PER CENTAGE); |
6147 else if (equalIgnoringCase(a, "center")) | 6165 else if (equalIgnoringCase(a, "center")) |
6148 result = cssValuePool().createValue(50., CSSPrimitiveValue::CSS_PERC ENTAGE); | 6166 result = cssValuePool().createValue(50., CSSPrimitiveValue::CSS_PERC ENTAGE); |
6149 } else if (a->unit == CSSPrimitiveValue::CSS_NUMBER || a->unit == CSSPrimiti veValue::CSS_PERCENTAGE) | 6167 } else if (a->unit == CSSPrimitiveValue::CSS_NUMBER || a->unit == CSSPrimiti veValue::CSS_PERCENTAGE) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6227 CSSParserValue* a = args->current(); | 6245 CSSParserValue* a = args->current(); |
6228 if (!a || a->unit != CSSPrimitiveValue::CSS_IDENT) | 6246 if (!a || a->unit != CSSPrimitiveValue::CSS_IDENT) |
6229 return false; | 6247 return false; |
6230 if (equalIgnoringCase(a, "linear")) | 6248 if (equalIgnoringCase(a, "linear")) |
6231 gradientType = CSSDeprecatedLinearGradient; | 6249 gradientType = CSSDeprecatedLinearGradient; |
6232 else if (equalIgnoringCase(a, "radial")) | 6250 else if (equalIgnoringCase(a, "radial")) |
6233 gradientType = CSSDeprecatedRadialGradient; | 6251 gradientType = CSSDeprecatedRadialGradient; |
6234 else | 6252 else |
6235 return false; | 6253 return false; |
6236 | 6254 |
6237 RefPtrWillBeRawPtr<CSSGradientValue> result; | 6255 RefPtrWillBeRawPtr<CSSGradientValue> result = nullptr; |
6238 switch (gradientType) { | 6256 switch (gradientType) { |
6239 case CSSDeprecatedLinearGradient: | 6257 case CSSDeprecatedLinearGradient: |
6240 result = CSSLinearGradientValue::create(NonRepeating, gradientType); | 6258 result = CSSLinearGradientValue::create(NonRepeating, gradientType); |
6241 break; | 6259 break; |
6242 case CSSDeprecatedRadialGradient: | 6260 case CSSDeprecatedRadialGradient: |
6243 result = CSSRadialGradientValue::create(NonRepeating, gradientType); | 6261 result = CSSRadialGradientValue::create(NonRepeating, gradientType); |
6244 break; | 6262 break; |
6245 default: | 6263 default: |
6246 // The rest of the gradient types shouldn't appear here. | 6264 // The rest of the gradient types shouldn't appear here. |
6247 ASSERT_NOT_REACHED(); | 6265 ASSERT_NOT_REACHED(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6392 | 6410 |
6393 bool expectComma = false; | 6411 bool expectComma = false; |
6394 // Look for angle. | 6412 // Look for angle. |
6395 if (validUnit(a, FAngle, HTMLStandardMode)) { | 6413 if (validUnit(a, FAngle, HTMLStandardMode)) { |
6396 result->setAngle(createPrimitiveNumericValue(a)); | 6414 result->setAngle(createPrimitiveNumericValue(a)); |
6397 | 6415 |
6398 args->next(); | 6416 args->next(); |
6399 expectComma = true; | 6417 expectComma = true; |
6400 } else { | 6418 } else { |
6401 // Look one or two optional keywords that indicate a side or corner. | 6419 // Look one or two optional keywords that indicate a side or corner. |
6402 RefPtrWillBeRawPtr<CSSPrimitiveValue> startX, startY; | 6420 RefPtrWillBeRawPtr<CSSPrimitiveValue> startX = nullptr; |
6421 RefPtrWillBeRawPtr<CSSPrimitiveValue> startY = nullptr; | |
6403 | 6422 |
6404 RefPtrWillBeRawPtr<CSSPrimitiveValue> location; | 6423 RefPtrWillBeRawPtr<CSSPrimitiveValue> location = nullptr; |
6405 bool isHorizontal = false; | 6424 bool isHorizontal = false; |
6406 if ((location = valueFromSideKeyword(a, isHorizontal))) { | 6425 if ((location = valueFromSideKeyword(a, isHorizontal))) { |
6407 if (isHorizontal) | 6426 if (isHorizontal) |
6408 startX = location; | 6427 startX = location; |
6409 else | 6428 else |
6410 startY = location; | 6429 startY = location; |
6411 | 6430 |
6412 if ((a = args->next())) { | 6431 if ((a = args->next())) { |
6413 if ((location = valueFromSideKeyword(a, isHorizontal))) { | 6432 if ((location = valueFromSideKeyword(a, isHorizontal))) { |
6414 if (isHorizontal) { | 6433 if (isHorizontal) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6454 if (!args || !args->size()) | 6473 if (!args || !args->size()) |
6455 return false; | 6474 return false; |
6456 | 6475 |
6457 CSSParserValue* a = args->current(); | 6476 CSSParserValue* a = args->current(); |
6458 if (!a) | 6477 if (!a) |
6459 return false; | 6478 return false; |
6460 | 6479 |
6461 bool expectComma = false; | 6480 bool expectComma = false; |
6462 | 6481 |
6463 // Optional background-position | 6482 // Optional background-position |
6464 RefPtrWillBeRawPtr<CSSValue> centerX; | 6483 RefPtrWillBeRawPtr<CSSValue> centerX = nullptr; |
6465 RefPtrWillBeRawPtr<CSSValue> centerY; | 6484 RefPtrWillBeRawPtr<CSSValue> centerY = nullptr; |
6466 // parse2ValuesFillPosition advances the args next pointer. | 6485 // parse2ValuesFillPosition advances the args next pointer. |
6467 parse2ValuesFillPosition(args, centerX, centerY); | 6486 parse2ValuesFillPosition(args, centerX, centerY); |
6468 a = args->current(); | 6487 a = args->current(); |
6469 if (!a) | 6488 if (!a) |
6470 return false; | 6489 return false; |
6471 | 6490 |
6472 if (centerX || centerY) { | 6491 if (centerX || centerY) { |
6473 // Comma | 6492 // Comma |
6474 if (!isComma(a)) | 6493 if (!isComma(a)) |
6475 return false; | 6494 return false; |
6476 | 6495 |
6477 a = args->next(); | 6496 a = args->next(); |
6478 if (!a) | 6497 if (!a) |
6479 return false; | 6498 return false; |
6480 } | 6499 } |
6481 | 6500 |
6482 result->setFirstX(toCSSPrimitiveValue(centerX.get())); | 6501 result->setFirstX(toCSSPrimitiveValue(centerX.get())); |
6483 result->setSecondX(toCSSPrimitiveValue(centerX.get())); | 6502 result->setSecondX(toCSSPrimitiveValue(centerX.get())); |
6484 // CSS3 radial gradients always share the same start and end point. | 6503 // CSS3 radial gradients always share the same start and end point. |
6485 result->setFirstY(toCSSPrimitiveValue(centerY.get())); | 6504 result->setFirstY(toCSSPrimitiveValue(centerY.get())); |
6486 result->setSecondY(toCSSPrimitiveValue(centerY.get())); | 6505 result->setSecondY(toCSSPrimitiveValue(centerY.get())); |
6487 | 6506 |
6488 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; | 6507 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue = nullptr; |
6489 RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue; | 6508 RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue = nullptr; |
6490 | 6509 |
6491 // Optional shape and/or size in any order. | 6510 // Optional shape and/or size in any order. |
6492 for (int i = 0; i < 2; ++i) { | 6511 for (int i = 0; i < 2; ++i) { |
6493 if (a->unit != CSSPrimitiveValue::CSS_IDENT) | 6512 if (a->unit != CSSPrimitiveValue::CSS_IDENT) |
6494 break; | 6513 break; |
6495 | 6514 |
6496 bool foundValue = false; | 6515 bool foundValue = false; |
6497 switch (a->id) { | 6516 switch (a->id) { |
6498 case CSSValueCircle: | 6517 case CSSValueCircle: |
6499 case CSSValueEllipse: | 6518 case CSSValueEllipse: |
(...skipping 19 matching lines...) Expand all Loading... | |
6519 return false; | 6538 return false; |
6520 | 6539 |
6521 expectComma = true; | 6540 expectComma = true; |
6522 } | 6541 } |
6523 } | 6542 } |
6524 | 6543 |
6525 result->setShape(shapeValue); | 6544 result->setShape(shapeValue); |
6526 result->setSizingBehavior(sizeValue); | 6545 result->setSizingBehavior(sizeValue); |
6527 | 6546 |
6528 // Or, two lengths or percentages | 6547 // Or, two lengths or percentages |
6529 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize; | 6548 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize = nullptr; |
6530 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize; | 6549 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize = nullptr; |
6531 | 6550 |
6532 if (!shapeValue && !sizeValue) { | 6551 if (!shapeValue && !sizeValue) { |
6533 if (validUnit(a, FLength | FPercent)) { | 6552 if (validUnit(a, FLength | FPercent)) { |
6534 horizontalSize = createPrimitiveNumericValue(a); | 6553 horizontalSize = createPrimitiveNumericValue(a); |
6535 a = args->next(); | 6554 a = args->next(); |
6536 if (!a) | 6555 if (!a) |
6537 return false; | 6556 return false; |
6538 | 6557 |
6539 expectComma = true; | 6558 expectComma = true; |
6540 } | 6559 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6581 result->setAngle(createPrimitiveNumericValue(a)); | 6600 result->setAngle(createPrimitiveNumericValue(a)); |
6582 | 6601 |
6583 args->next(); | 6602 args->next(); |
6584 expectComma = true; | 6603 expectComma = true; |
6585 } else if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, " to")) { | 6604 } else if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, " to")) { |
6586 // to [ [left | right] || [top | bottom] ] | 6605 // to [ [left | right] || [top | bottom] ] |
6587 a = args->next(); | 6606 a = args->next(); |
6588 if (!a) | 6607 if (!a) |
6589 return false; | 6608 return false; |
6590 | 6609 |
6591 RefPtrWillBeRawPtr<CSSPrimitiveValue> endX, endY; | 6610 RefPtrWillBeRawPtr<CSSPrimitiveValue> endX = nullptr; |
6592 RefPtrWillBeRawPtr<CSSPrimitiveValue> location; | 6611 RefPtrWillBeRawPtr<CSSPrimitiveValue> endY = nullptr; |
6612 RefPtrWillBeRawPtr<CSSPrimitiveValue> location = nullptr; | |
6593 bool isHorizontal = false; | 6613 bool isHorizontal = false; |
6594 | 6614 |
6595 location = valueFromSideKeyword(a, isHorizontal); | 6615 location = valueFromSideKeyword(a, isHorizontal); |
6596 if (!location) | 6616 if (!location) |
6597 return false; | 6617 return false; |
6598 | 6618 |
6599 if (isHorizontal) | 6619 if (isHorizontal) |
6600 endX = location; | 6620 endX = location; |
6601 else | 6621 else |
6602 endY = location; | 6622 endY = location; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6642 CSSParserValueList* args = valueList->current()->function->args.get(); | 6662 CSSParserValueList* args = valueList->current()->function->args.get(); |
6643 if (!args || !args->size()) | 6663 if (!args || !args->size()) |
6644 return false; | 6664 return false; |
6645 | 6665 |
6646 CSSParserValue* a = args->current(); | 6666 CSSParserValue* a = args->current(); |
6647 if (!a) | 6667 if (!a) |
6648 return false; | 6668 return false; |
6649 | 6669 |
6650 bool expectComma = false; | 6670 bool expectComma = false; |
6651 | 6671 |
6652 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; | 6672 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue = nullptr; |
6653 RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue; | 6673 RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue = nullptr; |
6654 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize; | 6674 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize = nullptr; |
6655 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize; | 6675 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize = nullptr; |
6656 | 6676 |
6657 // First part of grammar, the size/shape clause: | 6677 // First part of grammar, the size/shape clause: |
6658 // [ circle || <length> ] | | 6678 // [ circle || <length> ] | |
6659 // [ ellipse || [ <length> | <percentage> ]{2} ] | | 6679 // [ ellipse || [ <length> | <percentage> ]{2} ] | |
6660 // [ [ circle | ellipse] || <size-keyword> ] | 6680 // [ [ circle | ellipse] || <size-keyword> ] |
6661 for (int i = 0; i < 3; ++i) { | 6681 for (int i = 0; i < 3; ++i) { |
6662 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { | 6682 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { |
6663 bool badIdent = false; | 6683 bool badIdent = false; |
6664 switch (a->id) { | 6684 switch (a->id) { |
6665 case CSSValueCircle: | 6685 case CSSValueCircle: |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6720 if (!verticalSize && horizontalSize && horizontalSize->isPercentage()) | 6740 if (!verticalSize && horizontalSize && horizontalSize->isPercentage()) |
6721 return false; | 6741 return false; |
6722 | 6742 |
6723 result->setShape(shapeValue); | 6743 result->setShape(shapeValue); |
6724 result->setSizingBehavior(sizeValue); | 6744 result->setSizingBehavior(sizeValue); |
6725 result->setEndHorizontalSize(horizontalSize); | 6745 result->setEndHorizontalSize(horizontalSize); |
6726 result->setEndVerticalSize(verticalSize); | 6746 result->setEndVerticalSize(verticalSize); |
6727 | 6747 |
6728 // Second part of grammar, the center-position clause: | 6748 // Second part of grammar, the center-position clause: |
6729 // at <position> | 6749 // at <position> |
6730 RefPtrWillBeRawPtr<CSSValue> centerX; | 6750 RefPtrWillBeRawPtr<CSSValue> centerX = nullptr; |
6731 RefPtrWillBeRawPtr<CSSValue> centerY; | 6751 RefPtrWillBeRawPtr<CSSValue> centerY = nullptr; |
6732 if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, "at")) { | 6752 if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, "at")) { |
6733 a = args->next(); | 6753 a = args->next(); |
6734 if (!a) | 6754 if (!a) |
6735 return false; | 6755 return false; |
6736 | 6756 |
6737 parseFillPosition(args, centerX, centerY); | 6757 parseFillPosition(args, centerX, centerY); |
6738 if (!(centerX && centerY)) | 6758 if (!(centerX && centerY)) |
6739 return false; | 6759 return false; |
6740 | 6760 |
6741 a = args->current(); | 6761 a = args->current(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6858 return false; | 6878 return false; |
6859 } | 6879 } |
6860 | 6880 |
6861 bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWill BeRawPtr<CSSValue>& crossfade) | 6881 bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWill BeRawPtr<CSSValue>& crossfade) |
6862 { | 6882 { |
6863 // Walk the arguments. | 6883 // Walk the arguments. |
6864 CSSParserValueList* args = valueList->current()->function->args.get(); | 6884 CSSParserValueList* args = valueList->current()->function->args.get(); |
6865 if (!args || args->size() != 5) | 6885 if (!args || args->size() != 5) |
6866 return false; | 6886 return false; |
6867 CSSParserValue* a = args->current(); | 6887 CSSParserValue* a = args->current(); |
6868 RefPtrWillBeRawPtr<CSSValue> fromImageValue; | 6888 RefPtrWillBeRawPtr<CSSValue> fromImageValue = nullptr; |
6869 RefPtrWillBeRawPtr<CSSValue> toImageValue; | 6889 RefPtrWillBeRawPtr<CSSValue> toImageValue = nullptr; |
6870 | 6890 |
6871 // The first argument is the "from" image. It is a fill image. | 6891 // The first argument is the "from" image. It is a fill image. |
6872 if (!a || !parseFillImage(args, fromImageValue)) | 6892 if (!a || !parseFillImage(args, fromImageValue)) |
6873 return false; | 6893 return false; |
6874 a = args->next(); | 6894 a = args->next(); |
6875 | 6895 |
6876 // Skip a comma | 6896 // Skip a comma |
6877 if (!isComma(a)) | 6897 if (!isComma(a)) |
6878 return false; | 6898 return false; |
6879 a = args->next(); | 6899 a = args->next(); |
6880 | 6900 |
6881 // The second argument is the "to" image. It is a fill image. | 6901 // The second argument is the "to" image. It is a fill image. |
6882 if (!a || !parseFillImage(args, toImageValue)) | 6902 if (!a || !parseFillImage(args, toImageValue)) |
6883 return false; | 6903 return false; |
6884 a = args->next(); | 6904 a = args->next(); |
6885 | 6905 |
6886 // Skip a comma | 6906 // Skip a comma |
6887 if (!isComma(a)) | 6907 if (!isComma(a)) |
6888 return false; | 6908 return false; |
6889 a = args->next(); | 6909 a = args->next(); |
6890 | 6910 |
6891 // The third argument is the crossfade value. It is a percentage or a fracti onal number. | 6911 // The third argument is the crossfade value. It is a percentage or a fracti onal number. |
6892 RefPtrWillBeRawPtr<CSSPrimitiveValue> percentage; | 6912 RefPtrWillBeRawPtr<CSSPrimitiveValue> percentage = nullptr; |
6893 if (!a) | 6913 if (!a) |
6894 return false; | 6914 return false; |
6895 | 6915 |
6896 if (a->unit == CSSPrimitiveValue::CSS_PERCENTAGE) | 6916 if (a->unit == CSSPrimitiveValue::CSS_PERCENTAGE) |
6897 percentage = cssValuePool().createValue(clampTo<double>(a->fValue / 100, 0, 1), CSSPrimitiveValue::CSS_NUMBER); | 6917 percentage = cssValuePool().createValue(clampTo<double>(a->fValue / 100, 0, 1), CSSPrimitiveValue::CSS_NUMBER); |
6898 else if (a->unit == CSSPrimitiveValue::CSS_NUMBER) | 6918 else if (a->unit == CSSPrimitiveValue::CSS_NUMBER) |
6899 percentage = cssValuePool().createValue(clampTo<double>(a->fValue, 0, 1) , CSSPrimitiveValue::CSS_NUMBER); | 6919 percentage = cssValuePool().createValue(clampTo<double>(a->fValue, 0, 1) , CSSPrimitiveValue::CSS_NUMBER); |
6900 else | 6920 else |
6901 return false; | 6921 return false; |
6902 | 6922 |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7399 return true; | 7419 return true; |
7400 default: | 7420 default: |
7401 return false; | 7421 return false; |
7402 } | 7422 } |
7403 } | 7423 } |
7404 | 7424 |
7405 bool CSSPropertyParser::parseTextEmphasisStyle(bool important) | 7425 bool CSSPropertyParser::parseTextEmphasisStyle(bool important) |
7406 { | 7426 { |
7407 unsigned valueListSize = m_valueList->size(); | 7427 unsigned valueListSize = m_valueList->size(); |
7408 | 7428 |
7409 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill; | 7429 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr; |
7410 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape; | 7430 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr; |
7411 | 7431 |
7412 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) { | 7432 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) { |
7413 if (value->unit == CSSPrimitiveValue::CSS_STRING) { | 7433 if (value->unit == CSSPrimitiveValue::CSS_STRING) { |
7414 if (fill || shape || (valueListSize != 1 && !inShorthand())) | 7434 if (fill || shape || (valueListSize != 1 && !inShorthand())) |
7415 return false; | 7435 return false; |
7416 addProperty(CSSPropertyWebkitTextEmphasisStyle, createPrimitiveStrin gValue(value), important); | 7436 addProperty(CSSPropertyWebkitTextEmphasisStyle, createPrimitiveStrin gValue(value), important); |
7417 m_valueList->next(); | 7437 m_valueList->next(); |
7418 return true; | 7438 return true; |
7419 } | 7439 } |
7420 | 7440 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7714 if (id == CSSValueZoom || id == CSSValueFixed) | 7734 if (id == CSSValueZoom || id == CSSValueFixed) |
7715 validPrimitive = true; | 7735 validPrimitive = true; |
7716 break; | 7736 break; |
7717 case CSSPropertyOrientation: // auto | portrait | landscape | 7737 case CSSPropertyOrientation: // auto | portrait | landscape |
7718 if (id == CSSValueAuto || id == CSSValuePortrait || id == CSSValueLandsc ape) | 7738 if (id == CSSValueAuto || id == CSSValuePortrait || id == CSSValueLandsc ape) |
7719 validPrimitive = true; | 7739 validPrimitive = true; |
7720 default: | 7740 default: |
7721 break; | 7741 break; |
7722 } | 7742 } |
7723 | 7743 |
7724 RefPtrWillBeRawPtr<CSSValue> parsedValue; | 7744 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
7725 if (validPrimitive) { | 7745 if (validPrimitive) { |
7726 parsedValue = parseValidPrimitive(id, value); | 7746 parsedValue = parseValidPrimitive(id, value); |
7727 m_valueList->next(); | 7747 m_valueList->next(); |
7728 } | 7748 } |
7729 | 7749 |
7730 if (parsedValue) { | 7750 if (parsedValue) { |
7731 if (!m_valueList->current() || inShorthand()) { | 7751 if (!m_valueList->current() || inShorthand()) { |
7732 addProperty(propId, parsedValue.release(), important); | 7752 addProperty(propId, parsedValue.release(), important); |
7733 return true; | 7753 return true; |
7734 } | 7754 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7845 | 7865 |
7846 bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important) | 7866 bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important) |
7847 { | 7867 { |
7848 CSSParserValue* value = m_valueList->current(); | 7868 CSSParserValue* value = m_valueList->current(); |
7849 if (!value) | 7869 if (!value) |
7850 return false; | 7870 return false; |
7851 | 7871 |
7852 CSSValueID id = value->id; | 7872 CSSValueID id = value->id; |
7853 | 7873 |
7854 bool validPrimitive = false; | 7874 bool validPrimitive = false; |
7855 RefPtrWillBeRawPtr<CSSValue> parsedValue; | 7875 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
7856 | 7876 |
7857 switch (propId) { | 7877 switch (propId) { |
7858 /* The comment to the right defines all valid value of these | 7878 /* The comment to the right defines all valid value of these |
7859 * properties as defined in SVG 1.1, Appendix N. Property index */ | 7879 * properties as defined in SVG 1.1, Appendix N. Property index */ |
7860 case CSSPropertyAlignmentBaseline: | 7880 case CSSPropertyAlignmentBaseline: |
7861 // auto | baseline | before-edge | text-before-edge | middle | | 7881 // auto | baseline | before-edge | text-before-edge | middle | |
7862 // central | after-edge | text-after-edge | ideographic | alphabetic | | 7882 // central | after-edge | text-after-edge | ideographic | alphabetic | |
7863 // hanging | mathematical | inherit | 7883 // hanging | mathematical | inherit |
7864 if (id == CSSValueAuto || id == CSSValueBaseline || id == CSSValueMiddle | 7884 if (id == CSSValueAuto || id == CSSValueBaseline || id == CSSValueMiddle |
7865 || (id >= CSSValueBeforeEdge && id <= CSSValueMathematical)) | 7885 || (id >= CSSValueBeforeEdge && id <= CSSValueMathematical)) |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8217 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8237 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8218 if (!seenStroke) | 8238 if (!seenStroke) |
8219 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); | 8239 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); |
8220 if (!seenMarkers) | 8240 if (!seenMarkers) |
8221 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); | 8241 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); |
8222 | 8242 |
8223 return parsedValues.release(); | 8243 return parsedValues.release(); |
8224 } | 8244 } |
8225 | 8245 |
8226 } // namespace WebCore | 8246 } // namespace WebCore |
OLD | NEW |