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

Side by Side Diff: Source/core/svg/SVGFEBlendElement.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/SVGFEBlendElement.h ('k') | Source/core/svg/SVGFEColorMatrixElement.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/SVGFEBlendElement.h" 23 #include "core/svg/SVGFEBlendElement.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(SVGFEBlendElement, SVGNames::inAttr, In1, in1)
34 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::in2Attr, In2, in2)
35 DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode, B lendModeType) 33 DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode, B lendModeType)
36 34
37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEBlendElement) 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEBlendElement)
38 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
39 REGISTER_LOCAL_ANIMATED_PROPERTY(in2)
40 REGISTER_LOCAL_ANIMATED_PROPERTY(mode) 36 REGISTER_LOCAL_ANIMATED_PROPERTY(mode)
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 SVGFEBlendElement::SVGFEBlendElement(Document& document) 40 inline SVGFEBlendElement::SVGFEBlendElement(Document& document)
45 : SVGFilterPrimitiveStandardAttributes(SVGNames::feBlendTag, document) 41 : SVGFilterPrimitiveStandardAttributes(SVGNames::feBlendTag, document)
42 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create( )))
43 , m_in2(SVGAnimatedString::create(this, SVGNames::in2Attr, SVGString::create ()))
46 , m_mode(FEBLEND_MODE_NORMAL) 44 , m_mode(FEBLEND_MODE_NORMAL)
47 { 45 {
48 ScriptWrappable::init(this); 46 ScriptWrappable::init(this);
47 addToPropertyMap(m_in1);
48 addToPropertyMap(m_in2);
49 registerAnimatedPropertiesForSVGFEBlendElement(); 49 registerAnimatedPropertiesForSVGFEBlendElement();
50 } 50 }
51 51
52 PassRefPtr<SVGFEBlendElement> SVGFEBlendElement::create(Document& document) 52 PassRefPtr<SVGFEBlendElement> SVGFEBlendElement::create(Document& document)
53 { 53 {
54 return adoptRef(new SVGFEBlendElement(document)); 54 return adoptRef(new SVGFEBlendElement(document));
55 } 55 }
56 56
57 bool SVGFEBlendElement::isSupportedAttribute(const QualifiedName& attrName) 57 bool SVGFEBlendElement::isSupportedAttribute(const QualifiedName& attrName)
58 { 58 {
(...skipping 13 matching lines...) Expand all
72 return; 72 return;
73 } 73 }
74 74
75 if (name == SVGNames::modeAttr) { 75 if (name == SVGNames::modeAttr) {
76 BlendModeType propertyValue = SVGPropertyTraits<BlendModeType>::fromStri ng(value); 76 BlendModeType propertyValue = SVGPropertyTraits<BlendModeType>::fromStri ng(value);
77 if (propertyValue > 0) 77 if (propertyValue > 0)
78 setModeBaseValue(propertyValue); 78 setModeBaseValue(propertyValue);
79 return; 79 return;
80 } 80 }
81 81
82 if (name == SVGNames::inAttr) { 82 SVGParsingError parseError = NoError;
83 setIn1BaseValue(value);
84 return;
85 }
86 83
87 if (name == SVGNames::in2Attr) { 84 if (name == SVGNames::inAttr)
88 setIn2BaseValue(value); 85 m_in1->setBaseValueAsString(value, parseError);
89 return; 86 else if (name == SVGNames::in2Attr)
90 } 87 m_in2->setBaseValueAsString(value, parseError);
88 else
89 ASSERT_NOT_REACHED();
91 90
92 ASSERT_NOT_REACHED(); 91 reportAttributeParsingError(parseError, name, value);
93 } 92 }
94 93
95 bool SVGFEBlendElement::setFilterEffectAttribute(FilterEffect* effect, const Qua lifiedName& attrName) 94 bool SVGFEBlendElement::setFilterEffectAttribute(FilterEffect* effect, const Qua lifiedName& attrName)
96 { 95 {
97 FEBlend* blend = static_cast<FEBlend*>(effect); 96 FEBlend* blend = static_cast<FEBlend*>(effect);
98 if (attrName == SVGNames::modeAttr) 97 if (attrName == SVGNames::modeAttr)
99 return blend->setBlendMode(modeCurrentValue()); 98 return blend->setBlendMode(modeCurrentValue());
100 99
101 ASSERT_NOT_REACHED(); 100 ASSERT_NOT_REACHED();
102 return false; 101 return false;
(...skipping 16 matching lines...) Expand all
119 if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { 118 if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) {
120 invalidate(); 119 invalidate();
121 return; 120 return;
122 } 121 }
123 122
124 ASSERT_NOT_REACHED(); 123 ASSERT_NOT_REACHED();
125 } 124 }
126 125
127 PassRefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder* filterBuilde r, Filter* filter) 126 PassRefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder* filterBuilde r, Filter* filter)
128 { 127 {
129 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(in1CurrentV alue())); 128 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value()));
130 FilterEffect* input2 = filterBuilder->getEffectById(AtomicString(in2CurrentV alue())); 129 FilterEffect* input2 = filterBuilder->getEffectById(AtomicString(m_in2->curr entValue()->value()));
131 130
132 if (!input1 || !input2) 131 if (!input1 || !input2)
133 return 0; 132 return 0;
134 133
135 RefPtr<FilterEffect> effect = FEBlend::create(filter, modeCurrentValue()); 134 RefPtr<FilterEffect> effect = FEBlend::create(filter, modeCurrentValue());
136 FilterEffectVector& inputEffects = effect->inputEffects(); 135 FilterEffectVector& inputEffects = effect->inputEffects();
137 inputEffects.reserveCapacity(2); 136 inputEffects.reserveCapacity(2);
138 inputEffects.append(input1); 137 inputEffects.append(input1);
139 inputEffects.append(input2); 138 inputEffects.append(input2);
140 return effect.release(); 139 return effect.release();
141 } 140 }
142 141
143 } 142 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFEBlendElement.h ('k') | Source/core/svg/SVGFEColorMatrixElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698