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

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

Issue 16530002: Move Color and FillLayer properties to new StyleBuilder (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebased Created 7 years, 6 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
OLDNEW
1 {% from "macros.tmpl" import wrap_with_condition, license -%} 1 {% from "macros.tmpl" import wrap_with_condition, license -%}
2 {{ license() }} 2 {{ license() }}
3 3
4 #include "config.h" 4 #include "config.h"
5 #include "core/css/resolver/StyleBuilder.h" 5 #include "core/css/resolver/StyleBuilder.h"
6 6
7 #include "StyleBuilderFunctions.h" 7 #include "StyleBuilderFunctions.h"
8 #include "core/css/CSSPrimitiveValueMappings.h" 8 #include "core/css/CSSPrimitiveValueMappings.h"
9 #include "core/css/resolver/StyleResolver.h" 9 #include "core/css/resolver/StyleResolver.h"
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 length.setQuirk(primitiveValue->isQuirkValue()); 52 length.setQuirk(primitiveValue->isQuirkValue());
53 {{ set_value(property) }}(length); 53 {{ set_value(property) }}(length);
54 } else if (primitiveValue->isPercentage()) 54 } else if (primitiveValue->isPercentage())
55 {{ set_value(property) }}(Length(primitiveValue->getDoubleValue(), Perce nt)); 55 {{ set_value(property) }}(Length(primitiveValue->getDoubleValue(), Perce nt));
56 else if (primitiveValue->isCalculatedPercentageWithLength()) 56 else if (primitiveValue->isCalculatedPercentageWithLength())
57 {{ set_value(property) }}(Length(primitiveValue->cssCalcValue()->toCalcV alue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->s tyle()->effectiveZoom()))); 57 {{ set_value(property) }}(Length(primitiveValue->cssCalcValue()->toCalcV alue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->s tyle()->effectiveZoom())));
58 else if (primitiveValue->isViewportPercentageLength()) 58 else if (primitiveValue->isViewportPercentageLength())
59 {{ set_value(property) }}(primitiveValue->viewportPercentageLength()); 59 {{ set_value(property) }}(primitiveValue->viewportPercentageLength());
60 {%- endmacro %} 60 {%- endmacro %}
61 61
62 {%- for property_id, property in properties.items() %} 62 {%- for property_id, property in properties.items() if not property.use_handlers _for %}
63 {%- call wrap_with_condition(property.condition) %} 63 {%- call wrap_with_condition(property.condition) %}
64 {%- set apply_type = property.apply_type %} 64 {%- set apply_type = property.apply_type %}
65 65
66 {%- if not property.custom_initial %} 66 {%- if not property.custom_initial %}
67 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolver* styleReso lver) 67 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolver* styleReso lver)
68 { 68 {
69 {{ set_value(property) }}(RenderStyle::{{property.initial}}()); 69 {{ set_value(property) }}(RenderStyle::{{property.initial}}());
70 } 70 }
71 {% endif %} 71 {% endif %}
72 72
(...skipping 14 matching lines...) Expand all
87 {%- endif %} 87 {%- endif %}
88 } 88 }
89 {% endif %} 89 {% endif %}
90 90
91 {%- endcall %} 91 {%- endcall %}
92 {%- endfor %} 92 {%- endfor %}
93 93
94 bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolver* styleRes olver, CSSValue* value, bool isInitial, bool isInherit) { 94 bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolver* styleRes olver, CSSValue* value, bool isInitial, bool isInherit) {
95 switch(property) { 95 switch(property) {
96 {%- for property_id, property in properties.items() %} 96 {%- for property_id, property in properties.items() %}
97 {%- call wrap_with_condition(property.condition) %} 97 {%- set used_property = properties[property.use_handlers_for] or property %}
98 {%- set used_property_id = used_property.property_id %}
99 {%- call wrap_with_condition(used_property.condition) %}
98 case {{ property_id }}: 100 case {{ property_id }}:
99 if (isInitial) 101 if (isInitial)
100 StyleBuilderFunctions::applyInitial{{ property_id }}(styleResolver); 102 StyleBuilderFunctions::applyInitial{{ used_property_id }}(styleResol ver);
101 else if (isInherit) 103 else if (isInherit)
102 StyleBuilderFunctions::applyInherit{{ property_id }}(styleResolver); 104 StyleBuilderFunctions::applyInherit{{ used_property_id }}(styleResol ver);
103 else 105 else
104 StyleBuilderFunctions::applyValue{{ property_id }}(styleResolver, va lue); 106 StyleBuilderFunctions::applyValue{{ used_property_id }}(styleResolve r, value);
105 return true; 107 return true;
106 {%- endcall %} 108 {%- endcall %}
107 {% endfor %} 109 {% endfor %}
108 default: 110 default:
109 return false; 111 return false;
110 } 112 }
111 } 113 }
112 114
113 } // namespace WebCore 115 } // namespace WebCore
114 116
OLDNEW
« no previous file with comments | « Source/core/scripts/make_style_builder.py ('k') | Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698