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

Side by Side Diff: Source/core/svg/SVGFEDropShadowElement.cpp

Issue 148173018: [SVG] SVGAnimatedString{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove debug print Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGFEDropShadowElement.h ('k') | Source/core/svg/SVGFEGaussianBlurElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 13 matching lines...) Expand all
24 #include "SVGNames.h" 24 #include "SVGNames.h"
25 #include "core/rendering/style/RenderStyle.h" 25 #include "core/rendering/style/RenderStyle.h"
26 #include "core/rendering/style/SVGRenderStyle.h" 26 #include "core/rendering/style/SVGRenderStyle.h"
27 #include "core/svg/SVGElementInstance.h" 27 #include "core/svg/SVGElementInstance.h"
28 #include "core/svg/SVGParserUtilities.h" 28 #include "core/svg/SVGParserUtilities.h"
29 #include "core/svg/graphics/filters/SVGFilterBuilder.h" 29 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
30 30
31 namespace WebCore { 31 namespace WebCore {
32 32
33 // Animated property definitions 33 // Animated property definitions
34 DEFINE_ANIMATED_STRING(SVGFEDropShadowElement, SVGNames::inAttr, In1, in1)
35 34
36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDropShadowElement) 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDropShadowElement)
37 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) 36 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
39 END_REGISTER_ANIMATED_PROPERTIES 37 END_REGISTER_ANIMATED_PROPERTIES
40 38
41 inline SVGFEDropShadowElement::SVGFEDropShadowElement(Document& document) 39 inline SVGFEDropShadowElement::SVGFEDropShadowElement(Document& document)
42 : SVGFilterPrimitiveStandardAttributes(SVGNames::feDropShadowTag, document) 40 : SVGFilterPrimitiveStandardAttributes(SVGNames::feDropShadowTag, document)
43 , m_dx(SVGAnimatedNumber::create(this, SVGNames::dxAttr, SVGNumber::create(2 ))) 41 , m_dx(SVGAnimatedNumber::create(this, SVGNames::dxAttr, SVGNumber::create(2 )))
44 , m_dy(SVGAnimatedNumber::create(this, SVGNames::dyAttr, SVGNumber::create(2 ))) 42 , m_dy(SVGAnimatedNumber::create(this, SVGNames::dyAttr, SVGNumber::create(2 )))
45 , m_stdDeviation(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::std DeviationAttr, 2, 2)) 43 , m_stdDeviation(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::std DeviationAttr, 2, 2))
44 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create( )))
46 { 45 {
47 ScriptWrappable::init(this); 46 ScriptWrappable::init(this);
48 47
49 addToPropertyMap(m_dx); 48 addToPropertyMap(m_dx);
50 addToPropertyMap(m_dy); 49 addToPropertyMap(m_dy);
51 addToPropertyMap(m_stdDeviation); 50 addToPropertyMap(m_stdDeviation);
51 addToPropertyMap(m_in1);
52 registerAnimatedPropertiesForSVGFEDropShadowElement(); 52 registerAnimatedPropertiesForSVGFEDropShadowElement();
53 } 53 }
54 54
55 PassRefPtr<SVGFEDropShadowElement> SVGFEDropShadowElement::create(Document& docu ment) 55 PassRefPtr<SVGFEDropShadowElement> SVGFEDropShadowElement::create(Document& docu ment)
56 { 56 {
57 return adoptRef(new SVGFEDropShadowElement(document)); 57 return adoptRef(new SVGFEDropShadowElement(document));
58 } 58 }
59 59
60 void SVGFEDropShadowElement::setStdDeviation(float x, float y) 60 void SVGFEDropShadowElement::setStdDeviation(float x, float y)
61 { 61 {
(...skipping 14 matching lines...) Expand all
76 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 76 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
77 } 77 }
78 78
79 void SVGFEDropShadowElement::parseAttribute(const QualifiedName& name, const Ato micString& value) 79 void SVGFEDropShadowElement::parseAttribute(const QualifiedName& name, const Ato micString& value)
80 { 80 {
81 if (!isSupportedAttribute(name)) { 81 if (!isSupportedAttribute(name)) {
82 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); 82 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value);
83 return; 83 return;
84 } 84 }
85 85
86 if (name == SVGNames::inAttr) {
87 setIn1BaseValue(value);
88 return;
89 }
90
91 SVGParsingError parseError = NoError; 86 SVGParsingError parseError = NoError;
92 87
93 if (name == SVGNames::dxAttr) 88 if (name == SVGNames::inAttr)
89 m_in1->setBaseValueAsString(value, parseError);
90 else if (name == SVGNames::dxAttr)
94 m_dx->setBaseValueAsString(value, parseError); 91 m_dx->setBaseValueAsString(value, parseError);
95 else if (name == SVGNames::dyAttr) 92 else if (name == SVGNames::dyAttr)
96 m_dy->setBaseValueAsString(value, parseError); 93 m_dy->setBaseValueAsString(value, parseError);
97 else if (name == SVGNames::stdDeviationAttr) 94 else if (name == SVGNames::stdDeviationAttr)
98 m_stdDeviation->setBaseValueAsString(value, parseError); 95 m_stdDeviation->setBaseValueAsString(value, parseError);
99 else 96 else
100 ASSERT_NOT_REACHED(); 97 ASSERT_NOT_REACHED();
101 98
102 reportAttributeParsingError(parseError, name, value); 99 reportAttributeParsingError(parseError, name, value);
103 } 100 }
(...skipping 26 matching lines...) Expand all
130 127
131 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current Value()->value() < 0) 128 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current Value()->value() < 0)
132 return 0; 129 return 0;
133 130
134 ASSERT(renderer->style()); 131 ASSERT(renderer->style());
135 const SVGRenderStyle* svgStyle = renderer->style()->svgStyle(); 132 const SVGRenderStyle* svgStyle = renderer->style()->svgStyle();
136 133
137 Color color = svgStyle->floodColor(); 134 Color color = svgStyle->floodColor();
138 float opacity = svgStyle->floodOpacity(); 135 float opacity = svgStyle->floodOpacity();
139 136
140 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(in1CurrentV alue())); 137 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value()));
141 if (!input1) 138 if (!input1)
142 return 0; 139 return 0;
143 140
144 RefPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDeviationX()-> currentValue()->value(), stdDeviationY()->currentValue()->value(), m_dx->current Value()->value(), m_dy->currentValue()->value(), color, opacity); 141 RefPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDeviationX()-> currentValue()->value(), stdDeviationY()->currentValue()->value(), m_dx->current Value()->value(), m_dy->currentValue()->value(), color, opacity);
145 effect->inputEffects().append(input1); 142 effect->inputEffects().append(input1);
146 return effect.release(); 143 return effect.release();
147 } 144 }
148 145
149 } 146 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFEDropShadowElement.h ('k') | Source/core/svg/SVGFEGaussianBlurElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698