Remove unused variable movedSectionLogicalTop from table layout code.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / svg / SVGFEDropShadowElement.cpp
blob932e30e67e55f11db9e4917e2381d78b8880c3f5
1 /*
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #include "config.h"
21 #include "core/svg/SVGFEDropShadowElement.h"
23 #include "core/SVGNames.h"
24 #include "core/layout/LayoutObject.h"
25 #include "core/style/ComputedStyle.h"
26 #include "core/style/SVGComputedStyle.h"
27 #include "core/svg/SVGParserUtilities.h"
28 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
30 namespace blink {
32 inline SVGFEDropShadowElement::SVGFEDropShadowElement(Document& document)
33 : SVGFilterPrimitiveStandardAttributes(SVGNames::feDropShadowTag, document)
34 , m_dx(SVGAnimatedNumber::create(this, SVGNames::dxAttr, SVGNumber::create(2)))
35 , m_dy(SVGAnimatedNumber::create(this, SVGNames::dyAttr, SVGNumber::create(2)))
36 , m_stdDeviation(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::stdDeviationAttr, 2, 2))
37 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create()))
39 addToPropertyMap(m_dx);
40 addToPropertyMap(m_dy);
41 addToPropertyMap(m_stdDeviation);
42 addToPropertyMap(m_in1);
45 DEFINE_TRACE(SVGFEDropShadowElement)
47 visitor->trace(m_dx);
48 visitor->trace(m_dy);
49 visitor->trace(m_stdDeviation);
50 visitor->trace(m_in1);
51 SVGFilterPrimitiveStandardAttributes::trace(visitor);
54 DEFINE_NODE_FACTORY(SVGFEDropShadowElement)
56 void SVGFEDropShadowElement::setStdDeviation(float x, float y)
58 stdDeviationX()->baseValue()->setValue(x);
59 stdDeviationY()->baseValue()->setValue(y);
60 invalidate();
63 void SVGFEDropShadowElement::svgAttributeChanged(const QualifiedName& attrName)
65 if (attrName == SVGNames::inAttr
66 || attrName == SVGNames::stdDeviationAttr
67 || attrName == SVGNames::dxAttr
68 || attrName == SVGNames::dyAttr) {
69 SVGElement::InvalidationGuard invalidationGuard(this);
70 invalidate();
71 return;
74 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
77 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
79 LayoutObject* layoutObject = this->layoutObject();
80 if (!layoutObject)
81 return nullptr;
83 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->currentValue()->value() < 0)
84 return nullptr;
86 ASSERT(layoutObject->style());
87 const SVGComputedStyle& svgStyle = layoutObject->style()->svgStyle();
89 Color color = svgStyle.floodColor();
90 float opacity = svgStyle.floodOpacity();
92 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->currentValue()->value()));
93 if (!input1)
94 return nullptr;
96 RefPtrWillBeRawPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDeviationX()->currentValue()->value(), stdDeviationY()->currentValue()->value(), m_dx->currentValue()->value(), m_dy->currentValue()->value(), color, opacity);
97 effect->inputEffects().append(input1);
98 return effect.release();
101 } // namespace blink