| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 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 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #include "config.h" | 21 #include "config.h" |
| 22 #include "core/svg/SVGStopElement.h" | 22 #include "core/svg/SVGStopElement.h" |
| 23 | 23 |
| 24 #include "core/rendering/svg/RenderSVGGradientStop.h" | 24 #include "core/layout/svg/LayoutSVGGradientStop.h" |
| 25 | 25 |
| 26 namespace blink { | 26 namespace blink { |
| 27 | 27 |
| 28 inline SVGStopElement::SVGStopElement(Document& document) | 28 inline SVGStopElement::SVGStopElement(Document& document) |
| 29 : SVGElement(SVGNames::stopTag, document) | 29 : SVGElement(SVGNames::stopTag, document) |
| 30 , m_offset(SVGAnimatedNumber::create(this, SVGNames::offsetAttr, SVGNumberAc
ceptPercentage::create())) | 30 , m_offset(SVGAnimatedNumber::create(this, SVGNames::offsetAttr, SVGNumberAc
ceptPercentage::create())) |
| 31 { | 31 { |
| 32 addToPropertyMap(m_offset); | 32 addToPropertyMap(m_offset); |
| 33 } | 33 } |
| 34 | 34 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 if (renderer()) | 53 if (renderer()) |
| 54 markForLayoutAndParentResourceInvalidation(renderer()); | 54 markForLayoutAndParentResourceInvalidation(renderer()); |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 | 57 |
| 58 SVGElement::svgAttributeChanged(attrName); | 58 SVGElement::svgAttributeChanged(attrName); |
| 59 } | 59 } |
| 60 | 60 |
| 61 LayoutObject* SVGStopElement::createRenderer(const LayoutStyle&) | 61 LayoutObject* SVGStopElement::createRenderer(const LayoutStyle&) |
| 62 { | 62 { |
| 63 return new RenderSVGGradientStop(this); | 63 return new LayoutSVGGradientStop(this); |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool SVGStopElement::rendererIsNeeded(const LayoutStyle&) | 66 bool SVGStopElement::rendererIsNeeded(const LayoutStyle&) |
| 67 { | 67 { |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| 70 | 70 |
| 71 Color SVGStopElement::stopColorIncludingOpacity() const | 71 Color SVGStopElement::stopColorIncludingOpacity() const |
| 72 { | 72 { |
| 73 LayoutStyle* style = renderer() ? renderer()->style() : 0; | 73 LayoutStyle* style = renderer() ? renderer()->style() : 0; |
| 74 // FIXME: This check for null style exists to address Bug WK 90814, a rare c
rash condition in | 74 // FIXME: This check for null style exists to address Bug WK 90814, a rare c
rash condition in |
| 75 // which the renderer or style is null. This entire class is scheduled for r
emoval (Bug WK 86941) | 75 // which the renderer or style is null. This entire class is scheduled for r
emoval (Bug WK 86941) |
| 76 // and we will tolerate this null check until then. | 76 // and we will tolerate this null check until then. |
| 77 if (!style) | 77 if (!style) |
| 78 return Color(Color::transparent); // Transparent black. | 78 return Color(Color::transparent); // Transparent black. |
| 79 | 79 |
| 80 const SVGLayoutStyle& svgStyle = style->svgStyle(); | 80 const SVGLayoutStyle& svgStyle = style->svgStyle(); |
| 81 return svgStyle.stopColor().combineWithAlpha(svgStyle.stopOpacity()); | 81 return svgStyle.stopColor().combineWithAlpha(svgStyle.stopOpacity()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |