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

Side by Side Diff: Source/core/scripts/templates/StyleBuilder.cpp.tmpl

Issue 15157002: Begin moving DeprecatedStyleBuilder properties to new generated StyleBuilder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: move StyleBuilder call to below DeprecatedStyleBuilder Created 7 years, 7 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 unified diff | Download patch
« no previous file with comments | « Source/core/scripts/make_style_builder.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 {% from "macros.tmpl" import wrap_with_condition, license -%}
2 {{ license() }}
3
4 #include "config.h"
5 #include "core/css/resolver/StyleBuilder.h"
6
7 #include "core/css/CSSPrimitiveValueMappings.h"
8 #include "core/css/resolver/StyleResolver.h"
9
10 // FIXME: currently we're just generating a switch statement, but we should
11 // test other variations for performance once we have more properties here.
12
13 namespace WebCore {
14
15 class StyleBuilderImpl {
16 public:
17
18 {%- macro setValue(property) -%}
19 styleResolver->style()->{{property.setter}}
20 {%- endmacro %}
21
22 {%- for property in properties %}
23 {%- call wrap_with_condition(property.condition) %}
24 {%- set propertyid = property.propertyid %}
25 {%- set applytype = property.applytype %}
26
27 static void applyInitial{{propertyid}}(StyleResolver* styleResolver)
28 {
29 {{ setValue(property) }}(RenderStyle::{{property.initial}}());
30 }
31
32 static void applyInherit{{propertyid}}(StyleResolver* styleResolver)
33 {
34 {{ setValue(property) }}(styleResolver->parentStyle()->{{property.getter}}() );
35 }
36
37 static void applyValue{{propertyid}}(StyleResolver* styleResolver, CSSValue* val ue)
38 {
39 {{ setValue(property) }}(static_cast<{{property.typename}}>(*static_cast<CSS PrimitiveValue*>(value)));
40 }
41
42 {%- endcall %}
43 {%- endfor %}
44
45 };
46
47 bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolver* styleRes olver, CSSValue* value, bool isInitial, bool isInherit) {
48 switch(property) {
49 {%- for property in properties %}
50 {%- call wrap_with_condition(property.condition) %}
51 {%- set propertyid = property.propertyid %}
52 case {{propertyid}}:
53 if (isInitial)
54 StyleBuilderImpl::applyInitial{{propertyid}}(styleResolver);
55 else if (isInherit)
56 StyleBuilderImpl::applyInherit{{propertyid}}(styleResolver);
57 else
58 StyleBuilderImpl::applyValue{{propertyid}}(styleResolver, value);
59 return true;
60 {%- endcall %}
61 {% endfor %}
62 default:
63 return false;
64 }
65 }
66 }
67
OLDNEW
« no previous file with comments | « Source/core/scripts/make_style_builder.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698