OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 DEFINE_NODE_FACTORY(SVGFEDropShadowElement) | 54 DEFINE_NODE_FACTORY(SVGFEDropShadowElement) |
55 | 55 |
56 void SVGFEDropShadowElement::setStdDeviation(float x, float y) | 56 void SVGFEDropShadowElement::setStdDeviation(float x, float y) |
57 { | 57 { |
58 stdDeviationX()->baseValue()->setValue(x); | 58 stdDeviationX()->baseValue()->setValue(x); |
59 stdDeviationY()->baseValue()->setValue(y); | 59 stdDeviationY()->baseValue()->setValue(y); |
60 invalidate(); | 60 invalidate(); |
61 } | 61 } |
62 | 62 |
63 bool SVGFEDropShadowElement::isSupportedAttribute(const QualifiedName& attrName) | |
64 { | |
65 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
66 if (supportedAttributes.isEmpty()) { | |
67 supportedAttributes.add(SVGNames::inAttr); | |
68 supportedAttributes.add(SVGNames::dxAttr); | |
69 supportedAttributes.add(SVGNames::dyAttr); | |
70 supportedAttributes.add(SVGNames::stdDeviationAttr); | |
71 } | |
72 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
73 } | |
74 | |
75 void SVGFEDropShadowElement::svgAttributeChanged(const QualifiedName& attrName) | 63 void SVGFEDropShadowElement::svgAttributeChanged(const QualifiedName& attrName) |
76 { | 64 { |
77 if (!isSupportedAttribute(attrName)) { | |
78 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | |
79 return; | |
80 } | |
81 | |
82 SVGElement::InvalidationGuard invalidationGuard(this); | |
83 | |
84 if (attrName == SVGNames::inAttr | 65 if (attrName == SVGNames::inAttr |
85 || attrName == SVGNames::stdDeviationAttr | 66 || attrName == SVGNames::stdDeviationAttr |
86 || attrName == SVGNames::dxAttr | 67 || attrName == SVGNames::dxAttr |
87 || attrName == SVGNames::dyAttr) { | 68 || attrName == SVGNames::dyAttr) { |
| 69 SVGElement::InvalidationGuard invalidationGuard(this); |
88 invalidate(); | 70 invalidate(); |
89 return; | 71 return; |
90 } | 72 } |
91 | 73 |
92 ASSERT_NOT_REACHED(); | 74 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
93 } | 75 } |
94 | 76 |
95 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuil
der* filterBuilder, Filter* filter) | 77 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuil
der* filterBuilder, Filter* filter) |
96 { | 78 { |
97 LayoutObject* renderer = this->layoutObject(); | 79 LayoutObject* renderer = this->layoutObject(); |
98 if (!renderer) | 80 if (!renderer) |
99 return nullptr; | 81 return nullptr; |
100 | 82 |
101 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current
Value()->value() < 0) | 83 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current
Value()->value() < 0) |
102 return nullptr; | 84 return nullptr; |
103 | 85 |
104 ASSERT(renderer->style()); | 86 ASSERT(renderer->style()); |
105 const SVGComputedStyle& svgStyle = renderer->style()->svgStyle(); | 87 const SVGComputedStyle& svgStyle = renderer->style()->svgStyle(); |
106 | 88 |
107 Color color = svgStyle.floodColor(); | 89 Color color = svgStyle.floodColor(); |
108 float opacity = svgStyle.floodOpacity(); | 90 float opacity = svgStyle.floodOpacity(); |
109 | 91 |
110 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 92 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
111 if (!input1) | 93 if (!input1) |
112 return nullptr; | 94 return nullptr; |
113 | 95 |
114 RefPtrWillBeRawPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDe
viationX()->currentValue()->value(), stdDeviationY()->currentValue()->value(), m
_dx->currentValue()->value(), m_dy->currentValue()->value(), color, opacity); | 96 RefPtrWillBeRawPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDe
viationX()->currentValue()->value(), stdDeviationY()->currentValue()->value(), m
_dx->currentValue()->value(), m_dy->currentValue()->value(), color, opacity); |
115 effect->inputEffects().append(input1); | 97 effect->inputEffects().append(input1); |
116 return effect.release(); | 98 return effect.release(); |
117 } | 99 } |
118 | 100 |
119 } // namespace blink | 101 } // namespace blink |
OLD | NEW |