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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | 74 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
75 } | 75 } |
76 | 76 |
77 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuil
der* filterBuilder, Filter* filter) | 77 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuil
der* filterBuilder, Filter* filter) |
78 { | 78 { |
79 LayoutObject* layoutObject = this->layoutObject(); | 79 LayoutObject* layoutObject = this->layoutObject(); |
80 if (!layoutObject) | 80 if (!layoutObject) |
81 return nullptr; | 81 return nullptr; |
82 | 82 |
83 if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->current
Value()->value() < 0) | |
84 return nullptr; | |
85 | |
86 ASSERT(layoutObject->style()); | 83 ASSERT(layoutObject->style()); |
87 const SVGComputedStyle& svgStyle = layoutObject->style()->svgStyle(); | 84 const SVGComputedStyle& svgStyle = layoutObject->style()->svgStyle(); |
88 | 85 |
89 Color color = svgStyle.floodColor(); | 86 Color color = svgStyle.floodColor(); |
90 float opacity = svgStyle.floodOpacity(); | 87 float opacity = svgStyle.floodOpacity(); |
91 | 88 |
92 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 89 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
93 if (!input1) | 90 if (!input1) |
94 return nullptr; | 91 return nullptr; |
95 | 92 |
96 RefPtrWillBeRawPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDe
viationX()->currentValue()->value(), stdDeviationY()->currentValue()->value(), m
_dx->currentValue()->value(), m_dy->currentValue()->value(), color, opacity); | 93 // Clamp std.dev. to non-negative. (See SVGFEGaussianBlurElement::build) |
| 94 float stdDevX = std::max(0.0f, stdDeviationX()->currentValue()->value()); |
| 95 float stdDevY = std::max(0.0f, stdDeviationY()->currentValue()->value()); |
| 96 RefPtrWillBeRawPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDe
vX, stdDevY, m_dx->currentValue()->value(), m_dy->currentValue()->value(), color
, opacity); |
97 effect->inputEffects().append(input1); | 97 effect->inputEffects().append(input1); |
98 return effect.release(); | 98 return effect.release(); |
99 } | 99 } |
100 | 100 |
101 } // namespace blink | 101 } // namespace blink |
OLD | NEW |