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

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

Issue 361543002: Remove SVGPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 {{set_value(property)}}( 600 {{set_value(property)}}(
601 svgParentStyle->{{paint_type|lower_first}}Type(), 601 svgParentStyle->{{paint_type|lower_first}}Type(),
602 svgParentStyle->{{paint_type|lower_first}}Color(), 602 svgParentStyle->{{paint_type|lower_first}}Color(),
603 svgParentStyle->{{paint_type|lower_first}}Uri(), 603 svgParentStyle->{{paint_type|lower_first}}Uri(),
604 state.applyPropertyToRegularStyle(), 604 state.applyPropertyToRegularStyle(),
605 state.applyPropertyToVisitedLinkStyle()); 605 state.applyPropertyToVisitedLinkStyle());
606 } 606 }
607 607
608 {{declare_value_function(property_id)}} 608 {{declare_value_function(property_id)}}
609 { 609 {
610 if (value->isSVGPaint()) { 610 String url;
611 SVGPaint* svgPaint = toSVGPaint(value); 611 if (value->isValueList()) {
612 CSSValueList* list = toCSSValueList(value);
613 ASSERT(list->length() > 1);
612 614
613 Color color; 615 if (!list->item(0)->isPrimitiveValue())
614 if (svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR 616 return;
615 || svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTC OLOR)
616 color = state.style()->color();
617 else
618 color = svgPaint->color();
619 617
620 {{set_value(property)}}(svgPaint->paintType(), 618 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(list->item(0));
621 color, 619 if (!pValue->isURI())
622 svgPaint->uri(), 620 return;
621
622 url = pValue->getStringValue();
623 value = list->item(1);
624 }
625 if (value->isPrimitiveValue()) {
626 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(value);
627 Color c;
628 SVGPaintType ptype = SVG_PAINTTYPE_RGBCOLOR;
629 if (pValue->isRGBColor()) {
630 c = pValue->getRGBA32Value();
631 ptype = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R GBCOLOR;
632 } else if (pValue->getValueID() == CSSValueCurrentcolor) {
633 c = state.style()->color();
634 ptype = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_U RI_CURRENTCOLOR;
635 } else if (pValue->getValueID() == CSSValueNone) {
636 ptype = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
637 } else if (pValue->isURI()) {
638 ptype = SVG_PAINTTYPE_URI;
639 url = pValue->getStringValue();
640 } else {
641 return;
642 }
643 {{set_value(property)}}(ptype, c, url,
623 state.applyPropertyToRegularStyle(), 644 state.applyPropertyToRegularStyle(),
624 state.applyPropertyToVisitedLinkStyle()); 645 state.applyPropertyToVisitedLinkStyle());
625 } 646 }
626 } 647 }
627 {% endmacro %} 648 {% endmacro %}
628 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 649 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
629 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 650 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
630 } // namespace WebCore 651 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/svg/css/svg-attribute-parser-mode-expected.txt ('k') | Source/core/animation/animatable/AnimatableSVGPaint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698