| OLD | NEW |
| 1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
| 2 {# | 2 {# |
| 3 This file is for property handlers which use the templating engine to | 3 This file is for property handlers which use the templating engine to |
| 4 reduce (handwritten) code duplication. | 4 reduce (handwritten) code duplication. |
| 5 | 5 |
| 6 The `properties' dict can be used to access a property's parameters in | 6 The `properties' dict can be used to access a property's parameters in |
| 7 jinja2 templates (i.e. setter, getter, initial, type_name) | 7 jinja2 templates (i.e. setter, getter, initial, type_name) |
| 8 #} | 8 #} |
| 9 #include "config.h" | 9 #include "config.h" |
| 10 #include "StyleBuilderFunctions.h" | 10 #include "StyleBuilderFunctions.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 applyInitial{{property_id}}(state); | 97 applyInitial{{property_id}}(state); |
| 98 else | 98 else |
| 99 state.style()->access{{animation}}s().{{vector}} = parentData->{{vector}
}; | 99 state.style()->access{{animation}}s().{{vector}} = parentData->{{vector}
}; |
| 100 } | 100 } |
| 101 | 101 |
| 102 {{declare_value_function(property_id)}} | 102 {{declare_value_function(property_id)}} |
| 103 { | 103 { |
| 104 CSS{{animation}}Data& data = state.style()->access{{animation}}s(); | 104 CSS{{animation}}Data& data = state.style()->access{{animation}}s(); |
| 105 data.{{vector}}.clear(); | 105 data.{{vector}}.clear(); |
| 106 for (auto& listValue : toCSSValueList(*value)) | 106 for (auto& listValue : toCSSValueList(*value)) |
| 107 data.{{vector}}.append(CSSToStyleMap::mapAnimation{{attribute}}(listValu
e.get())); | 107 data.{{vector}}.append(CSSToStyleMap::mapAnimation{{attribute}}(*listVal
ue)); |
| 108 } | 108 } |
| 109 {% endmacro %} | 109 {% endmacro %} |
| 110 {{apply_animation('CSSPropertyAnimationDelay', 'Delay', 'Animation')}} | 110 {{apply_animation('CSSPropertyAnimationDelay', 'Delay', 'Animation')}} |
| 111 {{apply_animation('CSSPropertyAnimationDirection', 'Direction', 'Animation')}} | 111 {{apply_animation('CSSPropertyAnimationDirection', 'Direction', 'Animation')}} |
| 112 {{apply_animation('CSSPropertyAnimationDuration', 'Duration', 'Animation')}} | 112 {{apply_animation('CSSPropertyAnimationDuration', 'Duration', 'Animation')}} |
| 113 {{apply_animation('CSSPropertyAnimationFillMode', 'FillMode', 'Animation')}} | 113 {{apply_animation('CSSPropertyAnimationFillMode', 'FillMode', 'Animation')}} |
| 114 {{apply_animation('CSSPropertyAnimationIterationCount', 'IterationCount', 'Anima
tion')}} | 114 {{apply_animation('CSSPropertyAnimationIterationCount', 'IterationCount', 'Anima
tion')}} |
| 115 {{apply_animation('CSSPropertyAnimationName', 'Name', 'Animation')}} | 115 {{apply_animation('CSSPropertyAnimationName', 'Name', 'Animation')}} |
| 116 {{apply_animation('CSSPropertyAnimationPlayState', 'PlayState', 'Animation')}} | 116 {{apply_animation('CSSPropertyAnimationPlayState', 'PlayState', 'Animation')}} |
| 117 {{apply_animation('CSSPropertyAnimationTimingFunction', 'TimingFunction', 'Anima
tion')}} | 117 {{apply_animation('CSSPropertyAnimationTimingFunction', 'TimingFunction', 'Anima
tion')}} |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 {% elif modifier_type == 'Width' %} | 229 {% elif modifier_type == 'Width' %} |
| 230 image.copyBorderSlicesFrom(state.parentStyle()->{{getter}}()); | 230 image.copyBorderSlicesFrom(state.parentStyle()->{{getter}}()); |
| 231 {% endif %} | 231 {% endif %} |
| 232 state.style()->{{setter}}(image); | 232 state.style()->{{setter}}(image); |
| 233 } | 233 } |
| 234 | 234 |
| 235 {{declare_value_function(property_id)}} | 235 {{declare_value_function(property_id)}} |
| 236 { | 236 { |
| 237 NinePieceImage image(state.style()->{{getter}}()); | 237 NinePieceImage image(state.style()->{{getter}}()); |
| 238 {% if modifier_type == 'Outset' %} | 238 {% if modifier_type == 'Outset' %} |
| 239 image.setOutset(CSSToStyleMap::mapNinePieceImageQuad(state, value)); | 239 image.setOutset(CSSToStyleMap::mapNinePieceImageQuad(state, *value)); |
| 240 {% elif modifier_type == 'Repeat' %} | 240 {% elif modifier_type == 'Repeat' %} |
| 241 CSSToStyleMap::mapNinePieceImageRepeat(state, value, image); | 241 CSSToStyleMap::mapNinePieceImageRepeat(state, *value, image); |
| 242 {% elif modifier_type == 'Slice' %} | 242 {% elif modifier_type == 'Slice' %} |
| 243 CSSToStyleMap::mapNinePieceImageSlice(state, value, image); | 243 CSSToStyleMap::mapNinePieceImageSlice(state, *value, image); |
| 244 {% elif modifier_type == 'Width' %} | 244 {% elif modifier_type == 'Width' %} |
| 245 image.setBorderSlices(CSSToStyleMap::mapNinePieceImageQuad(state, value)); | 245 image.setBorderSlices(CSSToStyleMap::mapNinePieceImageQuad(state, *value)); |
| 246 {% endif %} | 246 {% endif %} |
| 247 state.style()->{{setter}}(image); | 247 state.style()->{{setter}}(image); |
| 248 } | 248 } |
| 249 {% endmacro %} | 249 {% endmacro %} |
| 250 {{apply_border_image_modifier('CSSPropertyBorderImageOutset', 'Outset')}} | 250 {{apply_border_image_modifier('CSSPropertyBorderImageOutset', 'Outset')}} |
| 251 {{apply_border_image_modifier('CSSPropertyBorderImageRepeat', 'Repeat')}} | 251 {{apply_border_image_modifier('CSSPropertyBorderImageRepeat', 'Repeat')}} |
| 252 {{apply_border_image_modifier('CSSPropertyBorderImageSlice', 'Slice')}} | 252 {{apply_border_image_modifier('CSSPropertyBorderImageSlice', 'Slice')}} |
| 253 {{apply_border_image_modifier('CSSPropertyBorderImageWidth', 'Width')}} | 253 {{apply_border_image_modifier('CSSPropertyBorderImageWidth', 'Width')}} |
| 254 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageOutset', 'Outset')}} | 254 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageOutset', 'Outset')}} |
| 255 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageRepeat', 'Repeat')}} | 255 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageRepeat', 'Repeat')}} |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 {{declare_value_function(property_id)}} | 399 {{declare_value_function(property_id)}} |
| 400 { | 400 { |
| 401 FillLayer* currChild = &state.style()->{{access_layers}}(); | 401 FillLayer* currChild = &state.style()->{{access_layers}}(); |
| 402 FillLayer* prevChild = 0; | 402 FillLayer* prevChild = 0; |
| 403 if (value->isValueList() && !value->isImageSetValue()) { | 403 if (value->isValueList() && !value->isImageSetValue()) { |
| 404 /* Walk each value and put it into a layer, creating new layers as neede
d. */ | 404 /* Walk each value and put it into a layer, creating new layers as neede
d. */ |
| 405 CSSValueList* valueList = toCSSValueList(value); | 405 CSSValueList* valueList = toCSSValueList(value); |
| 406 for (unsigned int i = 0; i < valueList->length(); i++) { | 406 for (unsigned int i = 0; i < valueList->length(); i++) { |
| 407 if (!currChild) | 407 if (!currChild) |
| 408 currChild = prevChild->ensureNext(); | 408 currChild = prevChild->ensureNext(); |
| 409 CSSToStyleMap::{{map_fill}}(state, currChild, valueList->item(i)); | 409 CSSToStyleMap::{{map_fill}}(state, currChild, *valueList->item(i)); |
| 410 prevChild = currChild; | 410 prevChild = currChild; |
| 411 currChild = currChild->next(); | 411 currChild = currChild->next(); |
| 412 } | 412 } |
| 413 } else { | 413 } else { |
| 414 CSSToStyleMap::{{map_fill}}(state, currChild, value); | 414 CSSToStyleMap::{{map_fill}}(state, currChild, *value); |
| 415 currChild = currChild->next(); | 415 currChild = currChild->next(); |
| 416 } | 416 } |
| 417 while (currChild) { | 417 while (currChild) { |
| 418 /* Reset all remaining layers to not have the property set. */ | 418 /* Reset all remaining layers to not have the property set. */ |
| 419 currChild->clear{{fill_type}}(); | 419 currChild->clear{{fill_type}}(); |
| 420 currChild = currChild->next(); | 420 currChild = currChild->next(); |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 {% endmacro %} | 423 {% endmacro %} |
| 424 {{apply_fill_layer('CSSPropertyBackgroundAttachment', 'Attachment')}} | 424 {{apply_fill_layer('CSSPropertyBackgroundAttachment', 'Attachment')}} |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R
GBCOLOR; | 524 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R
GBCOLOR; |
| 525 } | 525 } |
| 526 {{set_value(property)}}(paintType, color, url, | 526 {{set_value(property)}}(paintType, color, url, |
| 527 state.applyPropertyToRegularStyle(), | 527 state.applyPropertyToRegularStyle(), |
| 528 state.applyPropertyToVisitedLinkStyle()); | 528 state.applyPropertyToVisitedLinkStyle()); |
| 529 } | 529 } |
| 530 {% endmacro %} | 530 {% endmacro %} |
| 531 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 531 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
| 532 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 532 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
| 533 } // namespace blink | 533 } // namespace blink |
| OLD | NEW |