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

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: Give SVGPaintType a new home 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 {{set_value(property)}}( 589 {{set_value(property)}}(
590 svgParentStyle->{{paint_type|lower_first}}Type(), 590 svgParentStyle->{{paint_type|lower_first}}Type(),
591 svgParentStyle->{{paint_type|lower_first}}Color(), 591 svgParentStyle->{{paint_type|lower_first}}Color(),
592 svgParentStyle->{{paint_type|lower_first}}Uri(), 592 svgParentStyle->{{paint_type|lower_first}}Uri(),
593 state.applyPropertyToRegularStyle(), 593 state.applyPropertyToRegularStyle(),
594 state.applyPropertyToVisitedLinkStyle()); 594 state.applyPropertyToVisitedLinkStyle());
595 } 595 }
596 596
597 {{declare_value_function(property_id)}} 597 {{declare_value_function(property_id)}}
598 { 598 {
599 if (value->isSVGPaint()) { 599 String url;
600 SVGPaint* svgPaint = toSVGPaint(value); 600 if (value->isValueList()) {
601 CSSValueList* list = toCSSValueList(value);
602 if (list->length() < 2)
krit 2014/07/01 06:01:55 Could you add an assert list->length() > 2? It isn
603 return;
601 604
602 Color color; 605 if (!list->item(0)->isPrimitiveValue())
603 if (svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR 606 return;
604 || svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTC OLOR)
605 color = state.style()->color();
606 else
607 color = svgPaint->color();
608 607
609 {{set_value(property)}}(svgPaint->paintType(), 608 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(list->item(0));
610 color, 609 if (!pValue->isURI())
611 svgPaint->uri(), 610 return;
611
612 url = pValue->getStringValue();
613 value = list->item(1);
614 }
615 if (value->isPrimitiveValue()) {
616 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(value);
617 Color c;
618 SVGPaintType ptype = SVG_PAINTTYPE_RGBCOLOR;
619 if (pValue->isRGBColor()) {
620 c = pValue->getRGBA32Value();
621 ptype = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R GBCOLOR;
622 } else if (pValue->getValueID() == CSSValueCurrentcolor) {
623 c = state.style()->color();
624 ptype = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_U RI_CURRENTCOLOR;
625 } else if (pValue->getValueID() == CSSValueNone)
626 ptype = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
627 else if (pValue->isURI()) {
628 ptype = SVG_PAINTTYPE_URI;
629 url = pValue->getStringValue();
630 }
krit 2014/07/01 06:01:55 Don't you want to add an else with a return?
631 {{set_value(property)}}(ptype, c, url,
612 state.applyPropertyToRegularStyle(), 632 state.applyPropertyToRegularStyle(),
613 state.applyPropertyToVisitedLinkStyle()); 633 state.applyPropertyToVisitedLinkStyle());
614 } 634 }
615 } 635 }
616 {% endmacro %} 636 {% endmacro %}
617 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 637 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
618 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 638 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
619 } // namespace WebCore 639 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698