Commit 06636811 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Perform svg_paint property application in CSSProperty classes.

R=futhark@chromium.org

Bug: 751354
Change-Id: I6d49e24d53cdde68e923c3bb693310a95d933ac8
Reviewed-on: https://chromium-review.googlesource.com/1070187
Commit-Queue: Anders Ruud <andruud@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561859}
parent a0e2d7ef
......@@ -201,6 +201,31 @@ state.Style()->{{property.setter}}
data.{{vector}}.clear();
for (auto& listValue : ToCSSValueList(value))
data.{{vector}}.push_back(CSSToStyleMap::MapAnimation{{attribute}}(*listValue));
}
{% elif property.style_builder_template == 'svg_paint' %}
{% set paint_type = property.style_builder_template_args['paint_type'] %}
{% set visited_link_setter = 'SetVisitedLink' + paint_type %}
{{declare_initial()}} {
if (state.ApplyPropertyToRegularStyle())
{{set_value(property)}}(SVGComputedStyle::Initial{{paint_type}}());
if (state.ApplyPropertyToVisitedLinkStyle())
state.Style()->AccessSVGStyle().{{visited_link_setter}}(SVGComputedStyle::Initial{{paint_type}}());
}
{{declare_inherit()}} {
const SVGComputedStyle& parent_svg_style = state.ParentStyle()->SvgStyle();
if (state.ApplyPropertyToRegularStyle())
{{set_value(property)}}(parent_svg_style.{{paint_type}}());
if (state.ApplyPropertyToVisitedLinkStyle())
state.Style()->AccessSVGStyle().{{visited_link_setter}}(parent_svg_style.{{paint_type}}());
}
{{declare_value()}} {
SVGPaint paint = StyleBuilderConverter::{{property.converter}}(state, value);
if (state.ApplyPropertyToRegularStyle())
{{set_value(property)}}(paint);
if (state.ApplyPropertyToVisitedLinkStyle())
state.Style()->AccessSVGStyle().{{visited_link_setter}}(paint);
}
{% endif %}
{%- endif %}
......
......@@ -85,33 +85,4 @@ namespace blink {
{% endif %}
{% endfor %}
{% macro apply_svg_paint(property_id, paint_type) %}
{% set property = properties_by_id[property_id] %}
{% set visited_link_setter = 'SetVisitedLink' + paint_type %}
{{declare_initial_function(property_id)}} {
if (state.ApplyPropertyToRegularStyle())
{{set_value(property)}}(SVGComputedStyle::Initial{{paint_type}}());
if (state.ApplyPropertyToVisitedLinkStyle())
state.Style()->AccessSVGStyle().{{visited_link_setter}}(SVGComputedStyle::Initial{{paint_type}}());
}
{{declare_inherit_function(property_id)}} {
const SVGComputedStyle& parent_svg_style = state.ParentStyle()->SvgStyle();
if (state.ApplyPropertyToRegularStyle())
{{set_value(property)}}(parent_svg_style.{{paint_type}}());
if (state.ApplyPropertyToVisitedLinkStyle())
state.Style()->AccessSVGStyle().{{visited_link_setter}}(parent_svg_style.{{paint_type}}());
}
{{declare_value_function(property_id)}} {
SVGPaint paint = StyleBuilderConverter::ConvertSVGPaint(state, value);
if (state.ApplyPropertyToRegularStyle())
{{set_value(property)}}(paint);
if (state.ApplyPropertyToVisitedLinkStyle())
state.Style()->AccessSVGStyle().{{visited_link_setter}}(paint);
}
{% endmacro %}
{{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
{{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
} // namespace blink
......@@ -69,6 +69,7 @@
"legacy",
"mask_box",
"mask_layer",
"svg_paint",
"transition",
],
},
......@@ -1602,8 +1603,11 @@
inherited: true,
svg: true,
setter: "SetFillPaint",
style_builder_legacy: true,
style_builder_template: "legacy",
converter: "ConvertSVGPaint",
style_builder_template: "svg_paint",
style_builder_template_args: {
paint_type: "FillPaint",
},
},
{
name: "fill-opacity",
......@@ -2936,8 +2940,11 @@
inherited: true,
svg: true,
setter: "SetStrokePaint",
style_builder_legacy: true,
style_builder_template: "legacy",
converter: "ConvertSVGPaint",
style_builder_template: "svg_paint",
style_builder_template_args: {
paint_type: "StrokePaint",
},
},
{
name: "stroke-dasharray",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment