| 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 "StyleBuilderFunctions.h" | 9 #include "StyleBuilderFunctions.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& stat
e) | 22 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& stat
e) |
| 23 {%- endmacro %} | 23 {%- endmacro %} |
| 24 {% macro declare_inherit_function(property_id) %} | 24 {% macro declare_inherit_function(property_id) %} |
| 25 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& stat
e) | 25 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& stat
e) |
| 26 {%- endmacro %} | 26 {%- endmacro %} |
| 27 {% macro declare_value_function(property_id) %} | 27 {% macro declare_value_function(property_id) %} |
| 28 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state,
const CSSValue& value) | 28 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state,
const CSSValue& value) |
| 29 {%- endmacro %} | 29 {%- endmacro %} |
| 30 {% macro set_value(property) %} | 30 {% macro set_value(property) %} |
| 31 {% if property.svg %} | 31 {% if property.svg %} |
| 32 state.style()->accessSVGStyle().{{property.setter}} | 32 state.Style()->AccessSVGStyle().{{property.setter}} |
| 33 {%- elif property.font %} | 33 {%- elif property.font %} |
| 34 state.fontBuilder().{{property.setter}} | 34 state.GetFontBuilder().{{property.setter}} |
| 35 {%- else %} | 35 {%- else %} |
| 36 state.style()->{{property.setter}} | 36 state.Style()->{{property.setter}} |
| 37 {%- endif %} | 37 {%- endif %} |
| 38 {% endmacro %} | 38 {% endmacro %} |
| 39 {% macro convert_and_set_value(property) %} | 39 {% macro convert_and_set_value(property) %} |
| 40 {% if property.converter %} | 40 {% if property.converter %} |
| 41 {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, val
ue)); | 41 {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, val
ue)); |
| 42 {# TODO(sashab): Remove this list from this file. #} | 42 {# TODO(sashab): Remove this list from this file. #} |
| 43 {% elif property.type_name in ['short', 'unsigned short', 'int', 'unsigned int',
'unsigned', 'float', 'LineClampValue'] %} | 43 {% elif property.type_name in ['short', 'unsigned short', 'int', 'unsigned int',
'unsigned', 'float', 'LineClampValue'] %} |
| 44 {{set_value(property)}}(toCSSPrimitiveValue(value).convertTo<{{property.type_nam
e}}>()); | 44 {{set_value(property)}}(ToCSSPrimitiveValue(value).ConvertTo<{{property.type_nam
e}}>()); |
| 45 {%- else %} | 45 {%- else %} |
| 46 {{set_value(property)}}(toCSSIdentifierValue(value).convertTo<{{property.type_na
me}}>()); | 46 {{set_value(property)}}(ToCSSIdentifierValue(value).ConvertTo<{{property.type_na
me}}>()); |
| 47 {%- endif %} | 47 {%- endif %} |
| 48 {% endmacro %} | 48 {% endmacro %} |
| 49 {% macro set_is_inherited(property) %} | 49 {% macro set_is_inherited(property) %} |
| 50 state.style()->{{property.is_inherited_setter}} | 50 state.Style()->{{property.is_inherited_setter}} |
| 51 {% endmacro %} | 51 {% endmacro %} |
| 52 | 52 |
| 53 namespace blink { | 53 namespace blink { |
| 54 | 54 |
| 55 {% for property_id, property in properties.items() if property.should_declare_fu
nctions %} | 55 {% for property_id, property in properties.items() if property.should_declare_fu
nctions %} |
| 56 {% set apply_type = property.apply_type %} | 56 {% set apply_type = property.apply_type %} |
| 57 {% if not property.custom_initial %} | 57 {% if not property.custom_initial %} |
| 58 {{declare_initial_function(property_id)}} { | 58 {{declare_initial_function(property_id)}} { |
| 59 {% if property.svg %} | 59 {% if property.svg %} |
| 60 {{set_value(property)}}(SVGComputedStyle::{{property.initial}}()); | 60 {{set_value(property)}}(SVGComputedStyle::{{property.initial}}()); |
| 61 {% elif property.font %} | 61 {% elif property.font %} |
| 62 {{set_value(property)}}(FontBuilder::{{property.initial}}()); | 62 {{set_value(property)}}(FontBuilder::{{property.initial}}()); |
| 63 {% else %} | 63 {% else %} |
| 64 {{set_value(property)}}(ComputedStyle::{{property.initial}}()); | 64 {{set_value(property)}}(ComputedStyle::{{property.initial}}()); |
| 65 {% endif %} | 65 {% endif %} |
| 66 {% if property.independent %} | 66 {% if property.independent %} |
| 67 {{set_is_inherited(property)}}(false); | 67 {{set_is_inherited(property)}}(false); |
| 68 {% endif %} | 68 {% endif %} |
| 69 } | 69 } |
| 70 | 70 |
| 71 {% endif %} | 71 {% endif %} |
| 72 {% if not property.custom_inherit %} | 72 {% if not property.custom_inherit %} |
| 73 {{declare_inherit_function(property_id)}} { | 73 {{declare_inherit_function(property_id)}} { |
| 74 {% if property.svg %} | 74 {% if property.svg %} |
| 75 {{set_value(property)}}(state.parentStyle()->svgStyle().{{property.getter}}())
; | 75 {{set_value(property)}}(state.ParentStyle()->SvgStyle().{{property.getter}}())
; |
| 76 {% elif property.font %} | 76 {% elif property.font %} |
| 77 {{set_value(property)}}(state.parentFontDescription().{{property.getter}}()); | 77 {{set_value(property)}}(state.ParentFontDescription().{{property.getter}}()); |
| 78 {% else %} | 78 {% else %} |
| 79 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); | 79 {{set_value(property)}}(state.ParentStyle()->{{property.getter}}()); |
| 80 {% endif %} | 80 {% endif %} |
| 81 {% if property.independent %} | 81 {% if property.independent %} |
| 82 {{set_is_inherited(property)}}(true); | 82 {{set_is_inherited(property)}}(true); |
| 83 {% endif %} | 83 {% endif %} |
| 84 } | 84 } |
| 85 | 85 |
| 86 {% endif %} | 86 {% endif %} |
| 87 {% if not property.custom_value %} | 87 {% if not property.custom_value %} |
| 88 {{declare_value_function(property_id)}} { | 88 {{declare_value_function(property_id)}} { |
| 89 {{convert_and_set_value(property)}} | 89 {{convert_and_set_value(property)}} |
| 90 {% if property.independent %} | 90 {% if property.independent %} |
| 91 {{set_is_inherited(property)}}(false); | 91 {{set_is_inherited(property)}}(false); |
| 92 {% endif %} | 92 {% endif %} |
| 93 } | 93 } |
| 94 | 94 |
| 95 {% endif %} | 95 {% endif %} |
| 96 {% endfor %} | 96 {% endfor %} |
| 97 | 97 |
| 98 {% macro apply_animation(property_id, attribute, animation) %} | 98 {% macro apply_animation(property_id, attribute, animation) %} |
| 99 {% set vector = attribute|lower_first + "List()" %} | 99 {% set vector = attribute + "List()" %} |
| 100 {{declare_initial_function(property_id)}} { | 100 {{declare_initial_function(property_id)}} { |
| 101 CSS{{animation}}Data& data = state.style()->access{{animation}}s(); | 101 CSS{{animation}}Data& data = state.Style()->Access{{animation}}s(); |
| 102 data.{{vector}}.clear(); | 102 data.{{vector}}.Clear(); |
| 103 data.{{vector}}.push_back(CSS{{animation}}Data::initial{{attribute}}()); | 103 data.{{vector}}.push_back(CSS{{animation}}Data::Initial{{attribute}}()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 {{declare_inherit_function(property_id)}} { | 106 {{declare_inherit_function(property_id)}} { |
| 107 const CSS{{animation}}Data* parentData = state.parentStyle()->{{animation|lowe
r}}s(); | 107 const CSS{{animation}}Data* parentData = state.ParentStyle()->{{animation}}s()
; |
| 108 if (!parentData) | 108 if (!parentData) |
| 109 applyInitial{{property_id}}(state); | 109 applyInitial{{property_id}}(state); |
| 110 else | 110 else |
| 111 state.style()->access{{animation}}s().{{vector}} = parentData->{{vector}}; | 111 state.Style()->Access{{animation}}s().{{vector}} = parentData->{{vector}}; |
| 112 } | 112 } |
| 113 | 113 |
| 114 {{declare_value_function(property_id)}} { | 114 {{declare_value_function(property_id)}} { |
| 115 CSS{{animation}}Data& data = state.style()->access{{animation}}s(); | 115 CSS{{animation}}Data& data = state.Style()->Access{{animation}}s(); |
| 116 data.{{vector}}.clear(); | 116 data.{{vector}}.Clear(); |
| 117 for (auto& listValue : toCSSValueList(value)) | 117 for (auto& listValue : ToCSSValueList(value)) |
| 118 data.{{vector}}.push_back(CSSToStyleMap::mapAnimation{{attribute}}(*listValu
e)); | 118 data.{{vector}}.push_back(CSSToStyleMap::MapAnimation{{attribute}}(*listValu
e)); |
| 119 } | 119 } |
| 120 {% endmacro %} | 120 {% endmacro %} |
| 121 {{apply_animation('CSSPropertyAnimationDelay', 'Delay', 'Animation')}} | 121 {{apply_animation('CSSPropertyAnimationDelay', 'Delay', 'Animation')}} |
| 122 {{apply_animation('CSSPropertyAnimationDirection', 'Direction', 'Animation')}} | 122 {{apply_animation('CSSPropertyAnimationDirection', 'Direction', 'Animation')}} |
| 123 {{apply_animation('CSSPropertyAnimationDuration', 'Duration', 'Animation')}} | 123 {{apply_animation('CSSPropertyAnimationDuration', 'Duration', 'Animation')}} |
| 124 {{apply_animation('CSSPropertyAnimationFillMode', 'FillMode', 'Animation')}} | 124 {{apply_animation('CSSPropertyAnimationFillMode', 'FillMode', 'Animation')}} |
| 125 {{apply_animation('CSSPropertyAnimationIterationCount', 'IterationCount', 'Anima
tion')}} | 125 {{apply_animation('CSSPropertyAnimationIterationCount', 'IterationCount', 'Anima
tion')}} |
| 126 {{apply_animation('CSSPropertyAnimationName', 'Name', 'Animation')}} | 126 {{apply_animation('CSSPropertyAnimationName', 'Name', 'Animation')}} |
| 127 {{apply_animation('CSSPropertyAnimationPlayState', 'PlayState', 'Animation')}} | 127 {{apply_animation('CSSPropertyAnimationPlayState', 'PlayState', 'Animation')}} |
| 128 {{apply_animation('CSSPropertyAnimationTimingFunction', 'TimingFunction', 'Anima
tion')}} | 128 {{apply_animation('CSSPropertyAnimationTimingFunction', 'TimingFunction', 'Anima
tion')}} |
| 129 {{apply_animation('CSSPropertyTransitionDelay', 'Delay', 'Transition')}} | 129 {{apply_animation('CSSPropertyTransitionDelay', 'Delay', 'Transition')}} |
| 130 {{apply_animation('CSSPropertyTransitionDuration', 'Duration', 'Transition')}} | 130 {{apply_animation('CSSPropertyTransitionDuration', 'Duration', 'Transition')}} |
| 131 {{apply_animation('CSSPropertyTransitionProperty', 'Property', 'Transition')}} | 131 {{apply_animation('CSSPropertyTransitionProperty', 'Property', 'Transition')}} |
| 132 {{apply_animation('CSSPropertyTransitionTimingFunction', 'TimingFunction', 'Tran
sition')}} | 132 {{apply_animation('CSSPropertyTransitionTimingFunction', 'TimingFunction', 'Tran
sition')}} |
| 133 | 133 |
| 134 {% macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identi
ty='CSSValueAuto') %} | 134 {% macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identi
ty='CSSValueAuto') %} |
| 135 {% set property = properties[property_id] %} | 135 {% set property = properties[property_id] %} |
| 136 {% set auto_getter = auto_getter or 'hasAuto' + property.name_for_methods %} | 136 {% set auto_getter = auto_getter or 'HasAuto' + property.name_for_methods %} |
| 137 {% set auto_setter = auto_setter or 'setHasAuto' + property.name_for_methods %} | 137 {% set auto_setter = auto_setter or 'SetHasAuto' + property.name_for_methods %} |
| 138 {{declare_initial_function(property_id)}} { | 138 {{declare_initial_function(property_id)}} { |
| 139 state.style()->{{auto_setter}}(); | 139 state.Style()->{{auto_setter}}(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 {{declare_inherit_function(property_id)}} { | 142 {{declare_inherit_function(property_id)}} { |
| 143 if (state.parentStyle()->{{auto_getter}}()) | 143 if (state.ParentStyle()->{{auto_getter}}()) |
| 144 state.style()->{{auto_setter}}(); | 144 state.Style()->{{auto_setter}}(); |
| 145 else | 145 else |
| 146 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); | 146 {{set_value(property)}}(state.ParentStyle()->{{property.getter}}()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 {{declare_value_function(property_id)}} { | 149 {{declare_value_function(property_id)}} { |
| 150 if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == {
{auto_identity}}) | 150 if (value.IsIdentifierValue() && ToCSSIdentifierValue(value).GetValueID() == {
{auto_identity}}) |
| 151 state.style()->{{auto_setter}}(); | 151 state.Style()->{{auto_setter}}(); |
| 152 else | 152 else |
| 153 {{convert_and_set_value(property)}} | 153 {{convert_and_set_value(property)}} |
| 154 } | 154 } |
| 155 {% endmacro %} | 155 {% endmacro %} |
| 156 {{apply_auto('CSSPropertyClip')}} | 156 {{apply_auto('CSSPropertyClip')}} |
| 157 {{apply_auto('CSSPropertyColumnCount')}} | 157 {{apply_auto('CSSPropertyColumnCount')}} |
| 158 {{apply_auto('CSSPropertyColumnGap', auto_getter='hasNormalColumnGap', auto_sett
er='setHasNormalColumnGap', auto_identity='CSSValueNormal')}} | 158 {{apply_auto('CSSPropertyColumnGap', auto_getter='HasNormalColumnGap', auto_sett
er='SetHasNormalColumnGap', auto_identity='CSSValueNormal')}} |
| 159 {{apply_auto('CSSPropertyColumnWidth')}} | 159 {{apply_auto('CSSPropertyColumnWidth')}} |
| 160 {{apply_auto('CSSPropertyZIndex')}} | 160 {{apply_auto('CSSPropertyZIndex')}} |
| 161 | 161 |
| 162 static bool lengthMatchesAllSides(const LengthBox& lengthBox, | 162 static bool lengthMatchesAllSides(const LengthBox& lengthBox, |
| 163 const Length& length) { | 163 const Length& length) { |
| 164 return (lengthBox.left() == length && | 164 return (lengthBox.Left() == length && |
| 165 lengthBox.right() == length && | 165 lengthBox.Right() == length && |
| 166 lengthBox.top() == length && | 166 lengthBox.Top() == length && |
| 167 lengthBox.bottom() == length); | 167 lengthBox.Bottom() == length); |
| 168 } | 168 } |
| 169 | 169 |
| 170 static bool borderImageLengthMatchesAllSides( | 170 static bool borderImageLengthMatchesAllSides( |
| 171 const BorderImageLengthBox& borderImageLengthBox, | 171 const BorderImageLengthBox& borderImageLengthBox, |
| 172 const BorderImageLength& borderImageLength) { | 172 const BorderImageLength& borderImageLength) { |
| 173 return (borderImageLengthBox.left() == borderImageLength && | 173 return (borderImageLengthBox.Left() == borderImageLength && |
| 174 borderImageLengthBox.right() == borderImageLength && | 174 borderImageLengthBox.Right() == borderImageLength && |
| 175 borderImageLengthBox.top() == borderImageLength && | 175 borderImageLengthBox.Top() == borderImageLength && |
| 176 borderImageLengthBox.bottom() == borderImageLength); | 176 borderImageLengthBox.Bottom() == borderImageLength); |
| 177 } | 177 } |
| 178 | 178 |
| 179 {% macro apply_border_image_modifier(property_id, modifier_type) %} | 179 {% macro apply_border_image_modifier(property_id, modifier_type) %} |
| 180 {% set is_mask_box = 'MaskBox' in property_id %} | 180 {% set is_mask_box = 'MaskBox' in property_id %} |
| 181 {% set getter = 'maskBoxImage' if is_mask_box else 'borderImage' %} | 181 {% set getter = 'MaskBoxImage' if is_mask_box else 'BorderImage' %} |
| 182 {% set setter = 'setMaskBoxImage' if is_mask_box else 'setBorderImage' %} | 182 {% set setter = 'SetMaskBoxImage' if is_mask_box else 'SetBorderImage' %} |
| 183 {{ declare_initial_function(property_id) }} { | 183 {{ declare_initial_function(property_id) }} { |
| 184 const NinePieceImage& currentImage = state.style()->{{getter}}(); | 184 const NinePieceImage& currentImage = state.Style()->{{getter}}(); |
| 185 {# Check for equality in case we can bail out before creating a new NinePieceI
mage. #} | 185 {# Check for equality in case we can bail out before creating a new NinePieceI
mage. #} |
| 186 {% if modifier_type == 'Outset' %} | 186 {% if modifier_type == 'Outset' %} |
| 187 if (borderImageLengthMatchesAllSides(currentImage.outset(), | 187 if (borderImageLengthMatchesAllSides(currentImage.Outset(), |
| 188 BorderImageLength(Length(0, Fixed)))) | 188 BorderImageLength(Length(0, kFixed)))) |
| 189 return; | 189 return; |
| 190 {% elif modifier_type == 'Repeat' %} | 190 {% elif modifier_type == 'Repeat' %} |
| 191 if (currentImage.horizontalRule() == StretchImageRule && | 191 if (currentImage.HorizontalRule() == kStretchImageRule && |
| 192 currentImage.verticalRule() == StretchImageRule) | 192 currentImage.VerticalRule() == kStretchImageRule) |
| 193 return; | 193 return; |
| 194 {% elif modifier_type == 'Slice' and is_mask_box %} | 194 {% elif modifier_type == 'Slice' and is_mask_box %} |
| 195 // Masks have a different initial value for slices. Preserve the value of 0 | 195 // Masks have a different initial value for slices. Preserve the value of 0 |
| 196 // for backwards compatibility. | 196 // for backwards compatibility. |
| 197 if (currentImage.fill() == true && | 197 if (currentImage.Fill() == true && |
| 198 lengthMatchesAllSides(currentImage.imageSlices(), Length(0, Fixed))) | 198 lengthMatchesAllSides(currentImage.ImageSlices(), Length(0, kFixed))) |
| 199 return; | 199 return; |
| 200 {% elif modifier_type == 'Slice' and not is_mask_box %} | 200 {% elif modifier_type == 'Slice' and not is_mask_box %} |
| 201 if (currentImage.fill() == false && | 201 if (currentImage.Fill() == false && |
| 202 lengthMatchesAllSides(currentImage.imageSlices(), Length(100, Percent))) | 202 lengthMatchesAllSides(currentImage.ImageSlices(), Length(100, kPercent))) |
| 203 return; | 203 return; |
| 204 {% elif modifier_type == 'Width' and is_mask_box %} | 204 {% elif modifier_type == 'Width' and is_mask_box %} |
| 205 // Masks have a different initial value for widths. Preserve the value of | 205 // Masks have a different initial value for widths. Preserve the value of |
| 206 // 'auto' for backwards compatibility. | 206 // 'auto' for backwards compatibility. |
| 207 if (borderImageLengthMatchesAllSides(currentImage.borderSlices(), | 207 if (borderImageLengthMatchesAllSides(currentImage.BorderSlices(), |
| 208 BorderImageLength(Length(Auto)))) | 208 BorderImageLength(Length(kAuto)))) |
| 209 return; | 209 return; |
| 210 {% elif modifier_type == 'Width' and not is_mask_box %} | 210 {% elif modifier_type == 'Width' and not is_mask_box %} |
| 211 if (borderImageLengthMatchesAllSides(currentImage.borderSlices(), | 211 if (borderImageLengthMatchesAllSides(currentImage.BorderSlices(), |
| 212 BorderImageLength(1.0))) | 212 BorderImageLength(1.0))) |
| 213 return; | 213 return; |
| 214 {% endif %} | 214 {% endif %} |
| 215 | 215 |
| 216 NinePieceImage image(currentImage); | 216 NinePieceImage image(currentImage); |
| 217 {% if modifier_type == 'Outset' %} | 217 {% if modifier_type == 'Outset' %} |
| 218 image.setOutset(Length(0, Fixed)); | 218 image.SetOutset(Length(0, kFixed)); |
| 219 {% elif modifier_type == 'Repeat' %} | 219 {% elif modifier_type == 'Repeat' %} |
| 220 image.setHorizontalRule(StretchImageRule); | 220 image.SetHorizontalRule(kStretchImageRule); |
| 221 image.setVerticalRule(StretchImageRule); | 221 image.SetVerticalRule(kStretchImageRule); |
| 222 {% elif modifier_type == 'Slice' and is_mask_box %} | 222 {% elif modifier_type == 'Slice' and is_mask_box %} |
| 223 image.setImageSlices(LengthBox({{ (['Length(0, Fixed)']*4) | join(', ') }})); | 223 image.SetImageSlices(LengthBox({{ (['Length(0, kFixed)']*4) | join(', ') }})); |
| 224 image.setFill(true); | 224 image.SetFill(true); |
| 225 {% elif modifier_type == 'Slice' and not is_mask_box %} | 225 {% elif modifier_type == 'Slice' and not is_mask_box %} |
| 226 image.setImageSlices(LengthBox({{ (['Length(100, Percent)']*4) | join(', ') }}
)); | 226 image.SetImageSlices(LengthBox({{ (['Length(100, kPercent)']*4) | join(', ') }
})); |
| 227 image.setFill(false); | 227 image.SetFill(false); |
| 228 {% elif modifier_type == 'Width' %} | 228 {% elif modifier_type == 'Width' %} |
| 229 image.setBorderSlices({{ 'Length(Auto)' if is_mask_box else '1.0' }}); | 229 image.SetBorderSlices({{ 'Length(kAuto)' if is_mask_box else '1.0' }}); |
| 230 {% endif %} | 230 {% endif %} |
| 231 state.style()->{{setter}}(image); | 231 state.Style()->{{setter}}(image); |
| 232 } | 232 } |
| 233 | 233 |
| 234 {{declare_inherit_function(property_id)}} { | 234 {{declare_inherit_function(property_id)}} { |
| 235 NinePieceImage image(state.style()->{{getter}}()); | 235 NinePieceImage image(state.Style()->{{getter}}()); |
| 236 {% if modifier_type == 'Outset' %} | 236 {% if modifier_type == 'Outset' %} |
| 237 image.copyOutsetFrom(state.parentStyle()->{{getter}}()); | 237 image.CopyOutsetFrom(state.ParentStyle()->{{getter}}()); |
| 238 {% elif modifier_type == 'Repeat' %} | 238 {% elif modifier_type == 'Repeat' %} |
| 239 image.copyRepeatFrom(state.parentStyle()->{{getter}}()); | 239 image.CopyRepeatFrom(state.ParentStyle()->{{getter}}()); |
| 240 {% elif modifier_type == 'Slice' %} | 240 {% elif modifier_type == 'Slice' %} |
| 241 image.copyImageSlicesFrom(state.parentStyle()->{{getter}}()); | 241 image.CopyImageSlicesFrom(state.ParentStyle()->{{getter}}()); |
| 242 {% elif modifier_type == 'Width' %} | 242 {% elif modifier_type == 'Width' %} |
| 243 image.copyBorderSlicesFrom(state.parentStyle()->{{getter}}()); | 243 image.CopyBorderSlicesFrom(state.ParentStyle()->{{getter}}()); |
| 244 {% endif %} | 244 {% endif %} |
| 245 state.style()->{{setter}}(image); | 245 state.Style()->{{setter}}(image); |
| 246 } | 246 } |
| 247 | 247 |
| 248 {{declare_value_function(property_id)}} { | 248 {{declare_value_function(property_id)}} { |
| 249 NinePieceImage image(state.style()->{{getter}}()); | 249 NinePieceImage image(state.Style()->{{getter}}()); |
| 250 {% if modifier_type == 'Outset' %} | 250 {% if modifier_type == 'Outset' %} |
| 251 image.setOutset(CSSToStyleMap::mapNinePieceImageQuad(state, value)); | 251 image.SetOutset(CSSToStyleMap::MapNinePieceImageQuad(state, value)); |
| 252 {% elif modifier_type == 'Repeat' %} | 252 {% elif modifier_type == 'Repeat' %} |
| 253 CSSToStyleMap::mapNinePieceImageRepeat(state, value, image); | 253 CSSToStyleMap::MapNinePieceImageRepeat(state, value, image); |
| 254 {% elif modifier_type == 'Slice' %} | 254 {% elif modifier_type == 'Slice' %} |
| 255 CSSToStyleMap::mapNinePieceImageSlice(state, value, image); | 255 CSSToStyleMap::MapNinePieceImageSlice(state, value, image); |
| 256 {% elif modifier_type == 'Width' %} | 256 {% elif modifier_type == 'Width' %} |
| 257 image.setBorderSlices(CSSToStyleMap::mapNinePieceImageQuad(state, value)); | 257 image.SetBorderSlices(CSSToStyleMap::MapNinePieceImageQuad(state, value)); |
| 258 {% endif %} | 258 {% endif %} |
| 259 state.style()->{{setter}}(image); | 259 state.Style()->{{setter}}(image); |
| 260 } | 260 } |
| 261 {% endmacro %} | 261 {% endmacro %} |
| 262 {{apply_border_image_modifier('CSSPropertyBorderImageOutset', 'Outset')}} | 262 {{apply_border_image_modifier('CSSPropertyBorderImageOutset', 'Outset')}} |
| 263 {{apply_border_image_modifier('CSSPropertyBorderImageRepeat', 'Repeat')}} | 263 {{apply_border_image_modifier('CSSPropertyBorderImageRepeat', 'Repeat')}} |
| 264 {{apply_border_image_modifier('CSSPropertyBorderImageSlice', 'Slice')}} | 264 {{apply_border_image_modifier('CSSPropertyBorderImageSlice', 'Slice')}} |
| 265 {{apply_border_image_modifier('CSSPropertyBorderImageWidth', 'Width')}} | 265 {{apply_border_image_modifier('CSSPropertyBorderImageWidth', 'Width')}} |
| 266 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageOutset', 'Outset')}} | 266 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageOutset', 'Outset')}} |
| 267 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageRepeat', 'Repeat')}} | 267 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageRepeat', 'Repeat')}} |
| 268 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageSlice', 'Slice')}} | 268 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageSlice', 'Slice')}} |
| 269 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageWidth', 'Width')}} | 269 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageWidth', 'Width')}} |
| 270 | 270 |
| 271 {% macro apply_value_border_image_source(property_id) %} | 271 {% macro apply_value_border_image_source(property_id) %} |
| 272 {{declare_value_function(property_id)}} { | 272 {{declare_value_function(property_id)}} { |
| 273 {% set property = properties[property_id] %} | 273 {% set property = properties[property_id] %} |
| 274 {{set_value(property)}}(state.styleImage({{property_id}}, value)); | 274 {{set_value(property)}}(state.GetStyleImage({{property_id}}, value)); |
| 275 } | 275 } |
| 276 {% endmacro %} | 276 {% endmacro %} |
| 277 {{apply_value_border_image_source('CSSPropertyBorderImageSource')}} | 277 {{apply_value_border_image_source('CSSPropertyBorderImageSource')}} |
| 278 {{apply_value_border_image_source('CSSPropertyWebkitMaskBoxImageSource')}} | 278 {{apply_value_border_image_source('CSSPropertyWebkitMaskBoxImageSource')}} |
| 279 | 279 |
| 280 {% macro apply_color(property_id, initial_color='StyleColor::currentColor') %} | 280 {% macro apply_color(property_id, initial_color='StyleColor::CurrentColor') %} |
| 281 {% set property = properties[property_id] %} | 281 {% set property = properties[property_id] %} |
| 282 {% set visited_link_setter = 'setVisitedLink' + property.name_for_methods %} | 282 {% set visited_link_setter = 'SetVisitedLink' + property.name_for_methods %} |
| 283 {{declare_initial_function(property_id)}} { | 283 {{declare_initial_function(property_id)}} { |
| 284 StyleColor color = {{initial_color}}(); | 284 StyleColor color = {{initial_color}}(); |
| 285 if (state.applyPropertyToRegularStyle()) | 285 if (state.ApplyPropertyToRegularStyle()) |
| 286 {{set_value(property)}}(color); | 286 {{set_value(property)}}(color); |
| 287 if (state.applyPropertyToVisitedLinkStyle()) | 287 if (state.ApplyPropertyToVisitedLinkStyle()) |
| 288 state.style()->{{visited_link_setter}}(color); | 288 state.Style()->{{visited_link_setter}}(color); |
| 289 } | 289 } |
| 290 | 290 |
| 291 {{declare_inherit_function(property_id)}} { | 291 {{declare_inherit_function(property_id)}} { |
| 292 // Visited link style can never explicitly inherit from parent visited link | 292 // Visited link style can never explicitly inherit from parent visited link |
| 293 // style so no separate getters are needed. | 293 // style so no separate getters are needed. |
| 294 StyleColor color = state.parentStyle()->{{property.getter}}(); | 294 StyleColor color = state.ParentStyle()->{{property.getter}}(); |
| 295 if (state.applyPropertyToRegularStyle()) | 295 if (state.ApplyPropertyToRegularStyle()) |
| 296 {{set_value(property)}}(color); | 296 {{set_value(property)}}(color); |
| 297 if (state.applyPropertyToVisitedLinkStyle()) | 297 if (state.ApplyPropertyToVisitedLinkStyle()) |
| 298 state.style()->{{visited_link_setter}}(color); | 298 state.Style()->{{visited_link_setter}}(color); |
| 299 } | 299 } |
| 300 | 300 |
| 301 {{declare_value_function(property_id)}} | 301 {{declare_value_function(property_id)}} |
| 302 { | 302 { |
| 303 if (state.applyPropertyToRegularStyle()) | 303 if (state.ApplyPropertyToRegularStyle()) |
| 304 {{set_value(property)}}(StyleBuilderConverter::convertStyleColor(state, valu
e)); | 304 {{set_value(property)}}(StyleBuilderConverter::ConvertStyleColor(state, valu
e)); |
| 305 if (state.applyPropertyToVisitedLinkStyle()) { | 305 if (state.ApplyPropertyToVisitedLinkStyle()) { |
| 306 state.style()->{{visited_link_setter}}( | 306 state.Style()->{{visited_link_setter}}( |
| 307 StyleBuilderConverter::convertStyleColor(state, value, true)); | 307 StyleBuilderConverter::ConvertStyleColor(state, value, true)); |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 {% endmacro %} | 310 {% endmacro %} |
| 311 {{apply_color('CSSPropertyBackgroundColor', initial_color='ComputedStyle::initia
lBackgroundColor') }} | 311 {{apply_color('CSSPropertyBackgroundColor', initial_color='ComputedStyle::Initia
lBackgroundColor') }} |
| 312 {{apply_color('CSSPropertyBorderBottomColor')}} | 312 {{apply_color('CSSPropertyBorderBottomColor')}} |
| 313 {{apply_color('CSSPropertyBorderLeftColor')}} | 313 {{apply_color('CSSPropertyBorderLeftColor')}} |
| 314 {{apply_color('CSSPropertyBorderRightColor')}} | 314 {{apply_color('CSSPropertyBorderRightColor')}} |
| 315 {{apply_color('CSSPropertyBorderTopColor')}} | 315 {{apply_color('CSSPropertyBorderTopColor')}} |
| 316 {{apply_color('CSSPropertyOutlineColor')}} | 316 {{apply_color('CSSPropertyOutlineColor')}} |
| 317 {{apply_color('CSSPropertyTextDecorationColor')}} | 317 {{apply_color('CSSPropertyTextDecorationColor')}} |
| 318 {{apply_color('CSSPropertyColumnRuleColor')}} | 318 {{apply_color('CSSPropertyColumnRuleColor')}} |
| 319 {{apply_color('CSSPropertyWebkitTextEmphasisColor')}} | 319 {{apply_color('CSSPropertyWebkitTextEmphasisColor')}} |
| 320 {{apply_color('CSSPropertyWebkitTextFillColor')}} | 320 {{apply_color('CSSPropertyWebkitTextFillColor')}} |
| 321 {{apply_color('CSSPropertyWebkitTextStrokeColor')}} | 321 {{apply_color('CSSPropertyWebkitTextStrokeColor')}} |
| 322 | 322 |
| 323 {% macro apply_counter(property_id, action) %} | 323 {% macro apply_counter(property_id, action) %} |
| 324 {% set property = properties[property_id] %} | 324 {% set property = properties[property_id] %} |
| 325 {{declare_initial_function(property_id)}} { | 325 {{declare_initial_function(property_id)}} { |
| 326 state.style()->clear{{action}}Directives(); | 326 state.Style()->Clear{{action}}Directives(); |
| 327 } | 327 } |
| 328 | 328 |
| 329 {{declare_inherit_function(property_id)}} { | 329 {{declare_inherit_function(property_id)}} { |
| 330 const CounterDirectiveMap* parentMap = state.parentStyle()->counterDirectives(
); | 330 const CounterDirectiveMap* parentMap = state.ParentStyle()->GetCounterDirectiv
es(); |
| 331 if (!parentMap) | 331 if (!parentMap) |
| 332 return; | 332 return; |
| 333 | 333 |
| 334 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); | 334 CounterDirectiveMap& map = state.Style()->AccessCounterDirectives(); |
| 335 DCHECK(!parentMap->isEmpty()); | 335 DCHECK(!parentMap->IsEmpty()); |
| 336 | 336 |
| 337 typedef CounterDirectiveMap::const_iterator Iterator; | 337 typedef CounterDirectiveMap::const_iterator Iterator; |
| 338 Iterator end = parentMap->end(); | 338 Iterator end = parentMap->end(); |
| 339 for (Iterator it = parentMap->begin(); it != end; ++it) { | 339 for (Iterator it = parentMap->begin(); it != end; ++it) { |
| 340 CounterDirectives& directives = map.add(it->key, CounterDirectives()).stored
Value->value; | 340 CounterDirectives& directives = map.Add(it->key, CounterDirectives()).stored
_value->value; |
| 341 directives.inherit{{action}}(it->value); | 341 directives.Inherit{{action}}(it->value); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 {{declare_value_function(property_id)}} { | 345 {{declare_value_function(property_id)}} { |
| 346 state.style()->clear{{action}}Directives(); | 346 state.Style()->Clear{{action}}Directives(); |
| 347 | 347 |
| 348 if (!value.isValueList()) { | 348 if (!value.IsValueList()) { |
| 349 DCHECK(value.isIdentifierValue()); | 349 DCHECK(value.IsIdentifierValue()); |
| 350 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); | 350 DCHECK_EQ(ToCSSIdentifierValue(value).GetValueID(), CSSValueNone); |
| 351 return; | 351 return; |
| 352 } | 352 } |
| 353 | 353 |
| 354 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); | 354 CounterDirectiveMap& map = state.Style()->AccessCounterDirectives(); |
| 355 | 355 |
| 356 const CSSValueList& list = toCSSValueList(value); | 356 const CSSValueList& list = ToCSSValueList(value); |
| 357 | 357 |
| 358 for (size_t i = 0; i < list.length(); ++i) { | 358 for (size_t i = 0; i < list.length(); ++i) { |
| 359 const CSSValuePair& pair = toCSSValuePair(list.item(i)); | 359 const CSSValuePair& pair = ToCSSValuePair(list.Item(i)); |
| 360 AtomicString identifier(toCSSCustomIdentValue(pair.first()).value()); | 360 AtomicString identifier(ToCSSCustomIdentValue(pair.First()).Value()); |
| 361 int value = toCSSPrimitiveValue(pair.second()).getIntValue(); | 361 int value = ToCSSPrimitiveValue(pair.Second()).GetIntValue(); |
| 362 CounterDirectives& directives = | 362 CounterDirectives& directives = |
| 363 map.add(identifier, CounterDirectives()).storedValue->value; | 363 map.Add(identifier, CounterDirectives()).stored_value->value; |
| 364 {% if action == 'Reset' %} | 364 {% if action == 'Reset' %} |
| 365 directives.setResetValue(value); | 365 directives.SetResetValue(value); |
| 366 {% else %} | 366 {% else %} |
| 367 directives.addIncrementValue(value); | 367 directives.AddIncrementValue(value); |
| 368 {% endif %} | 368 {% endif %} |
| 369 } | 369 } |
| 370 DCHECK(!map.isEmpty()); | 370 DCHECK(!map.IsEmpty()); |
| 371 } | 371 } |
| 372 {% endmacro %} | 372 {% endmacro %} |
| 373 {{apply_counter('CSSPropertyCounterIncrement', 'Increment')}} | 373 {{apply_counter('CSSPropertyCounterIncrement', 'Increment')}} |
| 374 {{apply_counter('CSSPropertyCounterReset', 'Reset')}} | 374 {{apply_counter('CSSPropertyCounterReset', 'Reset')}} |
| 375 | 375 |
| 376 {% macro apply_fill_layer(property_id, fill_type) %} | 376 {% macro apply_fill_layer(property_id, fill_type, fill_type_getter = None) %} |
| 377 {% set layer_type = 'Background' if 'Background' in property_id else 'Mask' %} | 377 {% set layer_type = 'Background' if 'Background' in property_id else 'Mask' %} |
| 378 {% set fill_layer_type = layer_type + 'FillLayer' %} | 378 {% set fill_layer_type = 'k' + layer_type + 'FillLayer' %} |
| 379 {% set access_layers = 'access' + layer_type + 'Layers' %} | 379 {% set access_layers = 'Access' + layer_type + 'Layers' %} |
| 380 {% set map_fill = 'mapFill' + fill_type %} | 380 {% set map_fill = 'MapFill' + fill_type %} |
| 381 {% set fill_type_getter = fill_type_getter or fill_type %} |
| 381 {{declare_initial_function(property_id)}} { | 382 {{declare_initial_function(property_id)}} { |
| 382 FillLayer* currChild = &state.style()->{{access_layers}}(); | 383 FillLayer* currChild = &state.Style()->{{access_layers}}(); |
| 383 currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer_t
ype}})); | 384 currChild->Set{{fill_type}}(FillLayer::InitialFill{{fill_type}}({{fill_layer_typ
e}})); |
| 384 for (currChild = currChild->next(); currChild; currChild = currChild->next()) | 385 for (currChild = currChild->Next(); currChild; currChild = currChild->Next()) |
| 385 currChild->clear{{fill_type}}(); | 386 currChild->Clear{{fill_type}}(); |
| 386 } | 387 } |
| 387 | 388 |
| 388 {{declare_inherit_function(property_id)}} { | 389 {{declare_inherit_function(property_id)}} { |
| 389 FillLayer* currChild = &state.style()->{{access_layers}}(); | 390 FillLayer* currChild = &state.Style()->{{access_layers}}(); |
| 390 FillLayer* prevChild = 0; | 391 FillLayer* prevChild = 0; |
| 391 const FillLayer* currParent = &state.parentStyle()->{{layer_type|lower}}Layers
(); | 392 const FillLayer* currParent = &state.ParentStyle()->{{layer_type}}Layers(); |
| 392 while (currParent && currParent->is{{fill_type}}Set()) { | 393 while (currParent && currParent->Is{{fill_type}}Set()) { |
| 393 if (!currChild) | 394 if (!currChild) |
| 394 currChild = prevChild->ensureNext(); | 395 currChild = prevChild->EnsureNext(); |
| 395 currChild->set{{fill_type}}(currParent->{{fill_type|lower_first}}()); | 396 currChild->Set{{fill_type}}(currParent->{{fill_type_getter}}()); |
| 396 prevChild = currChild; | 397 prevChild = currChild; |
| 397 currChild = prevChild->next(); | 398 currChild = prevChild->Next(); |
| 398 currParent = currParent->next(); | 399 currParent = currParent->Next(); |
| 399 } | 400 } |
| 400 | 401 |
| 401 while (currChild) { | 402 while (currChild) { |
| 402 // Reset any remaining layers to not have the property set. | 403 // Reset any remaining layers to not have the property set. |
| 403 currChild->clear{{fill_type}}(); | 404 currChild->Clear{{fill_type}}(); |
| 404 currChild = currChild->next(); | 405 currChild = currChild->Next(); |
| 405 } | 406 } |
| 406 } | 407 } |
| 407 | 408 |
| 408 {{declare_value_function(property_id)}} { | 409 {{declare_value_function(property_id)}} { |
| 409 FillLayer* currChild = &state.style()->{{access_layers}}(); | 410 FillLayer* currChild = &state.Style()->{{access_layers}}(); |
| 410 FillLayer* prevChild = 0; | 411 FillLayer* prevChild = 0; |
| 411 if (value.isValueList() && !value.isImageSetValue()) { | 412 if (value.IsValueList() && !value.IsImageSetValue()) { |
| 412 // Walk each value and put it into a layer, creating new layers as needed. | 413 // Walk each value and put it into a layer, creating new layers as needed. |
| 413 const CSSValueList& valueList = toCSSValueList(value); | 414 const CSSValueList& valueList = ToCSSValueList(value); |
| 414 for (unsigned int i = 0; i < valueList.length(); i++) { | 415 for (unsigned int i = 0; i < valueList.length(); i++) { |
| 415 if (!currChild) | 416 if (!currChild) |
| 416 currChild = prevChild->ensureNext(); | 417 currChild = prevChild->EnsureNext(); |
| 417 CSSToStyleMap::{{map_fill}}(state, currChild, valueList.item(i)); | 418 CSSToStyleMap::{{map_fill}}(state, currChild, valueList.Item(i)); |
| 418 prevChild = currChild; | 419 prevChild = currChild; |
| 419 currChild = currChild->next(); | 420 currChild = currChild->Next(); |
| 420 } | 421 } |
| 421 } else { | 422 } else { |
| 422 CSSToStyleMap::{{map_fill}}(state, currChild, value); | 423 CSSToStyleMap::{{map_fill}}(state, currChild, value); |
| 423 currChild = currChild->next(); | 424 currChild = currChild->Next(); |
| 424 } | 425 } |
| 425 while (currChild) { | 426 while (currChild) { |
| 426 // Reset all remaining layers to not have the property set. | 427 // Reset all remaining layers to not have the property set. |
| 427 currChild->clear{{fill_type}}(); | 428 currChild->Clear{{fill_type}}(); |
| 428 currChild = currChild->next(); | 429 currChild = currChild->Next(); |
| 429 } | 430 } |
| 430 } | 431 } |
| 431 {% endmacro %} | 432 {% endmacro %} |
| 432 {{apply_fill_layer('CSSPropertyBackgroundAttachment', 'Attachment')}} | 433 {{apply_fill_layer('CSSPropertyBackgroundAttachment', 'Attachment')}} |
| 433 {{apply_fill_layer('CSSPropertyBackgroundBlendMode', 'BlendMode')}} | 434 {{apply_fill_layer('CSSPropertyBackgroundBlendMode', 'BlendMode')}} |
| 434 {{apply_fill_layer('CSSPropertyBackgroundClip', 'Clip')}} | 435 {{apply_fill_layer('CSSPropertyBackgroundClip', 'Clip')}} |
| 435 {{apply_fill_layer('CSSPropertyBackgroundImage', 'Image')}} | 436 {{apply_fill_layer('CSSPropertyBackgroundImage', 'Image', 'GetImage')}} |
| 436 {{apply_fill_layer('CSSPropertyBackgroundOrigin', 'Origin')}} | 437 {{apply_fill_layer('CSSPropertyBackgroundOrigin', 'Origin')}} |
| 437 {{apply_fill_layer('CSSPropertyBackgroundPositionX', 'XPosition')}} | 438 {{apply_fill_layer('CSSPropertyBackgroundPositionX', 'XPosition')}} |
| 438 {{apply_fill_layer('CSSPropertyBackgroundPositionY', 'YPosition')}} | 439 {{apply_fill_layer('CSSPropertyBackgroundPositionY', 'YPosition')}} |
| 439 {{apply_fill_layer('CSSPropertyBackgroundRepeatX', 'RepeatX')}} | 440 {{apply_fill_layer('CSSPropertyBackgroundRepeatX', 'RepeatX')}} |
| 440 {{apply_fill_layer('CSSPropertyBackgroundRepeatY', 'RepeatY')}} | 441 {{apply_fill_layer('CSSPropertyBackgroundRepeatY', 'RepeatY')}} |
| 441 {{apply_fill_layer('CSSPropertyBackgroundSize', 'Size')}} | 442 {{apply_fill_layer('CSSPropertyBackgroundSize', 'Size', 'size')}} |
| 442 {{apply_fill_layer('CSSPropertyMaskSourceType', 'MaskSourceType')}} | 443 {{apply_fill_layer('CSSPropertyMaskSourceType', 'MaskSourceType')}} |
| 443 {{apply_fill_layer('CSSPropertyWebkitMaskClip', 'Clip')}} | 444 {{apply_fill_layer('CSSPropertyWebkitMaskClip', 'Clip')}} |
| 444 {{apply_fill_layer('CSSPropertyWebkitMaskComposite', 'Composite')}} | 445 {{apply_fill_layer('CSSPropertyWebkitMaskComposite', 'Composite')}} |
| 445 {{apply_fill_layer('CSSPropertyWebkitMaskImage', 'Image')}} | 446 {{apply_fill_layer('CSSPropertyWebkitMaskImage', 'Image', 'GetImage')}} |
| 446 {{apply_fill_layer('CSSPropertyWebkitMaskOrigin', 'Origin')}} | 447 {{apply_fill_layer('CSSPropertyWebkitMaskOrigin', 'Origin')}} |
| 447 {{apply_fill_layer('CSSPropertyWebkitMaskPositionX', 'XPosition')}} | 448 {{apply_fill_layer('CSSPropertyWebkitMaskPositionX', 'XPosition')}} |
| 448 {{apply_fill_layer('CSSPropertyWebkitMaskPositionY', 'YPosition')}} | 449 {{apply_fill_layer('CSSPropertyWebkitMaskPositionY', 'YPosition')}} |
| 449 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatX', 'RepeatX')}} | 450 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatX', 'RepeatX')}} |
| 450 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatY', 'RepeatY')}} | 451 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatY', 'RepeatY')}} |
| 451 {{apply_fill_layer('CSSPropertyWebkitMaskSize', 'Size')}} | 452 {{apply_fill_layer('CSSPropertyWebkitMaskSize', 'Size', 'size')}} |
| 452 | 453 |
| 453 {% macro apply_grid_template(property_id, type) %} | 454 {% macro apply_grid_template(property_id, type) %} |
| 454 {{declare_initial_function(property_id)}} { | 455 {{declare_initial_function(property_id)}} { |
| 455 state.style()->setGridTemplate{{type}}s(ComputedStyle::initialGridTemplate{{ty
pe}}s()); | 456 state.Style()->SetGridTemplate{{type}}s(ComputedStyle::InitialGridTemplate{{ty
pe}}s()); |
| 456 state.style()->setNamedGrid{{type}}Lines(ComputedStyle::initialNamedGrid{{type
}}Lines()); | 457 state.Style()->SetNamedGrid{{type}}Lines(ComputedStyle::InitialNamedGrid{{type
}}Lines()); |
| 457 state.style()->setOrderedNamedGrid{{type}}Lines(ComputedStyle::initialOrderedN
amedGrid{{type}}Lines()); | 458 state.Style()->SetOrderedNamedGrid{{type}}Lines(ComputedStyle::InitialOrderedN
amedGrid{{type}}Lines()); |
| 458 } | 459 } |
| 459 | 460 |
| 460 {{declare_inherit_function(property_id)}} { | 461 {{declare_inherit_function(property_id)}} { |
| 461 state.style()->setGridTemplate{{type}}s(state.parentStyle()->gridTemplate{{typ
e}}s()); | 462 state.Style()->SetGridTemplate{{type}}s(state.ParentStyle()->GridTemplate{{typ
e}}s()); |
| 462 state.style()->setNamedGrid{{type}}Lines(state.parentStyle()->namedGrid{{type}
}Lines()); | 463 state.Style()->SetNamedGrid{{type}}Lines(state.ParentStyle()->NamedGrid{{type}
}Lines()); |
| 463 state.style()->setOrderedNamedGrid{{type}}Lines(state.parentStyle()->orderedNa
medGrid{{type}}Lines()); | 464 state.Style()->SetOrderedNamedGrid{{type}}Lines(state.ParentStyle()->OrderedNa
medGrid{{type}}Lines()); |
| 464 } | 465 } |
| 465 | 466 |
| 466 {{declare_value_function(property_id)}} { | 467 {{declare_value_function(property_id)}} { |
| 467 Vector<GridTrackSize> trackSizes; | 468 Vector<GridTrackSize> trackSizes; |
| 468 Vector<GridTrackSize> autoRepeatTrackSizes; | 469 Vector<GridTrackSize> autoRepeatTrackSizes; |
| 469 NamedGridLinesMap namedGridLines; | 470 NamedGridLinesMap namedGridLines; |
| 470 OrderedNamedGridLines orderedNamedGridLines; | 471 OrderedNamedGridLines orderedNamedGridLines; |
| 471 NamedGridLinesMap autoRepeatNamedGridLines; | 472 NamedGridLinesMap autoRepeatNamedGridLines; |
| 472 OrderedNamedGridLines autoRepeatOrderedNamedGridLines; | 473 OrderedNamedGridLines autoRepeatOrderedNamedGridLines; |
| 473 AutoRepeatType autoRepeatType = ComputedStyle::initialGridAutoRepeatType(); | 474 AutoRepeatType autoRepeatType = ComputedStyle::InitialGridAutoRepeatType(); |
| 474 size_t autoRepeatInsertionPoint = | 475 size_t autoRepeatInsertionPoint = |
| 475 ComputedStyle::initialGridAutoRepeatInsertionPoint(); | 476 ComputedStyle::InitialGridAutoRepeatInsertionPoint(); |
| 476 StyleBuilderConverter::convertGridTrackList( | 477 StyleBuilderConverter::ConvertGridTrackList( |
| 477 value, trackSizes, namedGridLines, orderedNamedGridLines, | 478 value, trackSizes, namedGridLines, orderedNamedGridLines, |
| 478 autoRepeatTrackSizes, autoRepeatNamedGridLines, | 479 autoRepeatTrackSizes, autoRepeatNamedGridLines, |
| 479 autoRepeatOrderedNamedGridLines, autoRepeatInsertionPoint, | 480 autoRepeatOrderedNamedGridLines, autoRepeatInsertionPoint, |
| 480 autoRepeatType, state); | 481 autoRepeatType, state); |
| 481 const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea(); | 482 const NamedGridAreaMap& namedGridAreas = state.Style()->NamedGridArea(); |
| 482 if (!namedGridAreas.isEmpty()) { | 483 if (!namedGridAreas.IsEmpty()) { |
| 483 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea( | 484 StyleBuilderConverter::CreateImplicitNamedGridLinesFromGridArea( |
| 484 namedGridAreas, namedGridLines, For{{type}}s); | 485 namedGridAreas, namedGridLines, kFor{{type}}s); |
| 485 } | 486 } |
| 486 state.style()->setGridTemplate{{type}}s(trackSizes); | 487 state.Style()->SetGridTemplate{{type}}s(trackSizes); |
| 487 state.style()->setNamedGrid{{type}}Lines(namedGridLines); | 488 state.Style()->SetNamedGrid{{type}}Lines(namedGridLines); |
| 488 state.style()->setOrderedNamedGrid{{type}}Lines(orderedNamedGridLines); | 489 state.Style()->SetOrderedNamedGrid{{type}}Lines(orderedNamedGridLines); |
| 489 state.style()->setGridAutoRepeat{{type}}s(autoRepeatTrackSizes); | 490 state.Style()->SetGridAutoRepeat{{type}}s(autoRepeatTrackSizes); |
| 490 state.style()->setGridAutoRepeat{{type}}sInsertionPoint( | 491 state.Style()->SetGridAutoRepeat{{type}}sInsertionPoint( |
| 491 autoRepeatInsertionPoint); | 492 autoRepeatInsertionPoint); |
| 492 state.style()->setAutoRepeatNamedGrid{{type}}Lines(autoRepeatNamedGridLines); | 493 state.Style()->SetAutoRepeatNamedGrid{{type}}Lines(autoRepeatNamedGridLines); |
| 493 state.style()->setAutoRepeatOrderedNamedGrid{{type}}Lines( | 494 state.Style()->SetAutoRepeatOrderedNamedGrid{{type}}Lines( |
| 494 autoRepeatOrderedNamedGridLines); | 495 autoRepeatOrderedNamedGridLines); |
| 495 state.style()->setGridAutoRepeat{{type}}sType(autoRepeatType); | 496 state.Style()->SetGridAutoRepeat{{type}}sType(autoRepeatType); |
| 496 } | 497 } |
| 497 {% endmacro %} | 498 {% endmacro %} |
| 498 {{apply_grid_template('CSSPropertyGridTemplateColumns', 'Column')}} | 499 {{apply_grid_template('CSSPropertyGridTemplateColumns', 'Column')}} |
| 499 {{apply_grid_template('CSSPropertyGridTemplateRows', 'Row')}} | 500 {{apply_grid_template('CSSPropertyGridTemplateRows', 'Row')}} |
| 500 | 501 |
| 501 {% macro apply_svg_paint(property_id, paint_type) %} | 502 {% macro apply_svg_paint(property_id, paint_type) %} |
| 502 {% set property = properties[property_id] %} | 503 {% set property = properties[property_id] %} |
| 503 {{declare_initial_function(property_id)}} { | 504 {{declare_initial_function(property_id)}} { |
| 504 {{set_value(property)}}( | 505 {{set_value(property)}}( |
| 505 SVGComputedStyle::initial{{paint_type}}Type(), | 506 SVGComputedStyle::Initial{{paint_type}}Type(), |
| 506 SVGComputedStyle::initial{{paint_type}}Color(), | 507 SVGComputedStyle::Initial{{paint_type}}Color(), |
| 507 SVGComputedStyle::initial{{paint_type}}Uri(), | 508 SVGComputedStyle::Initial{{paint_type}}Uri(), |
| 508 state.applyPropertyToRegularStyle(), | 509 state.ApplyPropertyToRegularStyle(), |
| 509 state.applyPropertyToVisitedLinkStyle()); | 510 state.ApplyPropertyToVisitedLinkStyle()); |
| 510 } | 511 } |
| 511 | 512 |
| 512 {{declare_inherit_function(property_id)}} { | 513 {{declare_inherit_function(property_id)}} { |
| 513 const SVGComputedStyle& svgParentStyle = state.parentStyle()->svgStyle(); | 514 const SVGComputedStyle& svgParentStyle = state.ParentStyle()->SvgStyle(); |
| 514 {{set_value(property)}}( | 515 {{set_value(property)}}( |
| 515 svgParentStyle.{{paint_type|lower_first}}Type(), | 516 svgParentStyle.{{paint_type}}Type(), |
| 516 svgParentStyle.{{paint_type|lower_first}}Color(), | 517 svgParentStyle.{{paint_type}}Color(), |
| 517 svgParentStyle.{{paint_type|lower_first}}Uri(), | 518 svgParentStyle.{{paint_type}}Uri(), |
| 518 state.applyPropertyToRegularStyle(), | 519 state.ApplyPropertyToRegularStyle(), |
| 519 state.applyPropertyToVisitedLinkStyle()); | 520 state.ApplyPropertyToVisitedLinkStyle()); |
| 520 } | 521 } |
| 521 | 522 |
| 522 {{declare_value_function(property_id)}} { | 523 {{declare_value_function(property_id)}} { |
| 523 const CSSValue* localValue = &value; | 524 const CSSValue* localValue = &value; |
| 524 String url; | 525 String url; |
| 525 if (value.isValueList()) { | 526 if (value.IsValueList()) { |
| 526 const CSSValueList& list = toCSSValueList(value); | 527 const CSSValueList& list = ToCSSValueList(value); |
| 527 DCHECK_EQ(list.length(), 2U); | 528 DCHECK_EQ(list.length(), 2U); |
| 528 url = toCSSURIValue(list.item(0)).value(); | 529 url = ToCSSURIValue(list.Item(0)).Value(); |
| 529 localValue = &list.item(1); | 530 localValue = &list.Item(1); |
| 530 } | 531 } |
| 531 | 532 |
| 532 Color color; | 533 Color color; |
| 533 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR; | 534 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR; |
| 534 if (localValue->isURIValue()) { | 535 if (localValue->IsURIValue()) { |
| 535 paintType = SVG_PAINTTYPE_URI; | 536 paintType = SVG_PAINTTYPE_URI; |
| 536 url = toCSSURIValue(localValue)->value(); | 537 url = ToCSSURIValue(localValue)->Value(); |
| 537 } else if (localValue->isIdentifierValue() && | 538 } else if (localValue->IsIdentifierValue() && |
| 538 toCSSIdentifierValue(localValue)->getValueID() == CSSValueNone) { | 539 ToCSSIdentifierValue(localValue)->GetValueID() == CSSValueNone) { |
| 539 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE; | 540 paintType = url.IsEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE; |
| 540 } else if (localValue->isIdentifierValue() && | 541 } else if (localValue->IsIdentifierValue() && |
| 541 toCSSIdentifierValue(localValue)->getValueID() == CSSValueCurrentco
lor) { | 542 ToCSSIdentifierValue(localValue)->GetValueID() == CSSValueCurrentco
lor) { |
| 542 color = state.style()->color(); | 543 color = state.Style()->GetColor(); |
| 543 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR | 544 paintType = url.IsEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR |
| 544 : SVG_PAINTTYPE_URI_CURRENTCOLOR; | 545 : SVG_PAINTTYPE_URI_CURRENTCOLOR; |
| 545 } else { | 546 } else { |
| 546 color = StyleBuilderConverter::convertColor(state, *localValue); | 547 color = StyleBuilderConverter::ConvertColor(state, *localValue); |
| 547 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR | 548 paintType = url.IsEmpty() ? SVG_PAINTTYPE_RGBCOLOR |
| 548 : SVG_PAINTTYPE_URI_RGBCOLOR; | 549 : SVG_PAINTTYPE_URI_RGBCOLOR; |
| 549 } | 550 } |
| 550 {{set_value(property)}}(paintType, color, url, | 551 {{set_value(property)}}(paintType, color, url, |
| 551 state.applyPropertyToRegularStyle(), | 552 state.ApplyPropertyToRegularStyle(), |
| 552 state.applyPropertyToVisitedLinkStyle()); | 553 state.ApplyPropertyToVisitedLinkStyle()); |
| 553 } | 554 } |
| 554 {% endmacro %} | 555 {% endmacro %} |
| 555 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 556 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
| 556 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 557 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
| 557 } // namespace blink | 558 } // namespace blink |
| OLD | NEW |