Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / build / scripts / templates / StyleBuilderFunctions.cpp.tmpl
1 {% from "macros.tmpl" import lower_first -%}
2
3 {#
4     This file is for property handlers which use the templating engine to
5     reduce (handwritten) code duplication.
6
7     The `properties' dict can be used to access a property's parameters in
8     jinja2 templates (i.e. setter, getter, initial, type_name)
9 -#}
10
11 #include "config.h"
12 #include "StyleBuilderFunctions.h"
13
14 #include "CSSValueKeywords.h"
15 #include "core/animation/css/CSSAnimationDataList.h"
16 #include "core/css/BasicShapeFunctions.h"
17 #include "core/css/CSSPrimitiveValueMappings.h"
18 #include "core/css/Pair.h"
19 #include "core/css/resolver/StyleResolverState.h"
20
21
22 {%- macro declare_initial_function(property_id) -%}
23 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& state)
24 {%- endmacro %}
25
26 {%- macro declare_inherit_function(property_id) -%}
27 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& state)
28 {%- endmacro %}
29
30 {%- macro declare_value_function(property_id) -%}
31 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state, CSSValue* value)
32 {%- endmacro %}
33
34 // FIXME: This is duplicated in StyleBuilder.cpp.tmpl, but we'll move the
35 // function definitions there over to here later.
36 {%- macro set_value(property) %}
37 {%- if property.svg -%}
38     state.style()->accessSVGStyle()->{{property.setter}}
39 {%- else -%}
40     state.style()->{{property.setter}}
41 {%- endif -%}
42 {%- endmacro %}
43
44 namespace WebCore {
45
46 {%- macro apply_animation(property_id, attribute, animation) %}
47 {{ declare_initial_function(property_id) }}
48 {
49     CSSAnimationDataList* list = state.style()->access{{animation}}();
50     if (list->isEmpty())
51         list->append(CSSAnimationData::create());
52     list->animation(0)->set{{attribute}}(CSSAnimationData::initialAnimation{{attribute}}());
53     {%- if property_id == "CSSPropertyWebkitTransitionProperty" %}
54         list->animation(0)->setAnimationMode(CSSAnimationData::AnimateAll);
55     {%- endif %}
56     for (size_t i = 1; i < list->size(); ++i)
57         list->animation(i)->clear{{attribute}}();
58 }
59
60 {{ declare_inherit_function(property_id) }}
61 {
62     CSSAnimationDataList* list = state.style()->access{{animation}}();
63     const CSSAnimationDataList* parentList = state.parentStyle()->{{animation|lower}}();
64     size_t i = 0, parentSize = parentList ? parentList->size() : 0;
65     for ( ; i < parentSize && parentList->animation(i)->is{{attribute}}Set(); ++i) {
66         ASSERT(list->size() >= i);
67         if (list->size() == i)
68             list->append(CSSAnimationData::create());
69         list->animation(i)->set{{attribute}}(parentList->animation(i)->{{lower_first(attribute)}}());
70         {%- if property_id == "CSSPropertyWebkitTransitionProperty" %}
71             list->animation(i)->setAnimationMode(parentList->animation(i)->animationMode());
72         {%- endif %}
73     }
74
75     // Reset any remaining animations to not have the property set.
76     for ( ; i < list->size(); ++i)
77         list->animation(i)->clear{{attribute}}();
78 }
79
80 {{ declare_value_function(property_id) }}
81 {
82     CSSAnimationDataList* list = state.style()->access{{animation}}();
83     size_t childIndex = 0;
84     if (value->isValueList()) {
85         // Walk each value and put it into an animation, creating new animations as needed.
86         for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
87             ASSERT(list->size() >= childIndex);
88             if (list->size() == childIndex)
89                 list->append(CSSAnimationData::create());
90             state.styleMap().mapAnimation{{attribute}}(list->animation(childIndex), i.value());
91             ++childIndex;
92         }
93     } else {
94         if (list->isEmpty())
95             list->append(CSSAnimationData::create());
96         state.styleMap().mapAnimation{{attribute}}(list->animation(childIndex), value);
97         childIndex = 1;
98     }
99     for ( ; childIndex < list->size(); ++childIndex) {
100         // Reset all remaining animations to not have the property set.
101         list->animation(childIndex)->clear{{attribute}}();
102     }
103 }
104 {%- endmacro %}
105
106 {{ apply_animation("CSSPropertyWebkitAnimationDelay", "Delay", "Animations") }}
107 {{ apply_animation("CSSPropertyWebkitAnimationDirection", "Direction", "Animations") }}
108 {{ apply_animation("CSSPropertyWebkitAnimationDuration", "Duration", "Animations") }}
109 {{ apply_animation("CSSPropertyWebkitAnimationFillMode", "FillMode", "Animations") }}
110 {{ apply_animation("CSSPropertyWebkitAnimationIterationCount", "IterationCount", "Animations") }}
111 {{ apply_animation("CSSPropertyWebkitAnimationName", "Name", "Animations") }}
112 {{ apply_animation("CSSPropertyWebkitAnimationPlayState", "PlayState", "Animations") }}
113 {{ apply_animation("CSSPropertyWebkitAnimationTimingFunction", "TimingFunction", "Animations") }}
114 {{ apply_animation("CSSPropertyWebkitTransitionDelay", "Delay", "Transitions") }}
115 {{ apply_animation("CSSPropertyWebkitTransitionDuration", "Duration", "Transitions") }}
116 {{ apply_animation("CSSPropertyWebkitTransitionProperty", "Property", "Transitions") }}
117 {{ apply_animation("CSSPropertyWebkitTransitionTimingFunction", "TimingFunction", "Transitions") }}
118
119 {%- macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identity="CSSValueAuto", compute_length=false) %}
120 {%- set property = properties[property_id] %}
121 {%- set auto_getter = auto_getter or "hasAuto" + property.camel_case_name %}
122 {%- set auto_setter = auto_setter or "setHasAuto" + property.camel_case_name %}
123 {{ declare_initial_function(property_id) }}
124 {
125     state.style()->{{auto_setter}}();
126 }
127
128 {{ declare_inherit_function(property_id) }}
129 {
130     if (state.parentStyle()->{{auto_getter}}())
131         state.style()->{{auto_setter}}();
132     else
133         {{ set_value(property) }}(state.parentStyle()->{{property.getter}}());
134 }
135
136 {{ declare_value_function(property_id) }}
137 {
138     if (!value->isPrimitiveValue())
139         return;
140
141     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
142     if (primitiveValue->getValueID() == {{auto_identity}})
143         state.style()->{{auto_setter}}();
144     else
145     {%- if compute_length %}
146         {{ set_value(property) }}(primitiveValue->computeLength<{{property.type_name}}>(state.cssToLengthConversionData()));
147     {%- else %}
148         {{ set_value(property) }}(*primitiveValue);
149     {%- endif %}
150 }
151 {%- endmacro %}
152
153 {{ apply_auto("CSSPropertyOrphans") }}
154 {{ apply_auto("CSSPropertyWebkitColumnCount") }}
155 {{ apply_auto("CSSPropertyWebkitColumnGap", auto_getter="hasNormalColumnGap", auto_setter="setHasNormalColumnGap", auto_identity="CSSValueNormal", compute_length=true) }}
156 {{ apply_auto("CSSPropertyWebkitColumnWidth", compute_length=true) }}
157 {{ apply_auto("CSSPropertyWidows") }}
158 {{ apply_auto("CSSPropertyZIndex") }}
159
160 {%- macro apply_border_image_modifier(property_id, modifier_type) %}
161 {%- set is_mask_box = "MaskBox" in property_id %}
162 {%- set getter = "maskBoxImage" if is_mask_box else "borderImage" %}
163 {%- set setter = "setMaskBoxImage" if is_mask_box else "setBorderImage" %}
164 {{ declare_initial_function(property_id) }}
165 {
166     NinePieceImage image(state.style()->{{getter}}());
167     {%- if modifier_type == "Outset" %}
168     image.setOutset(Length(0, Fixed));
169     {%- elif modifier_type == "Repeat" %}
170     image.setHorizontalRule(StretchImageRule);
171     image.setVerticalRule(StretchImageRule);
172     {%- elif modifier_type == "Slice" and is_mask_box %}
173     // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility.
174     image.setImageSlices(LengthBox({{ (["Length(0, Fixed)"]*4) | join(", ") }}));
175     image.setFill(true);
176     {%- elif modifier_type == "Slice" and not is_mask_box %}
177     image.setImageSlices(LengthBox({{ (["Length(100, Percent)"]*4) | join(", ") }}));
178     image.setFill(false);
179     {%- elif modifier_type == "Width" %}
180     // Masks have a different initial value for widths. Preserve the value of 'auto' for backwards compatibility.
181     image.setBorderSlices({{ "Length(Auto)" if is_mask_box else "1.0" }});
182     {%- endif %}
183     state.style()->{{setter}}(image);
184 }
185
186 {{ declare_inherit_function(property_id) }}
187 {
188     NinePieceImage image(state.style()->{{getter}}());
189     {%- if modifier_type == "Outset" %}
190     image.copyOutsetFrom(state.parentStyle()->{{getter}}());
191     {%- elif modifier_type == "Repeat" %}
192     image.copyRepeatFrom(state.parentStyle()->{{getter}}());
193     {%- elif modifier_type == "Slice" %}
194     image.copyImageSlicesFrom(state.parentStyle()->{{getter}}());
195     {%- elif modifier_type == "Width" %}
196     image.copyBorderSlicesFrom(state.parentStyle()->{{getter}}());
197     {%- endif %}
198     state.style()->{{setter}}(image);
199 }
200
201 {{ declare_value_function(property_id) }}
202 {
203     NinePieceImage image(state.style()->{{getter}}());
204     {%- if modifier_type == "Outset" %}
205     image.setOutset(state.styleMap().mapNinePieceImageQuad(value));
206     {%- elif modifier_type == "Repeat" %}
207     state.styleMap().mapNinePieceImageRepeat(value, image);
208     {%- elif modifier_type == "Slice" %}
209     state.styleMap().mapNinePieceImageSlice(value, image);
210     {%- elif modifier_type == "Width" %}
211     image.setBorderSlices(state.styleMap().mapNinePieceImageQuad(value));
212     {%- endif %}
213     state.style()->{{setter}}(image);
214 }
215 {%- endmacro %}
216
217 {{ apply_border_image_modifier("CSSPropertyBorderImageOutset", "Outset") }}
218 {{ apply_border_image_modifier("CSSPropertyBorderImageRepeat", "Repeat") }}
219 {{ apply_border_image_modifier("CSSPropertyBorderImageSlice", "Slice") }}
220 {{ apply_border_image_modifier("CSSPropertyBorderImageWidth", "Width") }}
221 {{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageOutset", "Outset") }}
222 {{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageRepeat", "Repeat") }}
223 {{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageSlice", "Slice") }}
224 {{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageWidth", "Width") }}
225
226 {%- macro apply_value_border_image_source(property_id) %}
227 {{ declare_value_function(property_id) }}
228 {
229     {%- set property = properties[property_id] %}
230     {{ set_value(property) }}(state.styleImage({{property_id}}, value));
231 }
232 {%- endmacro %}
233
234 {{ apply_value_border_image_source("CSSPropertyBorderImageSource") }}
235 {{ apply_value_border_image_source("CSSPropertyWebkitMaskBoxImageSource") }}
236
237 {%- macro apply_color(property_id, initial_color="StyleColor::currentColor") %}
238 {%- set property = properties[property_id] %}
239 {%- set visited_link_setter = "setVisitedLink" + property.camel_case_name %}
240 {{ declare_initial_function(property_id) }}
241 {
242     StyleColor color = {{initial_color}}();
243     if (state.applyPropertyToRegularStyle())
244         {{ set_value(property) }}(color);
245     if (state.applyPropertyToVisitedLinkStyle())
246         state.style()->{{visited_link_setter}}(color);
247 }
248
249 {{ declare_inherit_function(property_id) }}
250 {
251     // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
252     StyleColor color = state.parentStyle()->{{property.getter}}();
253     Color resolvedColor = color.resolve(state.parentStyle()->color());
254     if (state.applyPropertyToRegularStyle())
255         {{ set_value(property) }}(resolvedColor);
256     if (state.applyPropertyToVisitedLinkStyle())
257         state.style()->{{visited_link_setter}}(resolvedColor);
258 }
259
260 {{ declare_value_function(property_id) }}
261 {
262     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
263
264     if (state.applyPropertyToRegularStyle())
265         {{ set_value(property) }}(state.document().textLinkColors().colorFromPrimitiveValue(primitiveValue, state.style()->color()));
266     if (state.applyPropertyToVisitedLinkStyle())
267         state.style()->{{visited_link_setter}}(state.document().textLinkColors().colorFromPrimitiveValue(primitiveValue, state.style()->color(), state.element()->isLink() /* forVisitedLink */));
268 }
269 {%- endmacro %}
270
271 {{ apply_color("CSSPropertyBackgroundColor", initial_color="RenderStyle::initialBackgroundColor") }}
272 {{ apply_color("CSSPropertyBorderBottomColor") }}
273 {{ apply_color("CSSPropertyBorderLeftColor") }}
274 {{ apply_color("CSSPropertyBorderRightColor") }}
275 {{ apply_color("CSSPropertyBorderTopColor") }}
276 {{ apply_color("CSSPropertyOutlineColor") }}
277 {{ apply_color("CSSPropertyTextDecorationColor") }}
278 {{ apply_color("CSSPropertyWebkitColumnRuleColor") }}
279 {{ apply_color("CSSPropertyWebkitTextEmphasisColor") }}
280 {{ apply_color("CSSPropertyWebkitTextFillColor") }}
281 {{ apply_color("CSSPropertyWebkitTextStrokeColor") }}
282
283 {%- macro apply_counter(property_id, action) %}
284 {%- set property = properties[property_id] %}
285 {{ declare_initial_function(property_id) }} { }
286
287 {{ declare_inherit_function(property_id) }}
288 {
289     CounterDirectiveMap& map = state.style()->accessCounterDirectives();
290     CounterDirectiveMap& parentMap = state.parentStyle()->accessCounterDirectives();
291
292     typedef CounterDirectiveMap::iterator Iterator;
293     Iterator end = parentMap.end();
294     for (Iterator it = parentMap.begin(); it != end; ++it) {
295         CounterDirectives& directives = map.add(it->key, CounterDirectives()).storedValue->value;
296         directives.inherit{{action}}(it->value);
297     }
298 }
299
300 {{ declare_value_function(property_id) }}
301 {
302     CounterDirectiveMap& map = state.style()->accessCounterDirectives();
303     typedef CounterDirectiveMap::iterator Iterator;
304
305     Iterator end = map.end();
306     for (Iterator it = map.begin(); it != end; ++it)
307         it->value.clear{{action}}();
308
309     if (!value->isValueList()) {
310         ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
311         return;
312     }
313
314     CSSValueList* list = toCSSValueList(value);
315
316     int length = list ? list->length() : 0;
317     for (int i = 0; i < length; ++i) {
318         CSSValue* currValue = list->itemWithoutBoundsCheck(i);
319         if (!currValue->isPrimitiveValue())
320             continue;
321
322         Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue();
323         if (!pair || !pair->first() || !pair->second())
324             continue;
325
326         AtomicString identifier(pair->first()->getStringValue());
327         int value = pair->second()->getIntValue();
328         CounterDirectives& directives = map.add(identifier, CounterDirectives()).storedValue->value;
329         {%- if action == "Reset" %}
330         directives.setResetValue(value);
331         {%- else %}
332         directives.addIncrementValue(value);
333         {%- endif %}
334     }
335 }
336 {%- endmacro %}
337
338 {{ apply_counter("CSSPropertyCounterIncrement", "Increment") }}
339 {{ apply_counter("CSSPropertyCounterReset", "Reset") }}
340
341 {%- macro apply_fill_layer(property_id, fill_type) %}
342 {%- set layer_type = "Background" if "Background" in property_id else "Mask" %}
343 {%- set fill_layer_type = layer_type + "FillLayer" %}
344 {%- set access_layers = "access" + layer_type + "Layers" %}
345 {%- set map_fill = "mapFill" + fill_type %}
346 {{ declare_initial_function(property_id) }}
347 {
348     FillLayer* currChild = state.style()->{{access_layers}}();
349     currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer_type}}));
350     for (currChild = currChild->next(); currChild; currChild = currChild->next())
351         currChild->clear{{fill_type}}();
352 }
353
354 {{ declare_inherit_function(property_id) }}
355 {
356     FillLayer* currChild = state.style()->{{access_layers}}();
357     FillLayer* prevChild = 0;
358     const FillLayer* currParent = state.parentStyle()->{{layer_type|lower}}Layers();
359     while (currParent && currParent->is{{fill_type}}Set()) {
360         if (!currChild) {
361             /* Need to make a new layer.*/
362             currChild = new FillLayer({{fill_layer_type}});
363             prevChild->setNext(currChild);
364         }
365         currChild->set{{fill_type}}(currParent->{{lower_first(fill_type)}}());
366         prevChild = currChild;
367         currChild = prevChild->next();
368         currParent = currParent->next();
369     }
370
371     while (currChild) {
372         /* Reset any remaining layers to not have the property set. */
373         currChild->clear{{fill_type}}();
374         currChild = currChild->next();
375     }
376 }
377
378 {{ declare_value_function(property_id) }}
379 {
380     FillLayer* currChild = state.style()->{{access_layers}}();
381     FillLayer* prevChild = 0;
382     if (value->isValueList() && !value->isImageSetValue()) {
383         /* Walk each value and put it into a layer, creating new layers as needed. */
384         CSSValueList* valueList = toCSSValueList(value);
385         for (unsigned int i = 0; i < valueList->length(); i++) {
386             if (!currChild) {
387                 /* Need to make a new layer to hold this value */
388                 currChild = new FillLayer({{fill_layer_type}});
389                 prevChild->setNext(currChild);
390             }
391             state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList->itemWithoutBoundsCheck(i));
392             prevChild = currChild;
393             currChild = currChild->next();
394         }
395     } else {
396         state.styleMap().{{map_fill}}({{property_id}}, currChild, value);
397         currChild = currChild->next();
398     }
399     while (currChild) {
400         /* Reset all remaining layers to not have the property set. */
401         currChild->clear{{fill_type}}();
402         currChild = currChild->next();
403     }
404 }
405 {%- endmacro %}
406
407 {{ apply_fill_layer("CSSPropertyBackgroundAttachment", "Attachment") }}
408 {{ apply_fill_layer("CSSPropertyBackgroundBlendMode", "BlendMode") }}
409 {{ apply_fill_layer("CSSPropertyBackgroundClip", "Clip") }}
410 {{ apply_fill_layer("CSSPropertyBackgroundImage", "Image") }}
411 {{ apply_fill_layer("CSSPropertyBackgroundOrigin", "Origin") }}
412 {{ apply_fill_layer("CSSPropertyBackgroundPositionX", "XPosition") }}
413 {{ apply_fill_layer("CSSPropertyBackgroundPositionY", "YPosition") }}
414 {{ apply_fill_layer("CSSPropertyBackgroundRepeatX", "RepeatX") }}
415 {{ apply_fill_layer("CSSPropertyBackgroundRepeatY", "RepeatY") }}
416 {{ apply_fill_layer("CSSPropertyBackgroundSize", "Size") }}
417 {{ apply_fill_layer("CSSPropertyMaskSourceType", "MaskSourceType") }}
418 {{ apply_fill_layer("CSSPropertyWebkitBackgroundComposite", "Composite") }}
419 {{ apply_fill_layer("CSSPropertyWebkitMaskClip", "Clip") }}
420 {{ apply_fill_layer("CSSPropertyWebkitMaskComposite", "Composite") }}
421 {{ apply_fill_layer("CSSPropertyWebkitMaskImage", "Image") }}
422 {{ apply_fill_layer("CSSPropertyWebkitMaskOrigin", "Origin") }}
423 {{ apply_fill_layer("CSSPropertyWebkitMaskPositionX", "XPosition") }}
424 {{ apply_fill_layer("CSSPropertyWebkitMaskPositionY", "YPosition") }}
425 {{ apply_fill_layer("CSSPropertyWebkitMaskRepeatX", "RepeatX") }}
426 {{ apply_fill_layer("CSSPropertyWebkitMaskRepeatY", "RepeatY") }}
427 {{ apply_fill_layer("CSSPropertyWebkitMaskSize", "Size") }}
428
429 {%- macro apply_font(property_id, name_for_methods, initial, type_name) %}
430 {#- We specify the getters/setters here since they are on FontDescription
431         and not RenderStyle #}
432 {%- set getter = lower_first(name_for_methods) %}
433 {%- set setter = "set" + name_for_methods %}
434 {{ declare_initial_function(property_id) }}
435 {
436     state.fontBuilder().{{setter}}({{initial}});
437 }
438
439 {{ declare_inherit_function(property_id) }}
440 {
441     state.fontBuilder().{{setter}}(state.parentFontDescription().{{getter}}());
442 }
443
444 {{ declare_value_function(property_id) }}
445 {
446     if (!value->isPrimitiveValue())
447         return;
448     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
449     state.fontBuilder().{{setter}}(static_cast<{{type_name}}>(*primitiveValue));
450 }
451 {%- endmacro %}
452
453 {{ apply_font("CSSPropertyFontStyle", "Italic", "FontItalicOff", "FontItalic") }}
454 {{ apply_font("CSSPropertyFontVariant", "SmallCaps", "FontSmallCapsOff", "FontSmallCaps") }}
455 {{ apply_font("CSSPropertyTextRendering", "TextRenderingMode", "AutoTextRendering", "TextRenderingMode") }}
456 {{ apply_font("CSSPropertyFontKerning", "Kerning", "FontDescription::AutoKerning", "FontDescription::Kerning") }}
457 {{ apply_font("CSSPropertyWebkitFontSmoothing", "FontSmoothing", "AutoSmoothing", "FontSmoothingMode") }}
458
459 {%- macro apply_value_number(property_id, id_for_minus_one) %}
460 {{ declare_value_function(property_id) }}
461 {
462     {%- set property = properties[property_id] %}
463     if (!value->isPrimitiveValue())
464         return;
465
466     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
467     if (primitiveValue->getValueID() == {{id_for_minus_one}})
468         {{ set_value(property) }}(-1);
469     else
470         {{ set_value(property) }}(primitiveValue->getValue<{{property.type_name}}>(CSSPrimitiveValue::CSS_NUMBER));
471 }
472 {%- endmacro %}
473
474 {{ apply_value_number("CSSPropertyInternalMarqueeRepetition", "CSSValueInfinite") }}
475
476 {%- macro apply_value_shape(property_id) %}
477 {{ declare_value_function(property_id) }}
478 {
479     {%- set property = properties[property_id] %}
480     if (value->isPrimitiveValue()) {
481         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
482         if (primitiveValue->getValueID() == CSSValueAuto)
483             {{ set_value(property) }}(0);
484         else if (primitiveValue->getValueID() == CSSValueMarginBox
485             || primitiveValue->getValueID() == CSSValueBorderBox
486             || primitiveValue->getValueID() == CSSValuePaddingBox
487             || primitiveValue->getValueID() == CSSValueContentBox)
488             {{ set_value(property) }}(ShapeValue::createLayoutBoxValue(LayoutBox(*primitiveValue)));
489         else if (primitiveValue->getValueID() == CSSValueOutsideShape)
490             {{ set_value(property) }}(ShapeValue::createOutsideValue());
491         else if (primitiveValue->isShape()) {
492             {{ set_value(property) }}(ShapeValue::createShapeValue(basicShapeForValue(state, primitiveValue->getShapeValue())));
493         }
494     } else if (value->isImageValue() || value->isImageSetValue()) {
495         {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage({{property_id}}, value)));
496     }
497 }
498 {%- endmacro %}
499
500 {{ apply_value_shape("CSSPropertyShapeInside") }}
501 {{ apply_value_shape("CSSPropertyShapeOutside") }}
502
503 } // namespace WebCore