| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) | 84 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) |
| 85 { | 85 { |
| 86 if (!isSupportedAttribute(attrName)) { | 86 if (!isSupportedAttribute(attrName)) { |
| 87 SVGElement::svgAttributeChanged(attrName); | 87 SVGElement::svgAttributeChanged(attrName); |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 | 90 |
| 91 SVGElement::InvalidationGuard invalidationGuard(this); | 91 SVGElement::InvalidationGuard invalidationGuard(this); |
| 92 | 92 |
| 93 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->re
nderer()); | 93 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la
youtObject()); |
| 94 if (renderer) | 94 if (renderer) |
| 95 renderer->invalidateCacheAndMarkForLayout(); | 95 renderer->invalidateCacheAndMarkForLayout(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void SVGGradientElement::childrenChanged(const ChildrenChange& change) | 98 void SVGGradientElement::childrenChanged(const ChildrenChange& change) |
| 99 { | 99 { |
| 100 SVGElement::childrenChanged(change); | 100 SVGElement::childrenChanged(change); |
| 101 | 101 |
| 102 if (change.byParser) | 102 if (change.byParser) |
| 103 return; | 103 return; |
| 104 | 104 |
| 105 if (LayoutObject* object = renderer()) | 105 if (LayoutObject* object = layoutObject()) |
| 106 object->setNeedsLayoutAndFullPaintInvalidation(); | 106 object->setNeedsLayoutAndFullPaintInvalidation(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() | 109 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() |
| 110 { | 110 { |
| 111 Vector<Gradient::ColorStop> stops; | 111 Vector<Gradient::ColorStop> stops; |
| 112 | 112 |
| 113 float previousOffset = 0.0f; | 113 float previousOffset = 0.0f; |
| 114 for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); st
op; stop = Traversal<SVGStopElement>::nextSibling(*stop)) { | 114 for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); st
op; stop = Traversal<SVGStopElement>::nextSibling(*stop)) { |
| 115 // Figure out right monotonic offset | 115 // Figure out right monotonic offset |
| 116 float offset = stop->offset()->currentValue()->value(); | 116 float offset = stop->offset()->currentValue()->value(); |
| 117 offset = std::min(std::max(previousOffset, offset), 1.0f); | 117 offset = std::min(std::max(previousOffset, offset), 1.0f); |
| 118 previousOffset = offset; | 118 previousOffset = offset; |
| 119 | 119 |
| 120 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); | 120 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); |
| 121 } | 121 } |
| 122 | 122 |
| 123 return stops; | 123 return stops; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } | 126 } |
| OLD | NEW |