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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 */ | 18 */ |
19 | 19 |
20 #include "config.h" | 20 #include "config.h" |
21 #include "core/svg/SVGFEDropShadowElement.h" | 21 #include "core/svg/SVGFEDropShadowElement.h" |
22 | 22 |
23 #include "core/SVGNames.h" | 23 #include "core/SVGNames.h" |
24 #include "core/rendering/RenderObject.h" | 24 #include "core/layout/LayoutObject.h" |
25 #include "core/rendering/style/RenderStyle.h" | 25 #include "core/rendering/style/RenderStyle.h" |
26 #include "core/rendering/style/SVGRenderStyle.h" | 26 #include "core/rendering/style/SVGRenderStyle.h" |
27 #include "core/svg/SVGParserUtilities.h" | 27 #include "core/svg/SVGParserUtilities.h" |
28 #include "core/svg/graphics/filters/SVGFilterBuilder.h" | 28 #include "core/svg/graphics/filters/SVGFilterBuilder.h" |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 inline SVGFEDropShadowElement::SVGFEDropShadowElement(Document& document) | 32 inline SVGFEDropShadowElement::SVGFEDropShadowElement(Document& document) |
33 : SVGFilterPrimitiveStandardAttributes(SVGNames::feDropShadowTag, document) | 33 : SVGFilterPrimitiveStandardAttributes(SVGNames::feDropShadowTag, document) |
34 , m_dx(SVGAnimatedNumber::create(this, SVGNames::dxAttr, SVGNumber::create(2
))) | 34 , m_dx(SVGAnimatedNumber::create(this, SVGNames::dxAttr, SVGNumber::create(2
))) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 || attrName == SVGNames::dyAttr) { | 92 || attrName == SVGNames::dyAttr) { |
93 invalidate(); | 93 invalidate(); |
94 return; | 94 return; |
95 } | 95 } |
96 | 96 |
97 ASSERT_NOT_REACHED(); | 97 ASSERT_NOT_REACHED(); |
98 } | 98 } |
99 | 99 |
100 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuil
der* filterBuilder, Filter* filter) | 100 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuil
der* filterBuilder, Filter* filter) |
101 { | 101 { |
102 RenderObject* renderer = this->renderer(); | 102 LayoutObject* renderer = this->renderer(); |
103 if (!renderer) | 103 if (!renderer) |
104 return nullptr; | 104 return nullptr; |
105 | 105 |
106 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current
Value()->value() < 0) | 106 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current
Value()->value() < 0) |
107 return nullptr; | 107 return nullptr; |
108 | 108 |
109 ASSERT(renderer->style()); | 109 ASSERT(renderer->style()); |
110 const SVGRenderStyle& svgStyle = renderer->style()->svgStyle(); | 110 const SVGRenderStyle& svgStyle = renderer->style()->svgStyle(); |
111 | 111 |
112 Color color = svgStyle.floodColor(); | 112 Color color = svgStyle.floodColor(); |
113 float opacity = svgStyle.floodOpacity(); | 113 float opacity = svgStyle.floodOpacity(); |
114 | 114 |
115 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 115 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
116 if (!input1) | 116 if (!input1) |
117 return nullptr; | 117 return nullptr; |
118 | 118 |
119 RefPtrWillBeRawPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDe
viationX()->currentValue()->value(), stdDeviationY()->currentValue()->value(), m
_dx->currentValue()->value(), m_dy->currentValue()->value(), color, opacity); | 119 RefPtrWillBeRawPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDe
viationX()->currentValue()->value(), stdDeviationY()->currentValue()->value(), m
_dx->currentValue()->value(), m_dy->currentValue()->value(), color, opacity); |
120 effect->inputEffects().append(input1); | 120 effect->inputEffects().append(input1); |
121 return effect.release(); | 121 return effect.release(); |
122 } | 122 } |
123 | 123 |
124 } // namespace blink | 124 } // namespace blink |
OLD | NEW |