OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #include "config.h" | 21 #include "config.h" |
22 | |
23 #include "core/svg/SVGStopElement.h" | 22 #include "core/svg/SVGStopElement.h" |
24 | 23 |
25 #include "core/rendering/svg/RenderSVGGradientStop.h" | 24 #include "core/rendering/svg/RenderSVGGradientStop.h" |
26 #include "core/rendering/svg/RenderSVGResource.h" | |
27 | 25 |
28 namespace blink { | 26 namespace blink { |
29 | 27 |
30 inline SVGStopElement::SVGStopElement(Document& document) | 28 inline SVGStopElement::SVGStopElement(Document& document) |
31 : SVGElement(SVGNames::stopTag, document) | 29 : SVGElement(SVGNames::stopTag, document) |
32 , m_offset(SVGAnimatedNumber::create(this, SVGNames::offsetAttr, SVGNumberAc
ceptPercentage::create())) | 30 , m_offset(SVGAnimatedNumber::create(this, SVGNames::offsetAttr, SVGNumberAc
ceptPercentage::create())) |
33 { | 31 { |
34 addToPropertyMap(m_offset); | 32 addToPropertyMap(m_offset); |
35 } | 33 } |
36 | 34 |
37 DEFINE_NODE_FACTORY(SVGStopElement) | 35 DEFINE_NODE_FACTORY(SVGStopElement) |
38 | 36 |
39 void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 37 void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
40 { | 38 { |
41 parseAttributeNew(name, value); | 39 parseAttributeNew(name, value); |
42 } | 40 } |
43 | 41 |
44 void SVGStopElement::svgAttributeChanged(const QualifiedName& attrName) | 42 void SVGStopElement::svgAttributeChanged(const QualifiedName& attrName) |
45 { | 43 { |
46 if (attrName == SVGNames::offsetAttr) { | 44 if (attrName == SVGNames::offsetAttr) { |
47 SVGElement::InvalidationGuard invalidationGuard(this); | 45 SVGElement::InvalidationGuard invalidationGuard(this); |
48 | 46 |
49 if (renderer()) | 47 if (renderer()) |
50 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render
er()); | 48 markForLayoutAndParentResourceInvalidation(renderer()); |
51 | |
52 return; | 49 return; |
53 } | 50 } |
54 | 51 |
55 SVGElement::svgAttributeChanged(attrName); | 52 SVGElement::svgAttributeChanged(attrName); |
56 } | 53 } |
57 | 54 |
58 RenderObject* SVGStopElement::createRenderer(RenderStyle*) | 55 RenderObject* SVGStopElement::createRenderer(RenderStyle*) |
59 { | 56 { |
60 return new RenderSVGGradientStop(this); | 57 return new RenderSVGGradientStop(this); |
61 } | 58 } |
(...skipping 10 matching lines...) Expand all Loading... |
72 // which the renderer or style is null. This entire class is scheduled for r
emoval (Bug WK 86941) | 69 // which the renderer or style is null. This entire class is scheduled for r
emoval (Bug WK 86941) |
73 // and we will tolerate this null check until then. | 70 // and we will tolerate this null check until then. |
74 if (!style) | 71 if (!style) |
75 return Color(Color::transparent); // Transparent black. | 72 return Color(Color::transparent); // Transparent black. |
76 | 73 |
77 const SVGRenderStyle& svgStyle = style->svgStyle(); | 74 const SVGRenderStyle& svgStyle = style->svgStyle(); |
78 return svgStyle.stopColor().combineWithAlpha(svgStyle.stopOpacity()); | 75 return svgStyle.stopColor().combineWithAlpha(svgStyle.stopOpacity()); |
79 } | 76 } |
80 | 77 |
81 } // namespace blink | 78 } // namespace blink |
OLD | NEW |