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

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

Issue 361113002: Properly managing overlfow-aligment for inherit and initial. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Applied suggested changes. Created 6 years, 5 months 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
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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 if (shape) 547 if (shape)
548 {{set_value(property)}}(ShapeValue::createShapeValue(shape.release() , cssBox)); 548 {{set_value(property)}}(ShapeValue::createShapeValue(shape.release() , cssBox));
549 else if (cssBox != BoxMissing) 549 else if (cssBox != BoxMissing)
550 {{set_value(property)}}(ShapeValue::createBoxShapeValue(cssBox)); 550 {{set_value(property)}}(ShapeValue::createBoxShapeValue(cssBox));
551 } 551 }
552 } 552 }
553 {% endmacro %} 553 {% endmacro %}
554 {{apply_value_shape('CSSPropertyShapeOutside')}} 554 {{apply_value_shape('CSSPropertyShapeOutside')}}
555 555
556 {% macro apply_alignment(property_id, alignment_type) %} 556 {% macro apply_alignment(property_id, alignment_type) %}
557 {% set property = properties[property_id] %}
558 {{declare_initial_function(property_id)}}
559 {
560 state.style()->set{{alignment_type}}(RenderStyle::initial{{alignment_type}}( ));
561 state.style()->set{{alignment_type}}OverflowAlignment(RenderStyle::initial{{ alignment_type}}OverflowAlignment());
562 }
563
564 {{declare_inherit_function(property_id)}}
565 {
566 state.style()->set{{alignment_type}}(state.parentStyle()->{{property.getter} }());
567 state.style()->set{{alignment_type}}OverflowAlignment(state.parentStyle()->{ {property.getter}}OverflowAlignment());
568 }
569
557 {{declare_value_function(property_id)}} 570 {{declare_value_function(property_id)}}
558 { 571 {
559 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 572 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
560 if (Pair* pairValue = primitiveValue->getPairValue()) { 573 if (Pair* pairValue = primitiveValue->getPairValue()) {
561 state.style()->set{{alignment_type}}(*pairValue->first()); 574 state.style()->set{{alignment_type}}(*pairValue->first());
562 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ()); 575 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ());
563 } else { 576 } else {
564 state.style()->set{{alignment_type}}(*primitiveValue); 577 state.style()->set{{alignment_type}}(*primitiveValue);
565 } 578 }
566 } 579 }
567 {% endmacro %} 580 {% endmacro %}
568 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}} 581 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}}
569 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} 582 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}}
570 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} 583 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}}
571 584
572 {% macro apply_alignment_with_legacy_keyword(property_id, alignment_type) %}
573 {{declare_value_function(property_id)}}
574 {
575 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
576 if (Pair* pairValue = primitiveValue->getPairValue()) {
577 if (pairValue->first()->getValueID() == CSSValueLegacy) {
578 state.style()->set{{alignment_type}}PositionType(LegacyPosition);
579 state.style()->set{{alignment_type}}(*pairValue->second());
580 } else {
581 state.style()->set{{alignment_type}}(*pairValue->first());
582 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->se cond());
583 }
584 } else {
585 state.style()->set{{alignment_type}}(*primitiveValue);
586 }
587 }
588 {% endmacro %}
589 {{apply_alignment_with_legacy_keyword('CSSPropertyJustifyItems', 'JustifyItems') }}
590
591 {% macro apply_svg_paint(property_id, paint_type) %} 585 {% macro apply_svg_paint(property_id, paint_type) %}
592 {% set property = properties[property_id] %} 586 {% set property = properties[property_id] %}
593 {{declare_initial_function(property_id)}} 587 {{declare_initial_function(property_id)}}
594 { 588 {
595 {{set_value(property)}}( 589 {{set_value(property)}}(
596 SVGRenderStyle::initial{{paint_type}}Type(), 590 SVGRenderStyle::initial{{paint_type}}Type(),
597 SVGRenderStyle::initial{{paint_type}}Color(), 591 SVGRenderStyle::initial{{paint_type}}Color(),
598 SVGRenderStyle::initial{{paint_type}}Uri(), 592 SVGRenderStyle::initial{{paint_type}}Uri(),
599 state.applyPropertyToRegularStyle(), 593 state.applyPropertyToRegularStyle(),
600 state.applyPropertyToVisitedLinkStyle()); 594 state.applyPropertyToVisitedLinkStyle());
(...skipping 26 matching lines...) Expand all
627 color, 621 color,
628 svgPaint->uri(), 622 svgPaint->uri(),
629 state.applyPropertyToRegularStyle(), 623 state.applyPropertyToRegularStyle(),
630 state.applyPropertyToVisitedLinkStyle()); 624 state.applyPropertyToVisitedLinkStyle());
631 } 625 }
632 } 626 }
633 {% endmacro %} 627 {% endmacro %}
634 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 628 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
635 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 629 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
636 } // namespace WebCore 630 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/alignment/resources/alignment-parsing-utils.js ('k') | Source/core/css/CSSProperties.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698