OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/rendering/svg/RenderSVGResourceGradient.h" | 24 #include "core/rendering/svg/RenderSVGResourceGradient.h" |
25 | 25 |
26 namespace blink { | 26 namespace blink { |
27 | 27 |
28 RenderSVGResourceGradient::RenderSVGResourceGradient(SVGGradientElement* node) | 28 RenderSVGResourceGradient::RenderSVGResourceGradient(SVGGradientElement* node) |
29 : RenderSVGResourceContainer(node) | 29 : RenderSVGResourcePaintServer(node) |
30 , m_shouldCollectGradientAttributes(true) | 30 , m_shouldCollectGradientAttributes(true) |
31 { | 31 { |
32 } | 32 } |
33 | 33 |
34 void RenderSVGResourceGradient::removeAllClientsFromCache(bool markForInvalidati
on) | 34 void RenderSVGResourceGradient::removeAllClientsFromCache(bool markForInvalidati
on) |
35 { | 35 { |
36 m_gradientMap.clear(); | 36 m_gradientMap.clear(); |
37 m_shouldCollectGradientAttributes = true; | 37 m_shouldCollectGradientAttributes = true; |
38 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare
ntOnlyInvalidation); | 38 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare
ntOnlyInvalidation); |
39 } | 39 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 | 101 |
102 bool RenderSVGResourceGradient::isChildAllowed(RenderObject* child, RenderStyle*
) const | 102 bool RenderSVGResourceGradient::isChildAllowed(RenderObject* child, RenderStyle*
) const |
103 { | 103 { |
104 if (child->isSVGGradientStop()) | 104 if (child->isSVGGradientStop()) |
105 return true; | 105 return true; |
106 | 106 |
107 if (!child->isSVGResourceContainer()) | 107 if (!child->isSVGResourceContainer()) |
108 return false; | 108 return false; |
109 | 109 |
110 RenderSVGResourceContainer* resource = toRenderSVGResourceContainer(child); | 110 return toRenderSVGResourceContainer(child)->isSVGPaintServer(); |
111 return resource->resourceType() == PatternResourceType | |
112 || resource->resourceType() == LinearGradientResourceType | |
113 || resource->resourceType() == RadialGradientResourceType; | |
114 } | 111 } |
115 | 112 |
116 void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vecto
r<Gradient::ColorStop>& stops) const | 113 void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vecto
r<Gradient::ColorStop>& stops) const |
117 { | 114 { |
118 ASSERT(gradientData->gradient); | 115 ASSERT(gradientData->gradient); |
119 | 116 |
120 const Vector<Gradient::ColorStop>::const_iterator end = stops.end(); | 117 const Vector<Gradient::ColorStop>::const_iterator end = stops.end(); |
121 for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != e
nd; ++it) | 118 for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != e
nd; ++it) |
122 gradientData->gradient->addColorStop(*it); | 119 gradientData->gradient->addColorStop(*it); |
123 } | 120 } |
124 | 121 |
125 GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType(
SVGSpreadMethodType method) const | 122 GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType(
SVGSpreadMethodType method) const |
126 { | 123 { |
127 switch (method) { | 124 switch (method) { |
128 case SVGSpreadMethodUnknown: | 125 case SVGSpreadMethodUnknown: |
129 case SVGSpreadMethodPad: | 126 case SVGSpreadMethodPad: |
130 return SpreadMethodPad; | 127 return SpreadMethodPad; |
131 case SVGSpreadMethodReflect: | 128 case SVGSpreadMethodReflect: |
132 return SpreadMethodReflect; | 129 return SpreadMethodReflect; |
133 case SVGSpreadMethodRepeat: | 130 case SVGSpreadMethodRepeat: |
134 return SpreadMethodRepeat; | 131 return SpreadMethodRepeat; |
135 } | 132 } |
136 | 133 |
137 ASSERT_NOT_REACHED(); | 134 ASSERT_NOT_REACHED(); |
138 return SpreadMethodPad; | 135 return SpreadMethodPad; |
139 } | 136 } |
140 | 137 |
141 } | 138 } |
OLD | NEW |