OLD | NEW |
---|---|
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 "StyleBuilderFunctions.h" | 9 #include "StyleBuilderFunctions.h" |
10 | 10 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 {{apply_color('CSSPropertyBorderLeftColor')}} | 313 {{apply_color('CSSPropertyBorderLeftColor')}} |
314 {{apply_color('CSSPropertyBorderRightColor')}} | 314 {{apply_color('CSSPropertyBorderRightColor')}} |
315 {{apply_color('CSSPropertyBorderTopColor')}} | 315 {{apply_color('CSSPropertyBorderTopColor')}} |
316 {{apply_color('CSSPropertyOutlineColor')}} | 316 {{apply_color('CSSPropertyOutlineColor')}} |
317 {{apply_color('CSSPropertyTextDecorationColor')}} | 317 {{apply_color('CSSPropertyTextDecorationColor')}} |
318 {{apply_color('CSSPropertyColumnRuleColor')}} | 318 {{apply_color('CSSPropertyColumnRuleColor')}} |
319 {{apply_color('CSSPropertyWebkitTextEmphasisColor')}} | 319 {{apply_color('CSSPropertyWebkitTextEmphasisColor')}} |
320 {{apply_color('CSSPropertyWebkitTextFillColor')}} | 320 {{apply_color('CSSPropertyWebkitTextFillColor')}} |
321 {{apply_color('CSSPropertyWebkitTextStrokeColor')}} | 321 {{apply_color('CSSPropertyWebkitTextStrokeColor')}} |
322 | 322 |
323 {% macro apply_auto_color(property_id) %} | |
324 {% set property = properties[property_id] %} | |
325 {% set visited_link_setter = 'setVisitedLink' + property.name_for_methods %} | |
326 {{declare_initial_function(property_id)}} { | |
327 StyleAutoColor color = StyleAutoColor::autoColor(); | |
328 if (state.applyPropertyToRegularStyle()) | |
329 {{set_value(property)}}(color); | |
330 if (state.applyPropertyToVisitedLinkStyle()) | |
331 state.style()->{{visited_link_setter}}(color); | |
332 } | |
333 | |
334 {{declare_inherit_function(property_id)}} { | |
335 // Visited link style can never explicitly inherit from parent visited link | |
336 // style so no separate getters are needed. | |
337 StyleAutoColor color = state.parentStyle()->{{property.getter}}(); | |
338 if (state.applyPropertyToRegularStyle()) | |
339 {{set_value(property)}}(color); | |
340 if (state.applyPropertyToVisitedLinkStyle()) | |
341 state.style()->{{visited_link_setter}}(color); | |
342 } | |
343 | |
344 {{declare_value_function(property_id)}} | |
345 { | |
346 if (state.applyPropertyToRegularStyle()) | |
347 {{set_value(property)}}(StyleBuilderConverter::convertStyleAutoColor(state, value)); | |
348 if (state.applyPropertyToVisitedLinkStyle()) { | |
349 state.style()->{{visited_link_setter}}( | |
350 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); | |
351 } | |
352 } | |
353 {% endmacro %} | |
354 {{apply_auto_color('CSSPropertyCaretColor') }} | |
Timothy Loh
2016/11/28 03:11:21
Since this is only for a single property, it's bet
Manuel Rego
2016/11/28 10:47:54
Ok I'll move it.
Anyway, as I said it's supposed t
| |
355 | |
323 {% macro apply_counter(property_id, action) %} | 356 {% macro apply_counter(property_id, action) %} |
324 {% set property = properties[property_id] %} | 357 {% set property = properties[property_id] %} |
325 {{declare_initial_function(property_id)}} { | 358 {{declare_initial_function(property_id)}} { |
326 state.style()->clear{{action}}Directives(); | 359 state.style()->clear{{action}}Directives(); |
327 } | 360 } |
328 | 361 |
329 {{declare_inherit_function(property_id)}} { | 362 {{declare_inherit_function(property_id)}} { |
330 const CounterDirectiveMap* parentMap = state.parentStyle()->counterDirectives( ); | 363 const CounterDirectiveMap* parentMap = state.parentStyle()->counterDirectives( ); |
331 if (!parentMap) | 364 if (!parentMap) |
332 return; | 365 return; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 : SVG_PAINTTYPE_URI_RGBCOLOR; | 581 : SVG_PAINTTYPE_URI_RGBCOLOR; |
549 } | 582 } |
550 {{set_value(property)}}(paintType, color, url, | 583 {{set_value(property)}}(paintType, color, url, |
551 state.applyPropertyToRegularStyle(), | 584 state.applyPropertyToRegularStyle(), |
552 state.applyPropertyToVisitedLinkStyle()); | 585 state.applyPropertyToVisitedLinkStyle()); |
553 } | 586 } |
554 {% endmacro %} | 587 {% endmacro %} |
555 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 588 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
556 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 589 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
557 } // namespace blink | 590 } // namespace blink |
OLD | NEW |