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

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

Issue 333423005: [CSS Grid Layout] Implement 'justify-items' parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch rebased. 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 555
556 {% macro apply_alignment(property_id, alignment_type) %} 556 {% macro apply_alignment(property_id, alignment_type) %}
557 {{declare_value_function(property_id)}} 557 {{declare_value_function(property_id)}}
558 { 558 {
559 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 559 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
560 if (Pair* pairValue = primitiveValue->getPairValue()) { 560 if (Pair* pairValue = primitiveValue->getPairValue()) {
561 state.style()->set{{alignment_type}}(*pairValue->first()); 561 state.style()->set{{alignment_type}}(*pairValue->first());
562 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ()); 562 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ());
563 } else { 563 } else {
564 state.style()->set{{alignment_type}}(*primitiveValue); 564 state.style()->set{{alignment_type}}(*primitiveValue);
565 // FIXME: We should clear the overflow-alignment mode here and probably
Timothy Loh 2014/07/01 12:44:51 I'm not sure why you've removed this FIXME, isn't
jfernandez 2014/07/01 20:54:27 I added cases in the layout tests to verify it was
566 // also set it in the initial and inherit handlers
567 } 565 }
568 } 566 }
569 {% endmacro %} 567 {% endmacro %}
570 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}} 568 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}}
571 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} 569 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}}
572 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} 570 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}}
573 571
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') }}
Timothy Loh 2014/07/01 12:44:51 If you're only going to have a single property wit
jfernandez 2014/07/01 20:54:27 I thought that "align-items" would eventually be a
590
574 {% macro apply_svg_paint(property_id, paint_type) %} 591 {% macro apply_svg_paint(property_id, paint_type) %}
575 {% set property = properties[property_id] %} 592 {% set property = properties[property_id] %}
576 {{declare_initial_function(property_id)}} 593 {{declare_initial_function(property_id)}}
577 { 594 {
578 {{set_value(property)}}( 595 {{set_value(property)}}(
579 SVGRenderStyle::initial{{paint_type}}Type(), 596 SVGRenderStyle::initial{{paint_type}}Type(),
580 SVGRenderStyle::initial{{paint_type}}Color(), 597 SVGRenderStyle::initial{{paint_type}}Color(),
581 SVGRenderStyle::initial{{paint_type}}Uri(), 598 SVGRenderStyle::initial{{paint_type}}Uri(),
582 state.applyPropertyToRegularStyle(), 599 state.applyPropertyToRegularStyle(),
583 state.applyPropertyToVisitedLinkStyle()); 600 state.applyPropertyToVisitedLinkStyle());
(...skipping 26 matching lines...) Expand all
610 color, 627 color,
611 svgPaint->uri(), 628 svgPaint->uri(),
612 state.applyPropertyToRegularStyle(), 629 state.applyPropertyToRegularStyle(),
613 state.applyPropertyToVisitedLinkStyle()); 630 state.applyPropertyToVisitedLinkStyle());
614 } 631 }
615 } 632 }
616 {% endmacro %} 633 {% endmacro %}
617 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 634 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
618 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 635 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
619 } // namespace WebCore 636 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/webexposed/css-properties-as-js-properties-expected.txt ('k') | Source/core/css/CSSComputedStyleDeclaration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698