| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 if (!namedGridAreas.isEmpty()) | 491 if (!namedGridAreas.isEmpty()) |
| 492 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(namedGri
dAreas, namedGridLines, For{{type}}s); | 492 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(namedGri
dAreas, namedGridLines, For{{type}}s); |
| 493 state.style()->setGridTemplate{{type}}s(trackSizes); | 493 state.style()->setGridTemplate{{type}}s(trackSizes); |
| 494 state.style()->setNamedGrid{{type}}Lines(namedGridLines); | 494 state.style()->setNamedGrid{{type}}Lines(namedGridLines); |
| 495 state.style()->setOrderedNamedGrid{{type}}Lines(orderedNamedGridLines); | 495 state.style()->setOrderedNamedGrid{{type}}Lines(orderedNamedGridLines); |
| 496 } | 496 } |
| 497 {% endmacro %} | 497 {% endmacro %} |
| 498 {{apply_grid_template('CSSPropertyGridTemplateColumns', 'Column')}} | 498 {{apply_grid_template('CSSPropertyGridTemplateColumns', 'Column')}} |
| 499 {{apply_grid_template('CSSPropertyGridTemplateRows', 'Row')}} | 499 {{apply_grid_template('CSSPropertyGridTemplateRows', 'Row')}} |
| 500 | 500 |
| 501 {% macro apply_alignment(property_id, alignment_type) %} | |
| 502 {% set property = properties[property_id] %} | |
| 503 {{declare_initial_function(property_id)}} | |
| 504 { | |
| 505 state.style()->set{{alignment_type}}(ComputedStyle::initial{{alignment_type}
}()); | |
| 506 state.style()->set{{alignment_type}}OverflowAlignment(ComputedStyle::initial
{{alignment_type}}OverflowAlignment()); | |
| 507 } | |
| 508 | |
| 509 {{declare_inherit_function(property_id)}} | |
| 510 { | |
| 511 state.style()->set{{alignment_type}}(state.parentStyle()->{{property.getter}
}()); | |
| 512 state.style()->set{{alignment_type}}OverflowAlignment(state.parentStyle()->{
{property.getter}}OverflowAlignment()); | |
| 513 } | |
| 514 | |
| 515 {{declare_value_function(property_id)}} | |
| 516 { | |
| 517 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | |
| 518 if (Pair* pairValue = primitiveValue->getPairValue()) { | |
| 519 state.style()->set{{alignment_type}}(*pairValue->first()); | |
| 520 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second
()); | |
| 521 } else { | |
| 522 state.style()->set{{alignment_type}}(*primitiveValue); | |
| 523 state.style()->set{{alignment_type}}OverflowAlignment(ComputedStyle::ini
tial{{alignment_type}}OverflowAlignment()); | |
| 524 } | |
| 525 } | |
| 526 {% endmacro %} | |
| 527 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}} | |
| 528 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} | |
| 529 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} | |
| 530 | |
| 531 {% macro apply_content_alignment(property_id, alignment_type) %} | |
| 532 {% set property = properties[property_id] %} | |
| 533 {{declare_initial_function(property_id)}} | |
| 534 { | |
| 535 state.style()->set{{alignment_type}}(ComputedStyle::initial{{alignment_type}
}()); | |
| 536 state.style()->set{{alignment_type}}OverflowAlignment(ComputedStyle::initial
{{alignment_type}}OverflowAlignment()); | |
| 537 state.style()->set{{alignment_type}}Distribution(ComputedStyle::initial{{ali
gnment_type}}Distribution()); | |
| 538 } | |
| 539 | |
| 540 {{declare_inherit_function(property_id)}} | |
| 541 { | |
| 542 state.style()->set{{alignment_type}}(state.parentStyle()->{{property.getter}
}()); | |
| 543 state.style()->set{{alignment_type}}OverflowAlignment(state.parentStyle()->{
{property.getter}}OverflowAlignment()); | |
| 544 state.style()->set{{alignment_type}}Distribution(state.parentStyle()->{{prop
erty.getter}}Distribution()); | |
| 545 } | |
| 546 | |
| 547 {{declare_value_function(property_id)}} | |
| 548 { | |
| 549 state.style()->set{{alignment_type}}(ComputedStyle::initial{{alignment_type}
}()); | |
| 550 state.style()->set{{alignment_type}}OverflowAlignment(ComputedStyle::initial
{{alignment_type}}OverflowAlignment()); | |
| 551 state.style()->set{{alignment_type}}Distribution(ComputedStyle::initial{{ali
gnment_type}}Distribution()); | |
| 552 | |
| 553 CSSContentDistributionValue* contentValue = toCSSContentDistributionValue(va
lue); | |
| 554 if (contentValue->distribution()->getValueID() != CSSValueInvalid) | |
| 555 state.style()->set{{alignment_type}}Distribution(*contentValue->distribu
tion()); | |
| 556 if (contentValue->position()->getValueID() != CSSValueInvalid) | |
| 557 state.style()->set{{alignment_type}}(*contentValue->position()); | |
| 558 if (contentValue->overflow()->getValueID() != CSSValueInvalid) | |
| 559 state.style()->set{{alignment_type}}OverflowAlignment(*contentValue->ove
rflow()); | |
| 560 } | |
| 561 {% endmacro %} | |
| 562 {{apply_content_alignment('CSSPropertyJustifyContent', 'JustifyContent')}} | |
| 563 {{apply_content_alignment('CSSPropertyAlignContent', 'AlignContent')}} | |
| 564 | |
| 565 {% macro apply_svg_paint(property_id, paint_type) %} | 501 {% macro apply_svg_paint(property_id, paint_type) %} |
| 566 {% set property = properties[property_id] %} | 502 {% set property = properties[property_id] %} |
| 567 {{declare_initial_function(property_id)}} | 503 {{declare_initial_function(property_id)}} |
| 568 { | 504 { |
| 569 {{set_value(property)}}( | 505 {{set_value(property)}}( |
| 570 SVGComputedStyle::initial{{paint_type}}Type(), | 506 SVGComputedStyle::initial{{paint_type}}Type(), |
| 571 SVGComputedStyle::initial{{paint_type}}Color(), | 507 SVGComputedStyle::initial{{paint_type}}Color(), |
| 572 SVGComputedStyle::initial{{paint_type}}Uri(), | 508 SVGComputedStyle::initial{{paint_type}}Uri(), |
| 573 state.applyPropertyToRegularStyle(), | 509 state.applyPropertyToRegularStyle(), |
| 574 state.applyPropertyToVisitedLinkStyle()); | 510 state.applyPropertyToVisitedLinkStyle()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 } | 558 } |
| 623 {{set_value(property)}}(ptype, c, url, | 559 {{set_value(property)}}(ptype, c, url, |
| 624 state.applyPropertyToRegularStyle(), | 560 state.applyPropertyToRegularStyle(), |
| 625 state.applyPropertyToVisitedLinkStyle()); | 561 state.applyPropertyToVisitedLinkStyle()); |
| 626 } | 562 } |
| 627 } | 563 } |
| 628 {% endmacro %} | 564 {% endmacro %} |
| 629 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 565 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
| 630 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 566 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
| 631 } // namespace blink | 567 } // namespace blink |
| OLD | NEW |