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