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

Unified Diff: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 236763002: Move default StyleBuilderFunctions handlers from StyleBuilder.cpp to StyleBuilderFunctions.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/build/scripts/templates/StyleBuilder.cpp.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
diff --git a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
index e15a93f26bc669bb08b241be99d8963778818539..56d33b62d333afa30657e194205876a8e64be3b7 100644
--- a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
+++ b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
@@ -16,7 +16,6 @@
#include "core/css/Pair.h"
#include "core/css/resolver/StyleResolverState.h"
-{# FIXME: factor macros out into a separate library #}
{% macro declare_initial_function(property_id) %}
void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& state)
{%- endmacro %}
@@ -26,19 +25,58 @@ void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& stat
{% macro declare_value_function(property_id) %}
void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state, CSSValue* value)
{%- endmacro %}
-// FIXME: This is duplicated in StyleBuilder.cpp.tmpl, but we'll move the
-// function definitions there over to here later.
{% macro set_value(property) %}
{% if property.svg %}
state.style()->accessSVGStyle()->{{property.setter}}
+{%- elif property.font %}
+state.fontBuilder().{{property.setter}}
{%- else %}
state.style()->{{property.setter}}
{%- endif %}
{% endmacro %}
namespace WebCore {
-{# FIXME: remove excess newline #}
+{% for property_id, property in properties.items() if not property.use_handlers_for %}
+{% set apply_type = property.apply_type %}
+{% if not property.custom_initial %}
+{{declare_initial_function(property_id)}}
+{
+ {% if property.svg %}
+ {{set_value(property)}}(SVGRenderStyle::{{property.initial}}());
+ {% elif property.font %}
+ {{set_value(property)}}(FontBuilder::{{property.initial}}());
+ {% else %}
+ {{set_value(property)}}(RenderStyle::{{property.initial}}());
+ {% endif %}
+}
+
+{% endif %}
+{% if not property.custom_inherit %}
+{{declare_inherit_function(property_id)}}
+{
+ {% if property.svg %}
+ {{set_value(property)}}(state.parentStyle()->svgStyle()->{{property.getter}}());
+ {% elif property.font %}
+ {{set_value(property)}}(state.parentFontDescription().{{property.getter}}());
+ {% else %}
+ {{set_value(property)}}(state.parentStyle()->{{property.getter}}());
+ {% endif %}
+}
+
+{% endif %}
+{% if not property.custom_value %}
+{{declare_value_function(property_id)}}
+{
+ {% if property.converter %}
+ {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, value));
+ {% else %}
+ {{set_value(property)}}(static_cast<{{property.type_name}}>(*toCSSPrimitiveValue(value)));
+ {% endif %}
+}
+
+{% endif %}
+{% endfor %}
{% macro apply_animation(property_id, attribute, animation) %}
{{declare_initial_function(property_id)}}
« no previous file with comments | « Source/build/scripts/templates/StyleBuilder.cpp.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698