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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 void SVGGradientElement::childrenChanged(const ChildrenChange& change) | 92 void SVGGradientElement::childrenChanged(const ChildrenChange& change) |
93 { | 93 { |
94 SVGElement::childrenChanged(change); | 94 SVGElement::childrenChanged(change); |
95 | 95 |
96 if (change.byParser) | 96 if (change.byParser) |
97 return; | 97 return; |
98 | 98 |
99 if (LayoutObject* object = layoutObject()) | 99 if (LayoutObject* object = layoutObject()) |
100 object->setNeedsLayoutAndFullPaintInvalidation(); | 100 object->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason:
:ChildChanged); |
101 } | 101 } |
102 | 102 |
103 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() | 103 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() |
104 { | 104 { |
105 Vector<Gradient::ColorStop> stops; | 105 Vector<Gradient::ColorStop> stops; |
106 | 106 |
107 float previousOffset = 0.0f; | 107 float previousOffset = 0.0f; |
108 for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); st
op; stop = Traversal<SVGStopElement>::nextSibling(*stop)) { | 108 for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); st
op; stop = Traversal<SVGStopElement>::nextSibling(*stop)) { |
109 // Figure out right monotonic offset | 109 // Figure out right monotonic offset |
110 float offset = stop->offset()->currentValue()->value(); | 110 float offset = stop->offset()->currentValue()->value(); |
111 offset = std::min(std::max(previousOffset, offset), 1.0f); | 111 offset = std::min(std::max(previousOffset, offset), 1.0f); |
112 previousOffset = offset; | 112 previousOffset = offset; |
113 | 113 |
114 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); | 114 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); |
115 } | 115 } |
116 | 116 |
117 return stops; | 117 return stops; |
118 } | 118 } |
119 | 119 |
120 } | 120 } |
OLD | NEW |