| OLD | NEW |
| 1 {% from "macros.tmpl" import lower_first -%} | 1 {% from "macros.tmpl" import lower_first -%} |
| 2 | 2 |
| 3 {# | 3 {# |
| 4 This file is for property handlers which use the templating engine to | 4 This file is for property handlers which use the templating engine to |
| 5 reduce (handwritten) code duplication. | 5 reduce (handwritten) code duplication. |
| 6 | 6 |
| 7 The `properties' dict can be used to access a property's parameters in | 7 The `properties' dict can be used to access a property's parameters in |
| 8 jinja2 templates (i.e. setter, getter, initial, type_name) | 8 jinja2 templates (i.e. setter, getter, initial, type_name) |
| 9 -#} | 9 -#} |
| 10 | 10 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 {{ apply_value_border_image("CSSPropertyWebkitMaskBoxImage") }} | 172 {{ apply_value_border_image("CSSPropertyWebkitMaskBoxImage") }} |
| 173 | 173 |
| 174 {%- macro apply_border_image_modifier(property_id, modifier_type) %} | 174 {%- macro apply_border_image_modifier(property_id, modifier_type) %} |
| 175 {%- set is_mask_box = "MaskBox" in property_id %} | 175 {%- set is_mask_box = "MaskBox" in property_id %} |
| 176 {%- set getter = "maskBoxImage" if is_mask_box else "borderImage" %} | 176 {%- set getter = "maskBoxImage" if is_mask_box else "borderImage" %} |
| 177 {%- set setter = "setMaskBoxImage" if is_mask_box else "setBorderImage" %} | 177 {%- set setter = "setMaskBoxImage" if is_mask_box else "setBorderImage" %} |
| 178 {{ declare_initial_function(property_id) }} | 178 {{ declare_initial_function(property_id) }} |
| 179 { | 179 { |
| 180 NinePieceImage image(state.style()->{{getter}}()); | 180 NinePieceImage image(state.style()->{{getter}}()); |
| 181 {%- if modifier_type == "Outset" %} | 181 {%- if modifier_type == "Outset" %} |
| 182 image.setOutset(LengthBox(0)); | 182 image.setOutset(BorderImageLengthBox({{ (["Length(0, Fixed)"]*4) | join(", "
) }})); |
| 183 {%- elif modifier_type == "Repeat" %} | 183 {%- elif modifier_type == "Repeat" %} |
| 184 image.setHorizontalRule(StretchImageRule); | 184 image.setHorizontalRule(StretchImageRule); |
| 185 image.setVerticalRule(StretchImageRule); | 185 image.setVerticalRule(StretchImageRule); |
| 186 {%- elif modifier_type == "Slice" %} | 186 {%- elif modifier_type == "Slice" %} |
| 187 // Masks have a different initial value for slices. Preserve the value of 0
for backwards compatibility. | 187 // Masks have a different initial value for slices. Preserve the value of 0
for backwards compatibility. |
| 188 image.setImageSlices(LengthBox({{ (["Length(100, Percent)"]*4) | join(", ")
if not is_mask_box }})); | 188 image.setImageSlices(LengthBox({{ (["Length(100, Percent)"]*4) | join(", ")
if not is_mask_box }})); |
| 189 image.setFill(false); | 189 image.setFill(false); |
| 190 {%- elif modifier_type == "Width" %} | 190 {%- elif modifier_type == "Width" %} |
| 191 // Masks have a different initial value for widths. Preserve the value of 0
for backwards compatibility. | 191 // Masks have a different initial value for widths. Preserve the value of 0
for backwards compatibility. |
| 192 image.setBorderSlices(LengthBox({{ (["Length(1, Relative)"]*4) | join(", ")
if not is_mask_box }})); | 192 image.setBorderSlices(BorderImageLengthBox({{ (["1.0"]*4) | join(", ") if no
t is_mask_box }})); |
| 193 {%- endif %} | 193 {%- endif %} |
| 194 state.style()->{{setter}}(image); | 194 state.style()->{{setter}}(image); |
| 195 } | 195 } |
| 196 | 196 |
| 197 {{ declare_inherit_function(property_id) }} | 197 {{ declare_inherit_function(property_id) }} |
| 198 { | 198 { |
| 199 NinePieceImage image(state.style()->{{getter}}()); | 199 NinePieceImage image(state.style()->{{getter}}()); |
| 200 {%- if modifier_type == "Outset" %} | 200 {%- if modifier_type == "Outset" %} |
| 201 image.copyOutsetFrom(state.parentStyle()->{{getter}}()); | 201 image.copyOutsetFrom(state.parentStyle()->{{getter}}()); |
| 202 {%- elif modifier_type == "Repeat" %} | 202 {%- elif modifier_type == "Repeat" %} |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 } else if (value->isImageValue()) { | 510 } else if (value->isImageValue()) { |
| 511 {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage(
{{property_id}}, value))); | 511 {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage(
{{property_id}}, value))); |
| 512 } | 512 } |
| 513 } | 513 } |
| 514 {%- endmacro %} | 514 {%- endmacro %} |
| 515 | 515 |
| 516 {{ apply_value_shape("CSSPropertyShapeInside") }} | 516 {{ apply_value_shape("CSSPropertyShapeInside") }} |
| 517 {{ apply_value_shape("CSSPropertyShapeOutside") }} | 517 {{ apply_value_shape("CSSPropertyShapeOutside") }} |
| 518 | 518 |
| 519 } // namespace WebCore | 519 } // namespace WebCore |
| OLD | NEW |