OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 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 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return; | 97 return; |
98 } | 98 } |
99 | 99 |
100 SVGElement::InvalidationGuard invalidationGuard(this); | 100 SVGElement::InvalidationGuard invalidationGuard(this); |
101 | 101 |
102 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); | 102 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); |
103 if (renderer) | 103 if (renderer) |
104 renderer->invalidateCacheAndMarkForLayout(); | 104 renderer->invalidateCacheAndMarkForLayout(); |
105 } | 105 } |
106 | 106 |
107 void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChang
e, Node* afterChange, int childCountDelta) | 107 void SVGGradientElement::childrenChanged(const ChildrenChange& change) |
108 { | 108 { |
109 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); | 109 SVGElement::childrenChanged(change); |
110 | 110 |
111 if (changedByParser) | 111 if (change.byParser) |
112 return; | 112 return; |
113 | 113 |
114 if (RenderObject* object = renderer()) | 114 if (RenderObject* object = renderer()) |
115 object->setNeedsLayoutAndFullPaintInvalidation(); | 115 object->setNeedsLayoutAndFullPaintInvalidation(); |
116 } | 116 } |
117 | 117 |
118 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() | 118 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() |
119 { | 119 { |
120 Vector<Gradient::ColorStop> stops; | 120 Vector<Gradient::ColorStop> stops; |
121 | 121 |
122 float previousOffset = 0.0f; | 122 float previousOffset = 0.0f; |
123 for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); st
op; stop = Traversal<SVGStopElement>::nextSibling(*stop)) { | 123 for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); st
op; stop = Traversal<SVGStopElement>::nextSibling(*stop)) { |
124 // Figure out right monotonic offset | 124 // Figure out right monotonic offset |
125 float offset = stop->offset()->currentValue()->value(); | 125 float offset = stop->offset()->currentValue()->value(); |
126 offset = std::min(std::max(previousOffset, offset), 1.0f); | 126 offset = std::min(std::max(previousOffset, offset), 1.0f); |
127 previousOffset = offset; | 127 previousOffset = offset; |
128 | 128 |
129 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); | 129 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); |
130 } | 130 } |
131 | 131 |
132 return stops; | 132 return stops; |
133 } | 133 } |
134 | 134 |
135 } | 135 } |
OLD | NEW |