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

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: 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 507
508 {% macro apply_alignment(property_id, alignment_type) %} 508 {% macro apply_alignment(property_id, alignment_type) %}
509 {{declare_value_function(property_id)}} 509 {{declare_value_function(property_id)}}
510 { 510 {
511 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 511 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
512 if (Pair* pairValue = primitiveValue->getPairValue()) { 512 if (Pair* pairValue = primitiveValue->getPairValue()) {
513 state.style()->set{{alignment_type}}(*pairValue->first()); 513 state.style()->set{{alignment_type}}(*pairValue->first());
514 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ()); 514 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ());
515 } else { 515 } else {
516 state.style()->set{{alignment_type}}(*primitiveValue); 516 state.style()->set{{alignment_type}}(*primitiveValue);
517 // FIXME: We should clear the overflow-alignment mode here and probably
518 // also set it in the initial and inherit handlers
519 } 517 }
520 } 518 }
521 {% endmacro %} 519 {% endmacro %}
522 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}} 520 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}}
523 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} 521 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}}
524 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} 522 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}}
525 523
524 {% macro apply_alignment_with_legacy_keyword(property_id, alignment_type) %}
525 {{declare_value_function(property_id)}}
526 {
527 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
528 if (Pair* pairValue = primitiveValue->getPairValue()) {
529 if (pairValue->first()->getValueID() == CSSValueLegacy) {
530 state.style()->set{{alignment_type}}IsLegacy(LegacyPositionTrue);
531 state.style()->set{{alignment_type}}(*pairValue->second());
532 } else {
533 state.style()->set{{alignment_type}}(*pairValue->first());
534 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->se cond());
535 }
536 } else {
537 state.style()->set{{alignment_type}}(*primitiveValue);
538 }
539 }
540 {% endmacro %}
541 {{apply_alignment_with_legacy_keyword('CSSPropertyJustifyItems', 'JustifyItems') }}
542
526 {% macro apply_svg_paint(property_id, paint_type) %} 543 {% macro apply_svg_paint(property_id, paint_type) %}
527 {% set property = properties[property_id] %} 544 {% set property = properties[property_id] %}
528 {{declare_initial_function(property_id)}} 545 {{declare_initial_function(property_id)}}
529 { 546 {
530 {{set_value(property)}}( 547 {{set_value(property)}}(
531 SVGRenderStyle::initial{{paint_type}}Type(), 548 SVGRenderStyle::initial{{paint_type}}Type(),
532 SVGRenderStyle::initial{{paint_type}}Color(), 549 SVGRenderStyle::initial{{paint_type}}Color(),
533 SVGRenderStyle::initial{{paint_type}}Uri(), 550 SVGRenderStyle::initial{{paint_type}}Uri(),
534 state.applyPropertyToRegularStyle(), 551 state.applyPropertyToRegularStyle(),
535 state.applyPropertyToVisitedLinkStyle()); 552 state.applyPropertyToVisitedLinkStyle());
(...skipping 26 matching lines...) Expand all
562 color, 579 color,
563 svgPaint->uri(), 580 svgPaint->uri(),
564 state.applyPropertyToRegularStyle(), 581 state.applyPropertyToRegularStyle(),
565 state.applyPropertyToVisitedLinkStyle()); 582 state.applyPropertyToVisitedLinkStyle());
566 } 583 }
567 } 584 }
568 {% endmacro %} 585 {% endmacro %}
569 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 586 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
570 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 587 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
571 } // namespace WebCore 588 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698