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 24 matching lines...) Expand all Loading... |
35 , m_dy(SVGAnimatedNumber::create(this, SVGNames::dyAttr, SVGNumber::create(2
))) | 35 , m_dy(SVGAnimatedNumber::create(this, SVGNames::dyAttr, SVGNumber::create(2
))) |
36 , m_stdDeviation(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::std
DeviationAttr, 2, 2)) | 36 , m_stdDeviation(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::std
DeviationAttr, 2, 2)) |
37 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) | 37 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) |
38 { | 38 { |
39 addToPropertyMap(m_dx); | 39 addToPropertyMap(m_dx); |
40 addToPropertyMap(m_dy); | 40 addToPropertyMap(m_dy); |
41 addToPropertyMap(m_stdDeviation); | 41 addToPropertyMap(m_stdDeviation); |
42 addToPropertyMap(m_in1); | 42 addToPropertyMap(m_in1); |
43 } | 43 } |
44 | 44 |
| 45 void SVGFEDropShadowElement::trace(Visitor* visitor) |
| 46 { |
| 47 visitor->trace(m_dx); |
| 48 visitor->trace(m_dy); |
| 49 visitor->trace(m_stdDeviation); |
| 50 visitor->trace(m_in1); |
| 51 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
| 52 } |
| 53 |
45 DEFINE_NODE_FACTORY(SVGFEDropShadowElement) | 54 DEFINE_NODE_FACTORY(SVGFEDropShadowElement) |
46 | 55 |
47 void SVGFEDropShadowElement::setStdDeviation(float x, float y) | 56 void SVGFEDropShadowElement::setStdDeviation(float x, float y) |
48 { | 57 { |
49 stdDeviationX()->baseValue()->setValue(x); | 58 stdDeviationX()->baseValue()->setValue(x); |
50 stdDeviationY()->baseValue()->setValue(y); | 59 stdDeviationY()->baseValue()->setValue(y); |
51 invalidate(); | 60 invalidate(); |
52 } | 61 } |
53 | 62 |
54 bool SVGFEDropShadowElement::isSupportedAttribute(const QualifiedName& attrName) | 63 bool SVGFEDropShadowElement::isSupportedAttribute(const QualifiedName& attrName) |
(...skipping 26 matching lines...) Expand all Loading... |
81 || attrName == SVGNames::stdDeviationAttr | 90 || attrName == SVGNames::stdDeviationAttr |
82 || attrName == SVGNames::dxAttr | 91 || attrName == SVGNames::dxAttr |
83 || attrName == SVGNames::dyAttr) { | 92 || attrName == SVGNames::dyAttr) { |
84 invalidate(); | 93 invalidate(); |
85 return; | 94 return; |
86 } | 95 } |
87 | 96 |
88 ASSERT_NOT_REACHED(); | 97 ASSERT_NOT_REACHED(); |
89 } | 98 } |
90 | 99 |
91 PassRefPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuilder* filterB
uilder, Filter* filter) | 100 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuil
der* filterBuilder, Filter* filter) |
92 { | 101 { |
93 RenderObject* renderer = this->renderer(); | 102 RenderObject* renderer = this->renderer(); |
94 if (!renderer) | 103 if (!renderer) |
95 return nullptr; | 104 return nullptr; |
96 | 105 |
97 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current
Value()->value() < 0) | 106 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current
Value()->value() < 0) |
98 return nullptr; | 107 return nullptr; |
99 | 108 |
100 ASSERT(renderer->style()); | 109 ASSERT(renderer->style()); |
101 const SVGRenderStyle& svgStyle = renderer->style()->svgStyle(); | 110 const SVGRenderStyle& svgStyle = renderer->style()->svgStyle(); |
102 | 111 |
103 Color color = svgStyle.floodColor(); | 112 Color color = svgStyle.floodColor(); |
104 float opacity = svgStyle.floodOpacity(); | 113 float opacity = svgStyle.floodOpacity(); |
105 | 114 |
106 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 115 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
107 if (!input1) | 116 if (!input1) |
108 return nullptr; | 117 return nullptr; |
109 | 118 |
110 RefPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDeviationX()->
currentValue()->value(), stdDeviationY()->currentValue()->value(), m_dx->current
Value()->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); |
111 effect->inputEffects().append(input1); | 120 effect->inputEffects().append(input1); |
112 return effect.release(); | 121 return effect.release(); |
113 } | 122 } |
114 | 123 |
115 } // namespace blink | 124 } // namespace blink |
OLD | NEW |