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 "config.h" | 9 #include "config.h" |
10 #include "StyleBuilderFunctions.h" | 10 #include "StyleBuilderFunctions.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 {% if property.svg %} | 31 {% if property.svg %} |
32 state.style()->accessSVGStyle().{{property.setter}} | 32 state.style()->accessSVGStyle().{{property.setter}} |
33 {%- elif property.font %} | 33 {%- elif property.font %} |
34 state.fontBuilder().{{property.setter}} | 34 state.fontBuilder().{{property.setter}} |
35 {%- else %} | 35 {%- else %} |
36 state.style()->{{property.setter}} | 36 state.style()->{{property.setter}} |
37 {%- endif %} | 37 {%- endif %} |
38 {% endmacro %} | 38 {% endmacro %} |
39 {% macro convert_and_set_value(property) %} | 39 {% macro convert_and_set_value(property) %} |
40 {% if property.converter %} | 40 {% if property.converter %} |
41 {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, val
ue)); | 41 {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, *va
lue)); |
42 {%- else %} | 42 {%- else %} |
43 {{set_value(property)}}(static_cast<{{property.type_name}}>(*toCSSPrimitiveValue
(value))); | 43 {{set_value(property)}}(static_cast<{{property.type_name}}>(*toCSSPrimitiveValue
(value))); |
44 {%- endif %} | 44 {%- endif %} |
45 {% endmacro %} | 45 {% endmacro %} |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 {% for property_id, property in properties.items() if property.should_declare_fu
nctions %} | 49 {% for property_id, property in properties.items() if property.should_declare_fu
nctions %} |
50 {% set apply_type = property.apply_type %} | 50 {% set apply_type = property.apply_type %} |
51 {% if not property.custom_initial %} | 51 {% if not property.custom_initial %} |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 StyleColor color = state.parentStyle()->{{property.getter}}(); | 286 StyleColor color = state.parentStyle()->{{property.getter}}(); |
287 if (state.applyPropertyToRegularStyle()) | 287 if (state.applyPropertyToRegularStyle()) |
288 {{set_value(property)}}(color); | 288 {{set_value(property)}}(color); |
289 if (state.applyPropertyToVisitedLinkStyle()) | 289 if (state.applyPropertyToVisitedLinkStyle()) |
290 state.style()->{{visited_link_setter}}(color); | 290 state.style()->{{visited_link_setter}}(color); |
291 } | 291 } |
292 | 292 |
293 {{declare_value_function(property_id)}} | 293 {{declare_value_function(property_id)}} |
294 { | 294 { |
295 if (state.applyPropertyToRegularStyle()) | 295 if (state.applyPropertyToRegularStyle()) |
296 {{set_value(property)}}(StyleBuilderConverter::convertStyleColor(state,
value)); | 296 {{set_value(property)}}(StyleBuilderConverter::convertStyleColor(state,
*value)); |
297 if (state.applyPropertyToVisitedLinkStyle()) | 297 if (state.applyPropertyToVisitedLinkStyle()) |
298 state.style()->{{visited_link_setter}}(StyleBuilderConverter::convertSty
leColor(state, value, true)); | 298 state.style()->{{visited_link_setter}}(StyleBuilderConverter::convertSty
leColor(state, *value, true)); |
299 } | 299 } |
300 {% endmacro %} | 300 {% endmacro %} |
301 {{apply_color('CSSPropertyBackgroundColor', initial_color='ComputedStyle::initia
lBackgroundColor') }} | 301 {{apply_color('CSSPropertyBackgroundColor', initial_color='ComputedStyle::initia
lBackgroundColor') }} |
302 {{apply_color('CSSPropertyBorderBottomColor')}} | 302 {{apply_color('CSSPropertyBorderBottomColor')}} |
303 {{apply_color('CSSPropertyBorderLeftColor')}} | 303 {{apply_color('CSSPropertyBorderLeftColor')}} |
304 {{apply_color('CSSPropertyBorderRightColor')}} | 304 {{apply_color('CSSPropertyBorderRightColor')}} |
305 {{apply_color('CSSPropertyBorderTopColor')}} | 305 {{apply_color('CSSPropertyBorderTopColor')}} |
306 {{apply_color('CSSPropertyOutlineColor')}} | 306 {{apply_color('CSSPropertyOutlineColor')}} |
307 {{apply_color('CSSPropertyTextDecorationColor')}} | 307 {{apply_color('CSSPropertyTextDecorationColor')}} |
308 {{apply_color('CSSPropertyWebkitColumnRuleColor')}} | 308 {{apply_color('CSSPropertyWebkitColumnRuleColor')}} |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 state.style()->setGridTemplate{{type}}s(state.parentStyle()->gridTemplate{{t
ype}}s()); | 458 state.style()->setGridTemplate{{type}}s(state.parentStyle()->gridTemplate{{t
ype}}s()); |
459 state.style()->setNamedGrid{{type}}Lines(state.parentStyle()->namedGrid{{typ
e}}Lines()); | 459 state.style()->setNamedGrid{{type}}Lines(state.parentStyle()->namedGrid{{typ
e}}Lines()); |
460 state.style()->setOrderedNamedGrid{{type}}Lines(state.parentStyle()->ordered
NamedGrid{{type}}Lines()); | 460 state.style()->setOrderedNamedGrid{{type}}Lines(state.parentStyle()->ordered
NamedGrid{{type}}Lines()); |
461 } | 461 } |
462 | 462 |
463 {{declare_value_function(property_id)}} | 463 {{declare_value_function(property_id)}} |
464 { | 464 { |
465 Vector<GridTrackSize> trackSizes; | 465 Vector<GridTrackSize> trackSizes; |
466 NamedGridLinesMap namedGridLines; | 466 NamedGridLinesMap namedGridLines; |
467 OrderedNamedGridLines orderedNamedGridLines; | 467 OrderedNamedGridLines orderedNamedGridLines; |
468 StyleBuilderConverter::convertGridTrackList(value, trackSizes, namedGridLine
s, orderedNamedGridLines, state); | 468 StyleBuilderConverter::convertGridTrackList(*value, trackSizes, namedGridLin
es, orderedNamedGridLines, state); |
469 const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea(); | 469 const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea(); |
470 if (!namedGridAreas.isEmpty()) | 470 if (!namedGridAreas.isEmpty()) |
471 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(namedGri
dAreas, namedGridLines, For{{type}}s); | 471 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(namedGri
dAreas, namedGridLines, For{{type}}s); |
472 state.style()->setGridTemplate{{type}}s(trackSizes); | 472 state.style()->setGridTemplate{{type}}s(trackSizes); |
473 state.style()->setNamedGrid{{type}}Lines(namedGridLines); | 473 state.style()->setNamedGrid{{type}}Lines(namedGridLines); |
474 state.style()->setOrderedNamedGrid{{type}}Lines(orderedNamedGridLines); | 474 state.style()->setOrderedNamedGrid{{type}}Lines(orderedNamedGridLines); |
475 } | 475 } |
476 {% endmacro %} | 476 {% endmacro %} |
477 {{apply_grid_template('CSSPropertyGridTemplateColumns', 'Column')}} | 477 {{apply_grid_template('CSSPropertyGridTemplateColumns', 'Column')}} |
478 {{apply_grid_template('CSSPropertyGridTemplateRows', 'Row')}} | 478 {{apply_grid_template('CSSPropertyGridTemplateRows', 'Row')}} |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 paintType = SVG_PAINTTYPE_URI; | 516 paintType = SVG_PAINTTYPE_URI; |
517 url = toCSSURIValue(value)->value(); | 517 url = toCSSURIValue(value)->value(); |
518 } else { | 518 } else { |
519 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 519 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
520 if (primitiveValue->getValueID() == CSSValueNone) { | 520 if (primitiveValue->getValueID() == CSSValueNone) { |
521 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_N
ONE; | 521 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_N
ONE; |
522 } else if (primitiveValue->getValueID() == CSSValueCurrentcolor) { | 522 } else if (primitiveValue->getValueID() == CSSValueCurrentcolor) { |
523 color = state.style()->color(); | 523 color = state.style()->color(); |
524 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTY
PE_URI_CURRENTCOLOR; | 524 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTY
PE_URI_CURRENTCOLOR; |
525 } else { | 525 } else { |
526 color = StyleBuilderConverter::convertColor(state, primitiveValue); | 526 color = StyleBuilderConverter::convertColor(state, *primitiveValue); |
527 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_U
RI_RGBCOLOR; | 527 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_U
RI_RGBCOLOR; |
528 } | 528 } |
529 } | 529 } |
530 {{set_value(property)}}(paintType, color, url, | 530 {{set_value(property)}}(paintType, color, url, |
531 state.applyPropertyToRegularStyle(), | 531 state.applyPropertyToRegularStyle(), |
532 state.applyPropertyToVisitedLinkStyle()); | 532 state.applyPropertyToVisitedLinkStyle()); |
533 } | 533 } |
534 {% endmacro %} | 534 {% endmacro %} |
535 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 535 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
536 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 536 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
537 } // namespace blink | 537 } // namespace blink |
OLD | NEW |