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

Side by Side Diff: Source/core/svg/SVGFECompositeElement.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/SVGFECompositeElement.h ('k') | Source/core/svg/SVGFEConvolveMatrixElement.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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 12 matching lines...) Expand all
23 #include "core/svg/SVGFECompositeElement.h" 23 #include "core/svg/SVGFECompositeElement.h"
24 24
25 #include "SVGNames.h" 25 #include "SVGNames.h"
26 #include "platform/graphics/filters/FilterEffect.h" 26 #include "platform/graphics/filters/FilterEffect.h"
27 #include "core/svg/SVGElementInstance.h" 27 #include "core/svg/SVGElementInstance.h"
28 #include "core/svg/graphics/filters/SVGFilterBuilder.h" 28 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 // Animated property definitions 32 // Animated property definitions
33 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1)
34 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2)
35 DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, SVGOp erator, svgOperator, CompositeOperationType) 33 DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, SVGOp erator, svgOperator, CompositeOperationType)
36 34
37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement) 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement)
38 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
39 REGISTER_LOCAL_ANIMATED_PROPERTY(in2)
40 REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator) 36 REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator)
41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) 37 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
42 END_REGISTER_ANIMATED_PROPERTIES 38 END_REGISTER_ANIMATED_PROPERTIES
43 39
44 inline SVGFECompositeElement::SVGFECompositeElement(Document& document) 40 inline SVGFECompositeElement::SVGFECompositeElement(Document& document)
45 : SVGFilterPrimitiveStandardAttributes(SVGNames::feCompositeTag, document) 41 : SVGFilterPrimitiveStandardAttributes(SVGNames::feCompositeTag, document)
46 , m_k1(SVGAnimatedNumber::create(this, SVGNames::k1Attr, SVGNumber::create() )) 42 , m_k1(SVGAnimatedNumber::create(this, SVGNames::k1Attr, SVGNumber::create() ))
47 , m_k2(SVGAnimatedNumber::create(this, SVGNames::k2Attr, SVGNumber::create() )) 43 , m_k2(SVGAnimatedNumber::create(this, SVGNames::k2Attr, SVGNumber::create() ))
48 , m_k3(SVGAnimatedNumber::create(this, SVGNames::k3Attr, SVGNumber::create() )) 44 , m_k3(SVGAnimatedNumber::create(this, SVGNames::k3Attr, SVGNumber::create() ))
49 , m_k4(SVGAnimatedNumber::create(this, SVGNames::k4Attr, SVGNumber::create() )) 45 , m_k4(SVGAnimatedNumber::create(this, SVGNames::k4Attr, SVGNumber::create() ))
46 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create( )))
47 , m_in2(SVGAnimatedString::create(this, SVGNames::in2Attr, SVGString::create ()))
50 , m_svgOperator(FECOMPOSITE_OPERATOR_OVER) 48 , m_svgOperator(FECOMPOSITE_OPERATOR_OVER)
51 { 49 {
52 ScriptWrappable::init(this); 50 ScriptWrappable::init(this);
53 51
54 addToPropertyMap(m_k1); 52 addToPropertyMap(m_k1);
55 addToPropertyMap(m_k2); 53 addToPropertyMap(m_k2);
56 addToPropertyMap(m_k3); 54 addToPropertyMap(m_k3);
57 addToPropertyMap(m_k4); 55 addToPropertyMap(m_k4);
56 addToPropertyMap(m_in1);
57 addToPropertyMap(m_in2);
58 registerAnimatedPropertiesForSVGFECompositeElement(); 58 registerAnimatedPropertiesForSVGFECompositeElement();
59 } 59 }
60 60
61 PassRefPtr<SVGFECompositeElement> SVGFECompositeElement::create(Document& docume nt) 61 PassRefPtr<SVGFECompositeElement> SVGFECompositeElement::create(Document& docume nt)
62 { 62 {
63 return adoptRef(new SVGFECompositeElement(document)); 63 return adoptRef(new SVGFECompositeElement(document));
64 } 64 }
65 65
66 bool SVGFECompositeElement::isSupportedAttribute(const QualifiedName& attrName) 66 bool SVGFECompositeElement::isSupportedAttribute(const QualifiedName& attrName)
67 { 67 {
(...skipping 17 matching lines...) Expand all
85 return; 85 return;
86 } 86 }
87 87
88 if (name == SVGNames::operatorAttr) { 88 if (name == SVGNames::operatorAttr) {
89 CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperat ionType>::fromString(value); 89 CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperat ionType>::fromString(value);
90 if (propertyValue > 0) 90 if (propertyValue > 0)
91 setSVGOperatorBaseValue(propertyValue); 91 setSVGOperatorBaseValue(propertyValue);
92 return; 92 return;
93 } 93 }
94 94
95 if (name == SVGNames::inAttr) {
96 setIn1BaseValue(value);
97 return;
98 }
99
100 if (name == SVGNames::in2Attr) {
101 setIn2BaseValue(value);
102 return;
103 }
104
105 SVGParsingError parseError = NoError; 95 SVGParsingError parseError = NoError;
106 96
107 if (name == SVGNames::k1Attr) 97 if (name == SVGNames::inAttr)
98 m_in1->setBaseValueAsString(value, parseError);
99 else if (name == SVGNames::in2Attr)
100 m_in2->setBaseValueAsString(value, parseError);
101 else if (name == SVGNames::k1Attr)
108 m_k1->setBaseValueAsString(value, parseError); 102 m_k1->setBaseValueAsString(value, parseError);
109 else if (name == SVGNames::k2Attr) 103 else if (name == SVGNames::k2Attr)
110 m_k2->setBaseValueAsString(value, parseError); 104 m_k2->setBaseValueAsString(value, parseError);
111 else if (name == SVGNames::k3Attr) 105 else if (name == SVGNames::k3Attr)
112 m_k3->setBaseValueAsString(value, parseError); 106 m_k3->setBaseValueAsString(value, parseError);
113 else if (name == SVGNames::k4Attr) 107 else if (name == SVGNames::k4Attr)
114 m_k4->setBaseValueAsString(value, parseError); 108 m_k4->setBaseValueAsString(value, parseError);
115 else 109 else
116 ASSERT_NOT_REACHED(); 110 ASSERT_NOT_REACHED();
117 111
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { 152 if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) {
159 invalidate(); 153 invalidate();
160 return; 154 return;
161 } 155 }
162 156
163 ASSERT_NOT_REACHED(); 157 ASSERT_NOT_REACHED();
164 } 158 }
165 159
166 PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBu ilder, Filter* filter) 160 PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBu ilder, Filter* filter)
167 { 161 {
168 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(in1CurrentV alue())); 162 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value()));
169 FilterEffect* input2 = filterBuilder->getEffectById(AtomicString(in2CurrentV alue())); 163 FilterEffect* input2 = filterBuilder->getEffectById(AtomicString(m_in2->curr entValue()->value()));
170 164
171 if (!input1 || !input2) 165 if (!input1 || !input2)
172 return 0; 166 return 0;
173 167
174 RefPtr<FilterEffect> effect = FEComposite::create(filter, svgOperatorCurrent Value(), m_k1->currentValue()->value(), m_k2->currentValue()->value(), m_k3->cur rentValue()->value(), m_k4->currentValue()->value()); 168 RefPtr<FilterEffect> effect = FEComposite::create(filter, svgOperatorCurrent Value(), m_k1->currentValue()->value(), m_k2->currentValue()->value(), m_k3->cur rentValue()->value(), m_k4->currentValue()->value());
175 FilterEffectVector& inputEffects = effect->inputEffects(); 169 FilterEffectVector& inputEffects = effect->inputEffects();
176 inputEffects.reserveCapacity(2); 170 inputEffects.reserveCapacity(2);
177 inputEffects.append(input1); 171 inputEffects.append(input1);
178 inputEffects.append(input2); 172 inputEffects.append(input2);
179 return effect.release(); 173 return effect.release();
180 } 174 }
181 175
182 } 176 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFECompositeElement.h ('k') | Source/core/svg/SVGFEConvolveMatrixElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698