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

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

Issue 244693003: [CSS Shapes] Add parsing support for gradients (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Increase threshold Created 6 years, 8 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 {{apply_value_number('CSSPropertyInternalMarqueeRepetition', 'CSSValueInfinite') }} 471 {{apply_value_number('CSSPropertyInternalMarqueeRepetition', 'CSSValueInfinite') }}
472 472
473 {% macro apply_value_shape(property_id) %} 473 {% macro apply_value_shape(property_id) %}
474 {{declare_value_function(property_id)}} 474 {{declare_value_function(property_id)}}
475 { 475 {
476 {% set property = properties[property_id] %} 476 {% set property = properties[property_id] %}
477 if (value->isPrimitiveValue()) { 477 if (value->isPrimitiveValue()) {
478 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 478 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
479 if (primitiveValue->getValueID() == CSSValueAuto) 479 if (primitiveValue->getValueID() == CSSValueAuto)
480 {{set_value(property)}}(nullptr); 480 {{set_value(property)}}(nullptr);
481 } else if (value->isImageValue() || value->isImageSetValue()) { 481 } else if (value->isImageValue() || value->isImageGeneratorValue() || value- >isImageSetValue()) {
482 {{set_value(property)}}(ShapeValue::createImageValue(state.styleImage({{ property_id}}, value))); 482 {{set_value(property)}}(ShapeValue::createImageValue(state.styleImage({{ property_id}}, value)));
483 } else if (value->isValueList()) { 483 } else if (value->isValueList()) {
484 RefPtr<BasicShape> shape; 484 RefPtr<BasicShape> shape;
485 CSSBoxType cssBox = BoxMissing; 485 CSSBoxType cssBox = BoxMissing;
486 CSSValueList* valueList = toCSSValueList(value); 486 CSSValueList* valueList = toCSSValueList(value);
487 for (unsigned i = 0; i < valueList->length(); ++i) { 487 for (unsigned i = 0; i < valueList->length(); ++i) {
488 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->i temWithoutBoundsCheck(i)); 488 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->i temWithoutBoundsCheck(i));
489 if (primitiveValue->isShape()) 489 if (primitiveValue->isShape())
490 shape = basicShapeForValue(state, primitiveValue->getShapeValue( )); 490 shape = basicShapeForValue(state, primitiveValue->getShapeValue( ));
491 else if (primitiveValue->getValueID() == CSSValueContentBox 491 else if (primitiveValue->getValueID() == CSSValueContentBox
492 || primitiveValue->getValueID() == CSSValueBorderBox 492 || primitiveValue->getValueID() == CSSValueBorderBox
493 || primitiveValue->getValueID() == CSSValuePaddingBox 493 || primitiveValue->getValueID() == CSSValuePaddingBox
494 || primitiveValue->getValueID() == CSSValueMarginBox) 494 || primitiveValue->getValueID() == CSSValueMarginBox)
495 cssBox = CSSBoxType(*primitiveValue); 495 cssBox = CSSBoxType(*primitiveValue);
496 else 496 else
497 return; 497 return;
498 } 498 }
499 499
500 if (shape) 500 if (shape)
501 {{set_value(property)}}(ShapeValue::createShapeValue(shape.release() , cssBox)); 501 {{set_value(property)}}(ShapeValue::createShapeValue(shape.release() , cssBox));
502 else if (cssBox != BoxMissing) 502 else if (cssBox != BoxMissing)
503 {{set_value(property)}}(ShapeValue::createBoxShapeValue(cssBox)); 503 {{set_value(property)}}(ShapeValue::createBoxShapeValue(cssBox));
504 } 504 }
505 } 505 }
506 {% endmacro %} 506 {% endmacro %}
507 {{apply_value_shape('CSSPropertyShapeOutside')}} 507 {{apply_value_shape('CSSPropertyShapeOutside')}}
508 } // namespace WebCore 508 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698