OLD | NEW |
1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
2 {{license()}} | 2 {{license()}} |
3 | 3 |
4 #include "core/css/CSSPropertyMetadata.h" | 4 #include "core/css/CSSPropertyMetadata.h" |
5 | 5 |
| 6 #include "core/css/CSSValuePool.h" |
6 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
7 #include <bitset> | 8 #include <bitset> |
8 | 9 |
9 namespace blink { | 10 namespace blink { |
10 {% for flag, function_name in switches %} | 11 {% for flag, function_name in switches %} |
11 | 12 |
12 bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property) | 13 bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property) |
13 { | 14 { |
14 switch(property) { | 15 switch(property) { |
15 case CSSPropertyInvalid: | 16 case CSSPropertyInvalid: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 if (isEnabledProperty(property)) | 61 if (isEnabledProperty(property)) |
61 outVector.append(property); | 62 outVector.append(property); |
62 } | 63 } |
63 } | 64 } |
64 | 65 |
65 bool CSSPropertyMetadata::isDescriptorOnly(CSSPropertyID property) | 66 bool CSSPropertyMetadata::isDescriptorOnly(CSSPropertyID property) |
66 { | 67 { |
67 return property >= {{descriptors[0].property_id}} && property <= {{descripto
rs[-1].property_id}}; | 68 return property >= {{descriptors[0].property_id}} && property <= {{descripto
rs[-1].property_id}}; |
68 } | 69 } |
69 | 70 |
| 71 CSSValue* CSSPropertyMetadata::initialValue(CSSPropertyID property) |
| 72 { |
| 73 CSSValue* value = nullptr; |
| 74 switch (property) { |
| 75 case CSSPropertyOutlineColor: |
| 76 case CSSPropertyWebkitTextFillColor: |
| 77 case CSSPropertyWebkitBorderAfterColor: |
| 78 case CSSPropertyWebkitBorderBeforeColor: |
| 79 case CSSPropertyWebkitTextEmphasisColor: |
| 80 case CSSPropertyTextDecorationColor: |
| 81 case CSSPropertyColumnRuleColor: |
| 82 case CSSPropertyBorderColor: |
| 83 case CSSPropertyBorderTopColor: |
| 84 case CSSPropertyBorderRightColor: |
| 85 case CSSPropertyBorderBottomColor: |
| 86 case CSSPropertyBorderLeftColor: { |
| 87 DEFINE_STATIC_LOCAL(CSSValue*, currentColor, (new CSSPrimitiveValue(CSSV
alueCurrentcolor))); |
| 88 value = currentColor; |
| 89 break; |
| 90 } |
| 91 case CSSPropertyOutlineWidth: |
| 92 case CSSPropertyColumnRuleWidth: |
| 93 case CSSPropertyWebkitBorderAfterWidth: |
| 94 case CSSPropertyWebkitBorderBeforeWidth: |
| 95 case CSSPropertyBorderWidth: |
| 96 case CSSPropertyBorderTopWidth: |
| 97 case CSSPropertyBorderRightWidth: |
| 98 case CSSPropertyBorderBottomWidth: |
| 99 case CSSPropertyBorderLeftWidth: { |
| 100 DEFINE_STATIC_LOCAL(CSSValue*, medium, (new CSSPrimitiveValue(CSSValueMe
dium))); |
| 101 value = medium; |
| 102 break; |
| 103 } |
| 104 case CSSPropertyAnimationName: |
| 105 case CSSPropertyAnimationFillMode: |
| 106 case CSSPropertyGridTemplateColumns: |
| 107 case CSSPropertyGridTemplateRows: |
| 108 case CSSPropertyGridTemplateAreas: |
| 109 case CSSPropertyWebkitMaskImage: |
| 110 case CSSPropertyBackgroundImage: |
| 111 case CSSPropertyOutlineStyle: |
| 112 case CSSPropertyColumnRuleStyle: |
| 113 case CSSPropertyWebkitTextEmphasisStyle: |
| 114 case CSSPropertyBorderStyle: |
| 115 case CSSPropertyBorderTopStyle: |
| 116 case CSSPropertyBorderRightStyle: |
| 117 case CSSPropertyBorderBottomStyle: |
| 118 case CSSPropertyBorderLeftStyle: |
| 119 case CSSPropertyCounterReset: |
| 120 case CSSPropertyCounterIncrement: |
| 121 case CSSPropertyBorderImageSource: |
| 122 case CSSPropertyWebkitMaskBoxImageSource: |
| 123 case CSSPropertyListStyleImage: { |
| 124 DEFINE_STATIC_LOCAL(CSSValue*, none, (new CSSPrimitiveValue(CSSValueNone
))); |
| 125 value = none; |
| 126 break; |
| 127 } |
| 128 case CSSPropertyWebkitMaskRepeatX: |
| 129 case CSSPropertyWebkitMaskRepeatY: |
| 130 case CSSPropertyBackgroundRepeatX: |
| 131 case CSSPropertyBackgroundRepeatY: |
| 132 case CSSPropertyBackgroundRepeat: { |
| 133 DEFINE_STATIC_LOCAL(CSSValue*, repeat, (new CSSPrimitiveValue(CSSValueRe
peat))); |
| 134 value = repeat; |
| 135 break; |
| 136 } |
| 137 case CSSPropertyWebkitMaskBoxImageRepeat: |
| 138 case CSSPropertyBorderImageRepeat: { |
| 139 DEFINE_STATIC_LOCAL(CSSValue*, stretch, (new CSSPrimitiveValue(CSSValueS
tretch))); |
| 140 value = stretch; |
| 141 break; |
| 142 } |
| 143 case CSSPropertyAnimationIterationCount: |
| 144 case CSSPropertyWebkitMaskBoxImageWidth: |
| 145 case CSSPropertyBorderImageWidth: { |
| 146 DEFINE_STATIC_LOCAL(CSSValue*, imageWidth, (new CSSPrimitiveValue(1, CSS
PrimitiveValue::UnitType::Integer))); |
| 147 value = imageWidth; |
| 148 break; |
| 149 } |
| 150 case CSSPropertyWebkitMaskBoxImageSlice: |
| 151 case CSSPropertyBorderImageSlice: { |
| 152 DEFINE_STATIC_LOCAL(CSSValue*, imageSlice, (new CSSPrimitiveValue(100, C
SSPrimitiveValue::UnitType::Percentage))); |
| 153 value = imageSlice; |
| 154 break; |
| 155 } |
| 156 case CSSPropertyWebkitMaskPositionX: |
| 157 case CSSPropertyWebkitMaskPositionY: |
| 158 case CSSPropertyBackgroundPositionX: |
| 159 case CSSPropertyBackgroundPositionY: { |
| 160 DEFINE_STATIC_LOCAL(CSSValue*, backgroundPosition, (new CSSPrimitiveValu
e(0, CSSPrimitiveValue::UnitType::Percentage))); |
| 161 value = backgroundPosition; |
| 162 break; |
| 163 } |
| 164 case CSSPropertyTransitionDelay: |
| 165 case CSSPropertyTransitionDuration: |
| 166 case CSSPropertyAnimationDelay: |
| 167 case CSSPropertyAnimationDuration: { |
| 168 DEFINE_STATIC_LOCAL(CSSValue*, seconds, (new CSSPrimitiveValue(0, CSSPri
mitiveValue::UnitType::Seconds))); |
| 169 value = seconds; |
| 170 break; |
| 171 } |
| 172 case CSSPropertyTransitionTimingFunction: |
| 173 case CSSPropertyAnimationTimingFunction: { |
| 174 DEFINE_STATIC_LOCAL(CSSValue*, ease, (new CSSPrimitiveValue(CSSValueEase
))); |
| 175 value = ease; |
| 176 break; |
| 177 } |
| 178 case CSSPropertyAnimationPlayState: { |
| 179 DEFINE_STATIC_LOCAL(CSSValue*, running, (new CSSPrimitiveValue(CSSValueR
unning))); |
| 180 value = running; |
| 181 break; |
| 182 } |
| 183 case CSSPropertyAnimationDirection: { |
| 184 DEFINE_STATIC_LOCAL(CSSValue*, normal, (new CSSPrimitiveValue(CSSValueNo
rmal))); |
| 185 value = normal; |
| 186 break; |
| 187 } |
| 188 case CSSPropertyTransitionProperty: { |
| 189 DEFINE_STATIC_LOCAL(CSSValue*, all, (new CSSPrimitiveValue(CSSValueAll))
); |
| 190 value = all; |
| 191 break; |
| 192 } |
| 193 case CSSPropertyListStyleType: { |
| 194 DEFINE_STATIC_LOCAL(CSSValue*, disc, (new CSSPrimitiveValue(CSSValueDisc
))); |
| 195 value = disc; |
| 196 break; |
| 197 } |
| 198 case CSSPropertyListStylePosition: { |
| 199 DEFINE_STATIC_LOCAL(CSSValue*, listStylePosition, (new CSSPrimitiveValue
(CSSValueOutside))); |
| 200 value = listStylePosition; |
| 201 break; |
| 202 } |
| 203 case CSSPropertyTextDecorationStyle: { |
| 204 DEFINE_STATIC_LOCAL(CSSValue*, decorationStyle, (new CSSPrimitiveValue(C
SSValueSolid))); |
| 205 value = decorationStyle; |
| 206 break; |
| 207 } |
| 208 case CSSPropertyWebkitTextStrokeColor: { |
| 209 DEFINE_STATIC_LOCAL(CSSValue*, textStrokeColor, (CSSColorValue::create(C
olor::black))); |
| 210 value = textStrokeColor; |
| 211 break; |
| 212 } |
| 213 case CSSPropertyGridColumnGap: |
| 214 case CSSPropertyGridRowGap: |
| 215 case CSSPropertyWebkitMaskBoxImageOutset: |
| 216 case CSSPropertyBorderImageOutset: |
| 217 case CSSPropertyWebkitTextStrokeWidth: { |
| 218 DEFINE_STATIC_LOCAL(CSSValue*, textStrokeWidth, (new CSSPrimitiveValue(0
, CSSPrimitiveValue::UnitType::Integer))); |
| 219 value = textStrokeWidth; |
| 220 break; |
| 221 } |
| 222 case CSSPropertyGridAutoFlow: |
| 223 case CSSPropertyFlexDirection: { |
| 224 DEFINE_STATIC_LOCAL(CSSValue*, flexDirection, (new CSSPrimitiveValue(CSS
ValueRow))); |
| 225 value = flexDirection; |
| 226 break; |
| 227 } |
| 228 case CSSPropertyFlexWrap: { |
| 229 DEFINE_STATIC_LOCAL(CSSValue*, flexWrap, (new CSSPrimitiveValue(CSSValue
Nowrap))); |
| 230 value = flexWrap; |
| 231 break; |
| 232 } |
| 233 case CSSPropertyGridAutoColumns: |
| 234 case CSSPropertyGridAutoRows: |
| 235 case CSSPropertyWebkitMaskSize: |
| 236 case CSSPropertyBackgroundSize: { |
| 237 DEFINE_STATIC_LOCAL(CSSValue*, backgroundSize, (new CSSPrimitiveValue(CS
SValueAuto))); |
| 238 value = backgroundSize; |
| 239 break; |
| 240 } |
| 241 case CSSPropertyBackgroundAttachment: { |
| 242 DEFINE_STATIC_LOCAL(CSSValue*, backgroundAttachment, (new CSSPrimitiveVa
lue(CSSValueScroll))); |
| 243 value = backgroundAttachment; |
| 244 break; |
| 245 } |
| 246 case CSSPropertyWebkitMaskClip: |
| 247 case CSSPropertyBackgroundClip: { |
| 248 DEFINE_STATIC_LOCAL(CSSValue*, backgroundClip, (new CSSPrimitiveValue(CS
SValueBorderBox))); |
| 249 value = backgroundClip; |
| 250 break; |
| 251 } |
| 252 case CSSPropertyWebkitMaskOrigin: |
| 253 case CSSPropertyBackgroundOrigin: { |
| 254 DEFINE_STATIC_LOCAL(CSSValue*, backgroundOrigin, (new CSSPrimitiveValue(
CSSValuePaddingBox))); |
| 255 value = backgroundOrigin; |
| 256 break; |
| 257 } |
| 258 case CSSPropertyBackgroundColor: { |
| 259 DEFINE_STATIC_LOCAL(CSSValue*, backgroundColor, (new CSSPrimitiveValue(C
SSValueTransparent))); |
| 260 value = backgroundColor; |
| 261 break; |
| 262 } |
| 263 default: |
| 264 return nullptr; |
| 265 } |
| 266 value->setImplicit(); |
| 267 return value; |
| 268 } |
| 269 |
70 } // namespace blink | 270 } // namespace blink |
OLD | NEW |