Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 55783002: Introduce BorderImageLength and BorderImageLengthBox (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved BorderImageLength{,Box} to core/rendering/style Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698