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

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

Issue 21625003: StyleBuilder should not know about StyleResolver. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 {% from "macros.tmpl" import lower_first -%} 1 {% from "macros.tmpl" import lower_first -%}
2 2
3 {# 3 {#
4 This file is for property handlers which use the templating engine to 4 This file is for property handlers which use the templating engine to
5 reduce (handwritten) code duplication. 5 reduce (handwritten) code duplication.
6 6
7 The `properties' dict can be used to access a property's parameters in 7 The `properties' dict can be used to access a property's parameters in
8 jinja2 templates (i.e. setter, getter, initial, type_name) 8 jinja2 templates (i.e. setter, getter, initial, type_name)
9 -#} 9 -#}
10 10
11 #include "config.h" 11 #include "config.h"
12 #include "StyleBuilderFunctions.h" 12 #include "StyleBuilderFunctions.h"
13 13
14 #include "CSSValueKeywords.h" 14 #include "CSSValueKeywords.h"
15 #include "core/css/BasicShapeFunctions.h" 15 #include "core/css/BasicShapeFunctions.h"
16 #include "core/css/CSSPrimitiveValueMappings.h" 16 #include "core/css/CSSPrimitiveValueMappings.h"
17 #include "core/css/Pair.h" 17 #include "core/css/Pair.h"
18 #include "core/css/resolver/StyleResolver.h" 18 #include "core/css/resolver/StyleResolverState.h"
19 #include "core/platform/animation/CSSAnimationDataList.h"
20
19 21
20 {%- macro declare_initial_function(property_id) -%} 22 {%- macro declare_initial_function(property_id) -%}
21 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolver* styleReso lver, StyleResolverState& state) 23 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& stat e)
22 {%- endmacro %} 24 {%- endmacro %}
23 25
24 {%- macro declare_inherit_function(property_id) -%} 26 {%- macro declare_inherit_function(property_id) -%}
25 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolver* styleReso lver, StyleResolverState& state) 27 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& stat e)
26 {%- endmacro %} 28 {%- endmacro %}
27 29
28 {%- macro declare_value_function(property_id) -%} 30 {%- macro declare_value_function(property_id) -%}
29 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolver* styleResolv er, StyleResolverState& state, CSSValue* value) 31 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state, CSSValue* value)
30 {%- endmacro %} 32 {%- endmacro %}
31 33
32 // FIXME: This is duplicated in StyleBuilder.cpp.tmpl, but we'll move the 34 // FIXME: This is duplicated in StyleBuilder.cpp.tmpl, but we'll move the
33 // function definitions there over to here later. 35 // function definitions there over to here later.
34 {%- macro set_value(property) %} 36 {%- macro set_value(property) %}
35 {%- if property.svg -%} 37 {%- if property.svg -%}
36 state.style()->accessSVGStyle()->{{property.setter}} 38 state.style()->accessSVGStyle()->{{property.setter}}
37 {%- else -%} 39 {%- else -%}
38 state.style()->{{property.setter}} 40 state.style()->{{property.setter}}
39 {%- endif -%} 41 {%- endif -%}
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 302
301 {{ declare_value_function(property_id) }} 303 {{ declare_value_function(property_id) }}
302 { 304 {
303 if (!value->isPrimitiveValue()) 305 if (!value->isPrimitiveValue())
304 return; 306 return;
305 307
306 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 308 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
307 309
308 {%- if inherit_color %} 310 {%- if inherit_color %}
309 if (primitiveValue->getValueID() == CSSValueCurrentcolor) { 311 if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
310 applyInherit{{property_id}}(styleResolver, state); 312 applyInherit{{property_id}}(state);
311 return; 313 return;
312 } 314 }
313 {%- endif %} 315 {%- endif %}
314 316
315 if (state.applyPropertyToRegularStyle()) 317 if (state.applyPropertyToRegularStyle())
316 {{ set_value(property) }}(state.document()->textLinkColors().colorFromPr imitiveValue(primitiveValue)); 318 {{ set_value(property) }}(state.document()->textLinkColors().colorFromPr imitiveValue(primitiveValue));
317 if (state.applyPropertyToVisitedLinkStyle()) 319 if (state.applyPropertyToVisitedLinkStyle())
318 state.style()->{{visited_link_setter}}(state.document()->textLinkColors( ).colorFromPrimitiveValue(primitiveValue, state.element()->isLink() /* forVisite dLink */)); 320 state.style()->{{visited_link_setter}}(state.document()->textLinkColors( ).colorFromPrimitiveValue(primitiveValue, state.element()->isLink() /* forVisite dLink */));
319 } 321 }
320 {%- endmacro %} 322 {%- endmacro %}
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 643 }
642 {%- endmacro %} 644 {%- endmacro %}
643 645
644 {{ apply_value_string("CSSPropertyWebkitHighlight", "CSSValueNone") }} 646 {{ apply_value_string("CSSPropertyWebkitHighlight", "CSSValueNone") }}
645 {{ apply_value_string("CSSPropertyWebkitHyphenateCharacter", "CSSValueAuto") }} 647 {{ apply_value_string("CSSPropertyWebkitHyphenateCharacter", "CSSValueAuto") }}
646 {{ apply_value_string("CSSPropertyWebkitLineGrid", "CSSValueNone") }} 648 {{ apply_value_string("CSSPropertyWebkitLineGrid", "CSSValueNone") }}
647 {{ apply_value_string("CSSPropertyWebkitFlowFrom", "CSSValueNone") }} 649 {{ apply_value_string("CSSPropertyWebkitFlowFrom", "CSSValueNone") }}
648 {{ apply_value_string("CSSPropertyWebkitFlowInto", "CSSValueNone") }} 650 {{ apply_value_string("CSSPropertyWebkitFlowInto", "CSSValueNone") }}
649 651
650 } // namespace WebCore 652 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/scripts/templates/StyleBuilder.cpp.tmpl ('k') | Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698