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