 Chromium Code Reviews
 Chromium Code Reviews Issue 2903413002:
  Restructure type tracking in StyleValues to work better with new numeric types  (Closed)
    
  
    Issue 2903413002:
  Restructure type tracking in StyleValues to work better with new numeric types  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 { | 1 { | 
| 2 // This file specifies all the CSS properties we support and the necessary | 2 // This file specifies all the CSS properties we support and the necessary | 
| 3 // information for our code generation. The various supported arguments | 3 // information for our code generation. The various supported arguments | 
| 4 // are described below with example usage | 4 // are described below with example usage | 
| 5 | 5 | 
| 6 parameters: { | 6 parameters: { | 
| 7 // - alias_for: "other-property" | 7 // - alias_for: "other-property" | 
| 8 // Properties specifying alias_for should be virtually identical to the | 8 // Properties specifying alias_for should be virtually identical to the | 
| 9 // properties they alias. Minor parsing differences are allowed as long as | 9 // properties they alias. Minor parsing differences are allowed as long as | 
| 10 // the CSSValues created are of the same format of the aliased property. | 10 // the CSSValues created are of the same format of the aliased property. | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 default_value: { | 133 default_value: { | 
| 134 }, | 134 }, | 
| 135 | 135 | 
| 136 // Flags which go into CSSOMTypes: | 136 // Flags which go into CSSOMTypes: | 
| 137 // - typedom_types: ["Type", "OtherType"] | 137 // - typedom_types: ["Type", "OtherType"] | 
| 138 // The property can take types specified in typedom_types for CSS Typed OM. | 138 // The property can take types specified in typedom_types for CSS Typed OM. | 
| 139 // Keyword does not need to be specified as every property can take keywords . | 139 // Keyword does not need to be specified as every property can take keywords . | 
| 140 // - separator | 140 // - separator | 
| 141 // The property supports a list of values, and when there is more than one, | 141 // The property supports a list of values, and when there is more than one, | 
| 142 // it is separated with this character. | 142 // it is separated with this character. | 
| 143 // - supports_percentage | |
| 144 // The property supports percentage types. | |
| 145 typedom_types: { | 143 typedom_types: { | 
| 146 default: [], | 144 default: [], | 
| 145 valid_type: "list", | |
| 146 valid_values: [ | |
| 147 "Angle", | |
| 148 "Flex", | |
| 149 "Frequency", | |
| 150 "Length", | |
| 151 "Number", | |
| 152 "Percent", | |
| 
shend
2017/05/29 23:42:08
I like this way of handling %s.
 
meade_UTC10
2017/05/30 04:11:05
Acknowledged.
 | |
| 153 "Position", | |
| 154 "Resolution", | |
| 155 "Time", | |
| 156 "Transform", | |
| 157 "Unparsed", | |
| 158 "Image"], | |
| 
shend
2017/05/29 23:42:08
nit: '],' on the next line.
 
meade_UTC10
2017/05/30 04:11:05
Done.
 | |
| 147 }, | 159 }, | 
| 148 separator: { | 160 separator: { | 
| 149 valid_values: [",", " ", "/"], | 161 valid_values: [",", " ", "/"], | 
| 150 }, | 162 }, | 
| 151 supports_percentage: { | |
| 152 default: false, | |
| 153 valid_type: "bool", | |
| 154 }, | |
| 155 | 163 | 
| 156 // Flags which go into CSSPropertyMetadata: | 164 // Flags which go into CSSPropertyMetadata: | 
| 157 // - interpolable | 165 // - interpolable | 
| 158 // The interpolable flag indicates whether a property can be animated smooth ly. | 166 // The interpolable flag indicates whether a property can be animated smooth ly. | 
| 159 // If this flag is set, the property should also be added to the switch | 167 // If this flag is set, the property should also be added to the switch | 
| 160 // statements in AnimatedStyleBuilder, CSSPropertyEquality and | 168 // statements in AnimatedStyleBuilder, CSSPropertyEquality and | 
| 161 // CSSAnimatableValueFactory. | 169 // CSSAnimatableValueFactory. | 
| 162 // - inherited | 170 // - inherited | 
| 163 // The property will inherit by default if no value is specified, typically | 171 // The property will inherit by default if no value is specified, typically | 
| 164 // mentioned in specifications as "Inherited: yes" | 172 // mentioned in specifications as "Inherited: yes" | 
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 typedom_types: ["Image"], | 717 typedom_types: ["Image"], | 
| 710 field_group: "surround", | 718 field_group: "surround", | 
| 711 }, | 719 }, | 
| 712 { | 720 { | 
| 713 name: "border-bottom-width", | 721 name: "border-bottom-width", | 
| 714 api_class: "CSSPropertyAPIBorderWidth", | 722 api_class: "CSSPropertyAPIBorderWidth", | 
| 715 converter: "ConvertLineWidth<float>", | 723 converter: "ConvertLineWidth<float>", | 
| 716 initial: "InitialBorderWidth", | 724 initial: "InitialBorderWidth", | 
| 717 interpolable: true, | 725 interpolable: true, | 
| 718 keywords: ["thin", "medium", "thick"], | 726 keywords: ["thin", "medium", "thick"], | 
| 727 typedom_types: ["Length"], | |
| 719 field_template: "storage_only", | 728 field_template: "storage_only", | 
| 720 include_paths: ["platform/LayoutUnit.h"], | 729 include_paths: ["platform/LayoutUnit.h"], | 
| 721 type_name: "LayoutUnit", | 730 type_name: "LayoutUnit", | 
| 722 default_value: "LayoutUnit(3)", | 731 default_value: "LayoutUnit(3)", | 
| 723 field_group: "surround", | 732 field_group: "surround", | 
| 724 }, | 733 }, | 
| 725 { | 734 { | 
| 726 name: "border-collapse", | 735 name: "border-collapse", | 
| 727 independent: true, | 736 independent: true, | 
| 728 inherited: true, | 737 inherited: true, | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 781 typedom_types: ["Image"], | 790 typedom_types: ["Image"], | 
| 782 field_group: "surround", | 791 field_group: "surround", | 
| 783 }, | 792 }, | 
| 784 { | 793 { | 
| 785 name: "border-left-width", | 794 name: "border-left-width", | 
| 786 api_class: "CSSPropertyAPIBorderWidth", | 795 api_class: "CSSPropertyAPIBorderWidth", | 
| 787 converter: "ConvertLineWidth<float>", | 796 converter: "ConvertLineWidth<float>", | 
| 788 initial: "InitialBorderWidth", | 797 initial: "InitialBorderWidth", | 
| 789 interpolable: true, | 798 interpolable: true, | 
| 790 keywords: ["thin", "medium", "thick"], | 799 keywords: ["thin", "medium", "thick"], | 
| 800 typedom_types: ["Length"], | |
| 791 field_template: "storage_only", | 801 field_template: "storage_only", | 
| 792 include_paths: ["platform/LayoutUnit.h"], | 802 include_paths: ["platform/LayoutUnit.h"], | 
| 793 type_name: "LayoutUnit", | 803 type_name: "LayoutUnit", | 
| 794 default_value: "LayoutUnit(3)", | 804 default_value: "LayoutUnit(3)", | 
| 795 field_group: "surround", | 805 field_group: "surround", | 
| 796 }, | 806 }, | 
| 797 { | 807 { | 
| 798 name: "border-right-color", | 808 name: "border-right-color", | 
| 799 custom_all: true, | 809 custom_all: true, | 
| 800 interpolable: true, | 810 interpolable: true, | 
| (...skipping 12 matching lines...) Expand all Loading... | |
| 813 keywords: ["none", "hidden", "inset", "groove", "outset", "ridge", "dotted ", "dashed", "solid", "double"], | 823 keywords: ["none", "hidden", "inset", "groove", "outset", "ridge", "dotted ", "dashed", "solid", "double"], | 
| 814 field_group: "surround", | 824 field_group: "surround", | 
| 815 }, | 825 }, | 
| 816 { | 826 { | 
| 817 name: "border-right-width", | 827 name: "border-right-width", | 
| 818 api_class: "CSSPropertyAPIBorderWidth", | 828 api_class: "CSSPropertyAPIBorderWidth", | 
| 819 converter: "ConvertLineWidth<float>", | 829 converter: "ConvertLineWidth<float>", | 
| 820 initial: "InitialBorderWidth", | 830 initial: "InitialBorderWidth", | 
| 821 interpolable: true, | 831 interpolable: true, | 
| 822 keywords: ["thin", "medium", "thick"], | 832 keywords: ["thin", "medium", "thick"], | 
| 833 typedom_types: ["Length"], | |
| 823 field_template: "storage_only", | 834 field_template: "storage_only", | 
| 824 include_paths: ["platform/LayoutUnit.h"], | 835 include_paths: ["platform/LayoutUnit.h"], | 
| 825 type_name: "LayoutUnit", | 836 type_name: "LayoutUnit", | 
| 826 default_value: "LayoutUnit(3)", | 837 default_value: "LayoutUnit(3)", | 
| 827 field_group: "surround", | 838 field_group: "surround", | 
| 828 }, | 839 }, | 
| 829 { | 840 { | 
| 830 name: "border-top-color", | 841 name: "border-top-color", | 
| 831 custom_all: true, | 842 custom_all: true, | 
| 832 interpolable: true, | 843 interpolable: true, | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 869 typedom_types: ["Image"], | 880 typedom_types: ["Image"], | 
| 870 field_group: "surround", | 881 field_group: "surround", | 
| 871 }, | 882 }, | 
| 872 { | 883 { | 
| 873 name: "border-top-width", | 884 name: "border-top-width", | 
| 874 api_class: "CSSPropertyAPIBorderWidth", | 885 api_class: "CSSPropertyAPIBorderWidth", | 
| 875 converter: "ConvertLineWidth<float>", | 886 converter: "ConvertLineWidth<float>", | 
| 876 initial: "InitialBorderWidth", | 887 initial: "InitialBorderWidth", | 
| 877 interpolable: true, | 888 interpolable: true, | 
| 878 keywords: ["thin", "medium", "thick"], | 889 keywords: ["thin", "medium", "thick"], | 
| 879 supports_percentage: true, | 890 typedom_types: ["Length"], | 
| 
shend
2017/05/29 23:42:08
I would've though this is ["Length", "Percent"]? D
 
meade_UTC10
2017/05/30 04:11:05
Length does not imply percent, but as per the CL d
 | |
| 880 field_template: "storage_only", | 891 field_template: "storage_only", | 
| 881 include_paths: ["platform/LayoutUnit.h"], | 892 include_paths: ["platform/LayoutUnit.h"], | 
| 882 type_name: "LayoutUnit", | 893 type_name: "LayoutUnit", | 
| 883 default_value: "LayoutUnit(3)", | 894 default_value: "LayoutUnit(3)", | 
| 884 field_group: "surround", | 895 field_group: "surround", | 
| 885 }, | 896 }, | 
| 886 { | 897 { | 
| 887 name: "bottom", | 898 name: "bottom", | 
| 888 api_class: "CSSPropertyAPIMargin", | 899 api_class: "CSSPropertyAPIMargin", | 
| 889 api_methods: ["parseSingleValue"], | 900 api_methods: ["parseSingleValue"], | 
| 890 converter: "ConvertLengthOrAuto", | 901 converter: "ConvertLengthOrAuto", | 
| 891 interpolable: true, | 902 interpolable: true, | 
| 892 keywords: ["auto"], | 903 keywords: ["auto"], | 
| 893 supports_percentage: true, | |
| 894 field_template: "external", | 904 field_template: "external", | 
| 895 include_paths: ["platform/Length.h"], | 905 include_paths: ["platform/Length.h"], | 
| 896 type_name: "Length", | 906 type_name: "Length", | 
| 897 field_group: "surround", | 907 field_group: "surround", | 
| 898 default_value: "Length()", | 908 default_value: "Length()", | 
| 899 }, | 909 }, | 
| 900 { | 910 { | 
| 901 name: "box-shadow", | 911 name: "box-shadow", | 
| 902 converter: "ConvertShadowList", | 912 converter: "ConvertShadowList", | 
| 903 interpolable: true, | 913 interpolable: true, | 
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1254 custom_all: true, | 1264 custom_all: true, | 
| 1255 runtime_flag: "CSSGridLayout", | 1265 runtime_flag: "CSSGridLayout", | 
| 1256 }, | 1266 }, | 
| 1257 { | 1267 { | 
| 1258 name: "height", | 1268 name: "height", | 
| 1259 api_class: "CSSPropertyAPIWidthOrHeight", | 1269 api_class: "CSSPropertyAPIWidthOrHeight", | 
| 1260 converter: "ConvertLengthSizing", | 1270 converter: "ConvertLengthSizing", | 
| 1261 is_descriptor: true, | 1271 is_descriptor: true, | 
| 1262 interpolable: true, | 1272 interpolable: true, | 
| 1263 keywords: ["auto", "fit-content", "min-content", "max-content"], | 1273 keywords: ["auto", "fit-content", "min-content", "max-content"], | 
| 1264 supports_percentage: true, | |
| 1265 field_template: "external", | 1274 field_template: "external", | 
| 1266 include_paths: ["platform/Length.h"], | 1275 include_paths: ["platform/Length.h"], | 
| 1267 type_name: "Length", | 1276 type_name: "Length", | 
| 1268 field_group: "box", | 1277 field_group: "box", | 
| 1269 default_value: "Length()", | 1278 default_value: "Length()", | 
| 1270 }, | 1279 }, | 
| 1271 { | 1280 { | 
| 1272 name: "hyphens", | 1281 name: "hyphens", | 
| 1273 inherited: true, | 1282 inherited: true, | 
| 1274 runtime_flag: "CSSHyphens", | 1283 runtime_flag: "CSSHyphens", | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1320 initial: "InitialSelfAlignment", | 1329 initial: "InitialSelfAlignment", | 
| 1321 runtime_flag: "CSSGridLayout", | 1330 runtime_flag: "CSSGridLayout", | 
| 1322 }, | 1331 }, | 
| 1323 { | 1332 { | 
| 1324 name: "left", | 1333 name: "left", | 
| 1325 api_class: "CSSPropertyAPIMargin", | 1334 api_class: "CSSPropertyAPIMargin", | 
| 1326 api_methods: ["parseSingleValue"], | 1335 api_methods: ["parseSingleValue"], | 
| 1327 converter: "ConvertLengthOrAuto", | 1336 converter: "ConvertLengthOrAuto", | 
| 1328 interpolable: true, | 1337 interpolable: true, | 
| 1329 keywords: ["auto"], | 1338 keywords: ["auto"], | 
| 1330 supports_percentage: true, | |
| 1331 field_template: "external", | 1339 field_template: "external", | 
| 1332 include_paths: ["platform/Length.h"], | 1340 include_paths: ["platform/Length.h"], | 
| 1333 type_name: "Length", | 1341 type_name: "Length", | 
| 1334 field_group: "surround", | 1342 field_group: "surround", | 
| 1335 default_value: "Length()", | 1343 default_value: "Length()", | 
| 1336 }, | 1344 }, | 
| 1337 { | 1345 { | 
| 1338 name: "letter-spacing", | 1346 name: "letter-spacing", | 
| 1339 api_class: "CSSPropertyAPILetterAndWordSpacing", | 1347 api_class: "CSSPropertyAPILetterAndWordSpacing", | 
| 1340 api_methods: ["parseSingleValue"], | 1348 api_methods: ["parseSingleValue"], | 
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1781 name: "resize", | 1789 name: "resize", | 
| 1782 custom_value: true, | 1790 custom_value: true, | 
| 1783 }, | 1791 }, | 
| 1784 { | 1792 { | 
| 1785 name: "right", | 1793 name: "right", | 
| 1786 api_class: "CSSPropertyAPIMargin", | 1794 api_class: "CSSPropertyAPIMargin", | 
| 1787 api_methods: ["parseSingleValue"], | 1795 api_methods: ["parseSingleValue"], | 
| 1788 converter: "ConvertLengthOrAuto", | 1796 converter: "ConvertLengthOrAuto", | 
| 1789 interpolable: true, | 1797 interpolable: true, | 
| 1790 keywords: ["auto"], | 1798 keywords: ["auto"], | 
| 1791 supports_percentage: true, | |
| 1792 field_template: "external", | 1799 field_template: "external", | 
| 1793 include_paths: ["platform/Length.h"], | 1800 include_paths: ["platform/Length.h"], | 
| 1794 type_name: "Length", | 1801 type_name: "Length", | 
| 1795 field_group: "surround", | 1802 field_group: "surround", | 
| 1796 default_value: "Length()", | 1803 default_value: "Length()", | 
| 1797 }, | 1804 }, | 
| 1798 { | 1805 { | 
| 1799 name: "r", | 1806 name: "r", | 
| 1800 api_class: "CSSPropertyAPIStrokeOrLength", | 1807 api_class: "CSSPropertyAPIStrokeOrLength", | 
| 1801 converter: "ConvertLength", | 1808 converter: "ConvertLength", | 
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2150 field_size: 1, | 2157 field_size: 1, | 
| 2151 field_group: "rare-inherited", | 2158 field_group: "rare-inherited", | 
| 2152 }, | 2159 }, | 
| 2153 { | 2160 { | 
| 2154 name: "top", | 2161 name: "top", | 
| 2155 api_class: "CSSPropertyAPIMargin", | 2162 api_class: "CSSPropertyAPIMargin", | 
| 2156 api_methods: ["parseSingleValue"], | 2163 api_methods: ["parseSingleValue"], | 
| 2157 converter: "ConvertLengthOrAuto", | 2164 converter: "ConvertLengthOrAuto", | 
| 2158 interpolable: true, | 2165 interpolable: true, | 
| 2159 keywords: ["auto"], | 2166 keywords: ["auto"], | 
| 2160 supports_percentage: true, | |
| 2161 field_template: "external", | 2167 field_template: "external", | 
| 2162 include_paths: ["platform/Length.h"], | 2168 include_paths: ["platform/Length.h"], | 
| 2163 type_name: "Length", | 2169 type_name: "Length", | 
| 2164 field_group: "surround", | 2170 field_group: "surround", | 
| 2165 default_value: "Length()", | 2171 default_value: "Length()", | 
| 2166 }, | 2172 }, | 
| 2167 { | 2173 { | 
| 2168 name: "touch-action", | 2174 name: "touch-action", | 
| 2169 api_class: true, | 2175 api_class: true, | 
| 2170 api_methods: ["parseSingleValue"], | 2176 api_methods: ["parseSingleValue"], | 
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2718 default_value: "2", | 2724 default_value: "2", | 
| 2719 field_group: "rare-inherited", | 2725 field_group: "rare-inherited", | 
| 2720 }, | 2726 }, | 
| 2721 { | 2727 { | 
| 2722 name: "width", | 2728 name: "width", | 
| 2723 api_class: "CSSPropertyAPIWidthOrHeight", | 2729 api_class: "CSSPropertyAPIWidthOrHeight", | 
| 2724 converter: "ConvertLengthSizing", | 2730 converter: "ConvertLengthSizing", | 
| 2725 is_descriptor: true, | 2731 is_descriptor: true, | 
| 2726 interpolable: true, | 2732 interpolable: true, | 
| 2727 keywords: ["auto", "fit-content", "min-content", "max-content"], | 2733 keywords: ["auto", "fit-content", "min-content", "max-content"], | 
| 2728 supports_percentage: true, | |
| 2729 field_template: "external", | 2734 field_template: "external", | 
| 2730 include_paths: ["platform/Length.h"], | 2735 include_paths: ["platform/Length.h"], | 
| 2731 type_name: "Length", | 2736 type_name: "Length", | 
| 2732 field_group: "box", | 2737 field_group: "box", | 
| 2733 default_value: "Length()" | 2738 default_value: "Length()" | 
| 2734 }, | 2739 }, | 
| 2735 { | 2740 { | 
| 2736 name: "will-change", | 2741 name: "will-change", | 
| 2737 api_class: true, | 2742 api_class: true, | 
| 2738 api_methods: ["parseSingleValue"], | 2743 api_methods: ["parseSingleValue"], | 
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3523 { | 3528 { | 
| 3524 name: "-webkit-transition-timing-function", | 3529 name: "-webkit-transition-timing-function", | 
| 3525 alias_for: "transition-timing-function", | 3530 alias_for: "transition-timing-function", | 
| 3526 }, | 3531 }, | 
| 3527 { | 3532 { | 
| 3528 name: "-webkit-user-select", | 3533 name: "-webkit-user-select", | 
| 3529 alias_for: "user-select", | 3534 alias_for: "user-select", | 
| 3530 }, | 3535 }, | 
| 3531 ], | 3536 ], | 
| 3532 } | 3537 } | 
| OLD | NEW |