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

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

Issue 645073003: Move special code for 'shape-outside' out of StyleBuilderFunctions.cpp.tmpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove unreachable nullptr. Created 6 years, 2 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
« no previous file with comments | « no previous file | Source/core/css/CSSProperties.in » ('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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 502
503 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 503 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
504 if (primitiveValue->getValueID() == {{id_for_minus_one}}) 504 if (primitiveValue->getValueID() == {{id_for_minus_one}})
505 {{set_value(property)}}(-1); 505 {{set_value(property)}}(-1);
506 else 506 else
507 {{set_value(property)}}(primitiveValue->getValue<{{property.type_name}}> (CSSPrimitiveValue::CSS_NUMBER)); 507 {{set_value(property)}}(primitiveValue->getValue<{{property.type_name}}> (CSSPrimitiveValue::CSS_NUMBER));
508 } 508 }
509 {% endmacro %} 509 {% endmacro %}
510 {{apply_value_number('CSSPropertyInternalMarqueeRepetition', 'CSSValueInfinite') }} 510 {{apply_value_number('CSSPropertyInternalMarqueeRepetition', 'CSSValueInfinite') }}
511 511
512 {% macro apply_value_shape(property_id) %}
513 {{declare_value_function(property_id)}}
514 {
515 {% set property = properties[property_id] %}
516 if (value->isPrimitiveValue()) {
517 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
518 if (primitiveValue->getValueID() == CSSValueNone)
519 {{set_value(property)}}(nullptr);
520 } else if (value->isImageValue() || value->isImageGeneratorValue() || value- >isImageSetValue()) {
521 {{set_value(property)}}(ShapeValue::createImageValue(state.styleImage({{ property_id}}, value)));
522 } else if (value->isValueList()) {
523 RefPtr<BasicShape> shape;
524 CSSBoxType cssBox = BoxMissing;
525 CSSValueList* valueList = toCSSValueList(value);
526 for (unsigned i = 0; i < valueList->length(); ++i) {
527 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->i tem(i));
528 if (primitiveValue->isShape())
529 shape = basicShapeForValue(state, primitiveValue->getShapeValue( ));
530 else if (primitiveValue->getValueID() == CSSValueContentBox
531 || primitiveValue->getValueID() == CSSValueBorderBox
532 || primitiveValue->getValueID() == CSSValuePaddingBox
533 || primitiveValue->getValueID() == CSSValueMarginBox)
534 cssBox = CSSBoxType(*primitiveValue);
535 else
536 return;
537 }
538
539 if (shape)
540 {{set_value(property)}}(ShapeValue::createShapeValue(shape.release() , cssBox));
541 else if (cssBox != BoxMissing)
542 {{set_value(property)}}(ShapeValue::createBoxShapeValue(cssBox));
543 }
544 }
545 {% endmacro %}
546 {{apply_value_shape('CSSPropertyShapeOutside')}}
547
548 {% macro apply_alignment(property_id, alignment_type) %} 512 {% macro apply_alignment(property_id, alignment_type) %}
549 {% set property = properties[property_id] %} 513 {% set property = properties[property_id] %}
550 {{declare_initial_function(property_id)}} 514 {{declare_initial_function(property_id)}}
551 { 515 {
552 state.style()->set{{alignment_type}}(RenderStyle::initial{{alignment_type}}( )); 516 state.style()->set{{alignment_type}}(RenderStyle::initial{{alignment_type}}( ));
553 state.style()->set{{alignment_type}}OverflowAlignment(RenderStyle::initial{{ alignment_type}}OverflowAlignment()); 517 state.style()->set{{alignment_type}}OverflowAlignment(RenderStyle::initial{{ alignment_type}}OverflowAlignment());
554 } 518 }
555 519
556 {{declare_inherit_function(property_id)}} 520 {{declare_inherit_function(property_id)}}
557 { 521 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 } 598 }
635 {{set_value(property)}}(ptype, c, url, 599 {{set_value(property)}}(ptype, c, url,
636 state.applyPropertyToRegularStyle(), 600 state.applyPropertyToRegularStyle(),
637 state.applyPropertyToVisitedLinkStyle()); 601 state.applyPropertyToVisitedLinkStyle());
638 } 602 }
639 } 603 }
640 {% endmacro %} 604 {% endmacro %}
641 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 605 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
642 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 606 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
643 } // namespace blink 607 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSProperties.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698