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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 {{ apply_value_border_image("CSSPropertyWebkitBorderImage") }} | 168 {{ apply_value_border_image("CSSPropertyWebkitBorderImage") }} |
169 | 169 |
170 {%- macro apply_border_image_modifier(property_id, modifier_type) %} | 170 {%- macro apply_border_image_modifier(property_id, modifier_type) %} |
171 {%- set is_mask_box = "MaskBox" in property_id %} | 171 {%- set is_mask_box = "MaskBox" in property_id %} |
172 {%- set getter = "maskBoxImage" if is_mask_box else "borderImage" %} | 172 {%- set getter = "maskBoxImage" if is_mask_box else "borderImage" %} |
173 {%- set setter = "setMaskBoxImage" if is_mask_box else "setBorderImage" %} | 173 {%- set setter = "setMaskBoxImage" if is_mask_box else "setBorderImage" %} |
174 {{ declare_initial_function(property_id) }} | 174 {{ declare_initial_function(property_id) }} |
175 { | 175 { |
176 NinePieceImage image(state.style()->{{getter}}()); | 176 NinePieceImage image(state.style()->{{getter}}()); |
177 {%- if modifier_type == "Outset" %} | 177 {%- if modifier_type == "Outset" %} |
178 image.setOutset(BorderImageLengthBox({{ (["Length(0, Fixed)"]*4) | join(", "
) }})); | 178 image.setOutset(Length(0, Fixed)); |
179 {%- elif modifier_type == "Repeat" %} | 179 {%- elif modifier_type == "Repeat" %} |
180 image.setHorizontalRule(StretchImageRule); | 180 image.setHorizontalRule(StretchImageRule); |
181 image.setVerticalRule(StretchImageRule); | 181 image.setVerticalRule(StretchImageRule); |
182 {%- elif modifier_type == "Slice" and is_mask_box %} | 182 {%- elif modifier_type == "Slice" and is_mask_box %} |
183 // Masks have a different initial value for slices. Preserve the value of 0
for backwards compatibility. | 183 // Masks have a different initial value for slices. Preserve the value of 0
for backwards compatibility. |
184 image.setImageSlices(LengthBox({{ (["Length(0, Fixed)"]*4) | join(", ") }}))
; | 184 image.setImageSlices(LengthBox({{ (["Length(0, Fixed)"]*4) | join(", ") }}))
; |
185 image.setFill(true); | 185 image.setFill(true); |
186 {%- elif modifier_type == "Slice" and not is_mask_box %} | 186 {%- elif modifier_type == "Slice" and not is_mask_box %} |
187 image.setImageSlices(LengthBox({{ (["Length(100, Percent)"]*4) | join(", ")
}})); | 187 image.setImageSlices(LengthBox({{ (["Length(100, Percent)"]*4) | join(", ")
}})); |
188 image.setFill(false); | 188 image.setFill(false); |
189 {%- elif modifier_type == "Width" %} | 189 {%- elif modifier_type == "Width" %} |
190 // Masks have a different initial value for widths. Preserve the value of 0
for backwards compatibility. | 190 // Masks have a different initial value for widths. Preserve the value of 'a
uto' for backwards compatibility. |
191 image.setBorderSlices(BorderImageLengthBox({{ (["1.0"]*4) | join(", ") if no
t is_mask_box }})); | 191 image.setBorderSlices({{ "Length(Auto)" if is_mask_box else "1.0" }}); |
192 {%- endif %} | 192 {%- endif %} |
193 state.style()->{{setter}}(image); | 193 state.style()->{{setter}}(image); |
194 } | 194 } |
195 | 195 |
196 {{ declare_inherit_function(property_id) }} | 196 {{ declare_inherit_function(property_id) }} |
197 { | 197 { |
198 NinePieceImage image(state.style()->{{getter}}()); | 198 NinePieceImage image(state.style()->{{getter}}()); |
199 {%- if modifier_type == "Outset" %} | 199 {%- if modifier_type == "Outset" %} |
200 image.copyOutsetFrom(state.parentStyle()->{{getter}}()); | 200 image.copyOutsetFrom(state.parentStyle()->{{getter}}()); |
201 {%- elif modifier_type == "Repeat" %} | 201 {%- elif modifier_type == "Repeat" %} |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 } else if (value->isImageValue()) { | 509 } else if (value->isImageValue()) { |
510 {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage(
{{property_id}}, value))); | 510 {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage(
{{property_id}}, value))); |
511 } | 511 } |
512 } | 512 } |
513 {%- endmacro %} | 513 {%- endmacro %} |
514 | 514 |
515 {{ apply_value_shape("CSSPropertyShapeInside") }} | 515 {{ apply_value_shape("CSSPropertyShapeInside") }} |
516 {{ apply_value_shape("CSSPropertyShapeOutside") }} | 516 {{ apply_value_shape("CSSPropertyShapeOutside") }} |
517 | 517 |
518 } // namespace WebCore | 518 } // namespace WebCore |
OLD | NEW |