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

Side by Side Diff: sky/engine/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 667003003: Remove most of visited link support. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | sky/engine/core/animation/animatable/AnimatableColor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from 'macros.tmpl' import license %} 1 {% from 'macros.tmpl' import license %}
2 {# 2 {#
3 This file is for property handlers which use the templating engine to 3 This file is for property handlers which use the templating engine to
4 reduce (handwritten) code duplication. 4 reduce (handwritten) code duplication.
5 5
6 The `properties' dict can be used to access a property's parameters in 6 The `properties' dict can be used to access a property's parameters in
7 jinja2 templates (i.e. setter, getter, initial, type_name) 7 jinja2 templates (i.e. setter, getter, initial, type_name)
8 #} 8 #}
9 #include "config.h" 9 #include "config.h"
10 #include "StyleBuilderFunctions.h" 10 #include "StyleBuilderFunctions.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 { 265 {
266 {% set property = properties[property_id] %} 266 {% set property = properties[property_id] %}
267 {{set_value(property)}}(state.styleImage({{property_id}}, value)); 267 {{set_value(property)}}(state.styleImage({{property_id}}, value));
268 } 268 }
269 {% endmacro %} 269 {% endmacro %}
270 {{apply_value_border_image_source('CSSPropertyBorderImageSource')}} 270 {{apply_value_border_image_source('CSSPropertyBorderImageSource')}}
271 {{apply_value_border_image_source('CSSPropertyWebkitMaskBoxImageSource')}} 271 {{apply_value_border_image_source('CSSPropertyWebkitMaskBoxImageSource')}}
272 272
273 {% macro apply_color(property_id, initial_color='StyleColor::currentColor') %} 273 {% macro apply_color(property_id, initial_color='StyleColor::currentColor') %}
274 {% set property = properties[property_id] %} 274 {% set property = properties[property_id] %}
275 {% set visited_link_setter = 'setVisitedLink' + property.name_for_methods %}
276 {{declare_initial_function(property_id)}} 275 {{declare_initial_function(property_id)}}
277 { 276 {
278 StyleColor color = {{initial_color}}(); 277 StyleColor color = {{initial_color}}();
279 if (state.applyPropertyToRegularStyle()) 278 {{set_value(property)}}(color);
280 {{set_value(property)}}(color);
281 if (state.applyPropertyToVisitedLinkStyle())
282 state.style()->{{visited_link_setter}}(color);
283 } 279 }
284 280
285 {{declare_inherit_function(property_id)}} 281 {{declare_inherit_function(property_id)}}
286 { 282 {
287 // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
288 StyleColor color = state.parentStyle()->{{property.getter}}(); 283 StyleColor color = state.parentStyle()->{{property.getter}}();
289 Color resolvedColor = color.resolve(state.parentStyle()->color()); 284 Color resolvedColor = color.resolve(state.parentStyle()->color());
290 if (state.applyPropertyToRegularStyle()) 285 {{set_value(property)}}(resolvedColor);
291 {{set_value(property)}}(resolvedColor);
292 if (state.applyPropertyToVisitedLinkStyle())
293 state.style()->{{visited_link_setter}}(resolvedColor);
294 } 286 }
295 287
296 {{declare_value_function(property_id)}} 288 {{declare_value_function(property_id)}}
297 { 289 {
298 if (state.applyPropertyToRegularStyle()) 290 {{set_value(property)}}(StyleBuilderConverter::convertColor(state, value));
299 {{set_value(property)}}(StyleBuilderConverter::convertColor(state, value ));
300 if (state.applyPropertyToVisitedLinkStyle())
301 state.style()->{{visited_link_setter}}(StyleBuilderConverter::convertCol or(state, value, true));
302 } 291 }
303 {% endmacro %} 292 {% endmacro %}
304 {{apply_color('CSSPropertyBackgroundColor', initial_color='RenderStyle::initialB ackgroundColor') }} 293 {{apply_color('CSSPropertyBackgroundColor', initial_color='RenderStyle::initialB ackgroundColor') }}
305 {{apply_color('CSSPropertyBorderBottomColor')}} 294 {{apply_color('CSSPropertyBorderBottomColor')}}
306 {{apply_color('CSSPropertyBorderLeftColor')}} 295 {{apply_color('CSSPropertyBorderLeftColor')}}
307 {{apply_color('CSSPropertyBorderRightColor')}} 296 {{apply_color('CSSPropertyBorderRightColor')}}
308 {{apply_color('CSSPropertyBorderTopColor')}} 297 {{apply_color('CSSPropertyBorderTopColor')}}
309 {{apply_color('CSSPropertyOutlineColor')}} 298 {{apply_color('CSSPropertyOutlineColor')}}
310 {{apply_color('CSSPropertyTextDecorationColor')}} 299 {{apply_color('CSSPropertyTextDecorationColor')}}
311 {{apply_color('CSSPropertyWebkitTextEmphasisColor')}} 300 {{apply_color('CSSPropertyWebkitTextEmphasisColor')}}
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } else { 544 } else {
556 state.style()->set{{alignment_type}}(*primitiveValue); 545 state.style()->set{{alignment_type}}(*primitiveValue);
557 } 546 }
558 } 547 }
559 {% endmacro %} 548 {% endmacro %}
560 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}} 549 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}}
561 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} 550 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}}
562 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} 551 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}}
563 552
564 } // namespace blink 553 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/animation/animatable/AnimatableColor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698