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

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

Issue 689853003: Remove CSS Grid Layout and grid media queries. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | sky/engine/core/core.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 {{apply_fill_layer('CSSPropertyWebkitMaskClip', 'Clip')}} 430 {{apply_fill_layer('CSSPropertyWebkitMaskClip', 'Clip')}}
431 {{apply_fill_layer('CSSPropertyWebkitMaskComposite', 'Composite')}} 431 {{apply_fill_layer('CSSPropertyWebkitMaskComposite', 'Composite')}}
432 {{apply_fill_layer('CSSPropertyWebkitMaskImage', 'Image')}} 432 {{apply_fill_layer('CSSPropertyWebkitMaskImage', 'Image')}}
433 {{apply_fill_layer('CSSPropertyWebkitMaskOrigin', 'Origin')}} 433 {{apply_fill_layer('CSSPropertyWebkitMaskOrigin', 'Origin')}}
434 {{apply_fill_layer('CSSPropertyWebkitMaskPositionX', 'XPosition')}} 434 {{apply_fill_layer('CSSPropertyWebkitMaskPositionX', 'XPosition')}}
435 {{apply_fill_layer('CSSPropertyWebkitMaskPositionY', 'YPosition')}} 435 {{apply_fill_layer('CSSPropertyWebkitMaskPositionY', 'YPosition')}}
436 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatX', 'RepeatX')}} 436 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatX', 'RepeatX')}}
437 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatY', 'RepeatY')}} 437 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatY', 'RepeatY')}}
438 {{apply_fill_layer('CSSPropertyWebkitMaskSize', 'Size')}} 438 {{apply_fill_layer('CSSPropertyWebkitMaskSize', 'Size')}}
439 439
440 {% macro apply_grid_template(property_id, type) %}
441 {{declare_initial_function(property_id)}}
442 {
443 state.style()->setGridTemplate{{type}}s(RenderStyle::initialGridTemplate{{ty pe}}s());
444 state.style()->setNamedGrid{{type}}Lines(RenderStyle::initialNamedGrid{{type }}Lines());
445 state.style()->setOrderedNamedGrid{{type}}Lines(RenderStyle::initialOrderedN amedGrid{{type}}Lines());
446 }
447
448 {{declare_inherit_function(property_id)}}
449 {
450 state.style()->setGridTemplate{{type}}s(state.parentStyle()->gridTemplate{{t ype}}s());
451 state.style()->setNamedGrid{{type}}Lines(state.parentStyle()->namedGrid{{typ e}}Lines());
452 state.style()->setOrderedNamedGrid{{type}}Lines(state.parentStyle()->ordered NamedGrid{{type}}Lines());
453 }
454
455 {{declare_value_function(property_id)}}
456 {
457 Vector<GridTrackSize> trackSizes;
458 NamedGridLinesMap namedGridLines;
459 OrderedNamedGridLines orderedNamedGridLines;
460 if (!StyleBuilderConverter::convertGridTrackList(value, trackSizes, namedGri dLines, orderedNamedGridLines, state))
461 return;
462 const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea();
463 if (!namedGridAreas.isEmpty())
464 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(namedGri dAreas, namedGridLines, For{{type}}s);
465 state.style()->setGridTemplate{{type}}s(trackSizes);
466 state.style()->setNamedGrid{{type}}Lines(namedGridLines);
467 state.style()->setOrderedNamedGrid{{type}}Lines(orderedNamedGridLines);
468 }
469 {% endmacro %}
470 {{apply_grid_template('CSSPropertyGridTemplateColumns', 'Column')}}
471 {{apply_grid_template('CSSPropertyGridTemplateRows', 'Row')}}
472
473 {% macro apply_value_number(property_id, id_for_minus_one) %} 440 {% macro apply_value_number(property_id, id_for_minus_one) %}
474 {{declare_value_function(property_id)}} 441 {{declare_value_function(property_id)}}
475 { 442 {
476 {% set property = properties[property_id] %} 443 {% set property = properties[property_id] %}
477 if (!value->isPrimitiveValue()) 444 if (!value->isPrimitiveValue())
478 return; 445 return;
479 446
480 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 447 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
481 if (primitiveValue->getValueID() == {{id_for_minus_one}}) 448 if (primitiveValue->getValueID() == {{id_for_minus_one}})
482 {{set_value(property)}}(-1); 449 {{set_value(property)}}(-1);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 { 506 {
540 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 507 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
541 if (Pair* pairValue = primitiveValue->getPairValue()) { 508 if (Pair* pairValue = primitiveValue->getPairValue()) {
542 state.style()->set{{alignment_type}}(*pairValue->first()); 509 state.style()->set{{alignment_type}}(*pairValue->first());
543 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ()); 510 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second ());
544 } else { 511 } else {
545 state.style()->set{{alignment_type}}(*primitiveValue); 512 state.style()->set{{alignment_type}}(*primitiveValue);
546 } 513 }
547 } 514 }
548 {% endmacro %} 515 {% endmacro %}
549 {{apply_alignment('CSSPropertyJustifySelf', 'JustifySelf')}}
550 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} 516 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}}
551 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} 517 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}}
552 518
553 } // namespace blink 519 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/core.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698