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

Side by Side Diff: Source/core/svg/SVGFEGaussianBlurElement.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/SVGFEGaussianBlurElement.h ('k') | Source/core/svg/SVGFEImageElement.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 13 matching lines...) Expand all
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/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(SVGFEGaussianBlurElement, SVGNames::inAttr, In1, in1)
35 34
36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement) 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement)
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 SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(Document& document) 39 inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(Document& document)
42 : SVGFilterPrimitiveStandardAttributes(SVGNames::feGaussianBlurTag, document ) 40 : SVGFilterPrimitiveStandardAttributes(SVGNames::feGaussianBlurTag, document )
43 , m_stdDeviation(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::std DeviationAttr, 0, 0)) 41 , m_stdDeviation(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::std DeviationAttr, 0, 0))
42 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create( )))
44 { 43 {
45 ScriptWrappable::init(this); 44 ScriptWrappable::init(this);
46 45
47 addToPropertyMap(m_stdDeviation); 46 addToPropertyMap(m_stdDeviation);
47 addToPropertyMap(m_in1);
48 registerAnimatedPropertiesForSVGFEGaussianBlurElement(); 48 registerAnimatedPropertiesForSVGFEGaussianBlurElement();
49 } 49 }
50 50
51 PassRefPtr<SVGFEGaussianBlurElement> SVGFEGaussianBlurElement::create(Document& document) 51 PassRefPtr<SVGFEGaussianBlurElement> SVGFEGaussianBlurElement::create(Document& document)
52 { 52 {
53 return adoptRef(new SVGFEGaussianBlurElement(document)); 53 return adoptRef(new SVGFEGaussianBlurElement(document));
54 } 54 }
55 55
56 void SVGFEGaussianBlurElement::setStdDeviation(float x, float y) 56 void SVGFEGaussianBlurElement::setStdDeviation(float x, float y)
57 { 57 {
(...skipping 12 matching lines...) Expand all
70 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 70 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
71 } 71 }
72 72
73 void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const A tomicString& value) 73 void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const A tomicString& value)
74 { 74 {
75 if (!isSupportedAttribute(name)) { 75 if (!isSupportedAttribute(name)) {
76 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); 76 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value);
77 return; 77 return;
78 } 78 }
79 79
80 if (name == SVGNames::inAttr) {
81 setIn1BaseValue(value);
82 return;
83 }
84
85 SVGParsingError parseError = NoError; 80 SVGParsingError parseError = NoError;
86 81
87 if (name == SVGNames::stdDeviationAttr) 82 if (name == SVGNames::inAttr)
83 m_in1->setBaseValueAsString(value, parseError);
84 else if (name == SVGNames::stdDeviationAttr)
88 m_stdDeviation->setBaseValueAsString(value, parseError); 85 m_stdDeviation->setBaseValueAsString(value, parseError);
89 else 86 else
90 ASSERT_NOT_REACHED(); 87 ASSERT_NOT_REACHED();
91 88
92 reportAttributeParsingError(parseError, name, value); 89 reportAttributeParsingError(parseError, name, value);
93 } 90 }
94 91
95 void SVGFEGaussianBlurElement::svgAttributeChanged(const QualifiedName& attrName ) 92 void SVGFEGaussianBlurElement::svgAttributeChanged(const QualifiedName& attrName )
96 { 93 {
97 if (!isSupportedAttribute(attrName)) { 94 if (!isSupportedAttribute(attrName)) {
98 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); 95 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
99 return; 96 return;
100 } 97 }
101 98
102 SVGElementInstance::InvalidationGuard invalidationGuard(this); 99 SVGElementInstance::InvalidationGuard invalidationGuard(this);
103 100
104 if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr) { 101 if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr) {
105 invalidate(); 102 invalidate();
106 return; 103 return;
107 } 104 }
108 105
109 ASSERT_NOT_REACHED(); 106 ASSERT_NOT_REACHED();
110 } 107 }
111 108
112 PassRefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filte rBuilder, Filter* filter) 109 PassRefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filte rBuilder, Filter* filter)
113 { 110 {
114 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(in1CurrentV alue())); 111 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value()));
115 112
116 if (!input1) 113 if (!input1)
117 return 0; 114 return 0;
118 115
119 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current Value()->value() < 0) 116 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current Value()->value() < 0)
120 return 0; 117 return 0;
121 118
122 RefPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDeviationX() ->currentValue()->value(), stdDeviationY()->currentValue()->value()); 119 RefPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDeviationX() ->currentValue()->value(), stdDeviationY()->currentValue()->value());
123 effect->inputEffects().append(input1); 120 effect->inputEffects().append(input1);
124 return effect.release(); 121 return effect.release();
125 } 122 }
126 123
127 } 124 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFEGaussianBlurElement.h ('k') | Source/core/svg/SVGFEImageElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698