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