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

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: 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 {{declare_inherit_function(property_id)}}
Timothy Loh 2014/07/02 01:20:02 Looks like the other macros in this file put space
jfernandez 2014/07/02 10:10:19 Done.
564 {
565 state.style()->set{{alignment_type}}(state.parentStyle()->{{property.getter} }());
566 state.style()->set{{alignment_type}}OverflowAlignment(state.parentStyle()->{ {property.getter}}OverflowAlignment());
567 }
557 {{declare_value_function(property_id)}} 568 {{declare_value_function(property_id)}}
558 { 569 {
559 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 570 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
560 if (Pair* pairValue = primitiveValue->getPairValue()) { 571 if (Pair* pairValue = primitiveValue->getPairValue()) {
561 state.style()->set{{alignment_type}}(*pairValue->first()); 572 state.style()->set{{alignment_type}}(*pairValue->first());
562 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ()); 573 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ());
563 } else { 574 } else {
564 state.style()->set{{alignment_type}}(*primitiveValue); 575 state.style()->set{{alignment_type}}(*primitiveValue);
565 } 576 }
566 } 577 }
567 {% endmacro %} 578 {% endmacro %}
568 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}} 579 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}}
569 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} 580 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}}
570 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} 581 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}}
571 582
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) %} 583 {% macro apply_svg_paint(property_id, paint_type) %}
592 {% set property = properties[property_id] %} 584 {% set property = properties[property_id] %}
593 {{declare_initial_function(property_id)}} 585 {{declare_initial_function(property_id)}}
594 { 586 {
595 {{set_value(property)}}( 587 {{set_value(property)}}(
596 SVGRenderStyle::initial{{paint_type}}Type(), 588 SVGRenderStyle::initial{{paint_type}}Type(),
597 SVGRenderStyle::initial{{paint_type}}Color(), 589 SVGRenderStyle::initial{{paint_type}}Color(),
598 SVGRenderStyle::initial{{paint_type}}Uri(), 590 SVGRenderStyle::initial{{paint_type}}Uri(),
599 state.applyPropertyToRegularStyle(), 591 state.applyPropertyToRegularStyle(),
600 state.applyPropertyToVisitedLinkStyle()); 592 state.applyPropertyToVisitedLinkStyle());
(...skipping 26 matching lines...) Expand all
627 color, 619 color,
628 svgPaint->uri(), 620 svgPaint->uri(),
629 state.applyPropertyToRegularStyle(), 621 state.applyPropertyToRegularStyle(),
630 state.applyPropertyToVisitedLinkStyle()); 622 state.applyPropertyToVisitedLinkStyle());
631 } 623 }
632 } 624 }
633 {% endmacro %} 625 {% endmacro %}
634 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 626 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
635 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 627 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
636 } // namespace WebCore 628 } // 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