1 /*
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2009 Google, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
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
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifndef RenderSVGGradientStop_h
22 #define RenderSVGGradientStop_h
23
24 #if ENABLE(SVG)
25 #include "RenderObject.h"
26
27 namespace WebCore {
28
29 class SVGGradientElement;
30 class SVGStopElement;
31
32 // This class exists mostly so we can hear about gradient stop style changes
33 class RenderSVGGradientStop : public RenderObject {
34 public:
35 RenderSVGGradientStop(SVGStopElement*);
36 virtual ~RenderSVGGradientStop();
37
isSVGGradientStop()38 virtual bool isSVGGradientStop() const { return true; }
renderName()39 virtual const char* renderName() const { return "RenderSVGGradientStop"; }
40
41 virtual void layout();
42
43 // This overrides are needed to prevent ASSERTs on <svg><stop /></svg>
44 // RenderObject's default implementations ASSERT_NOT_REACHED()
45 // https://bugs.webkit.org/show_bug.cgi?id=20400
clippedOverflowRectForRepaint(RenderBoxModelObject *)46 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject*) { return IntRect(); }
objectBoundingBox()47 virtual FloatRect objectBoundingBox() const { return FloatRect(); }
strokeBoundingBox()48 virtual FloatRect strokeBoundingBox() const { return FloatRect(); }
repaintRectInLocalCoordinates()49 virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(); }
50
51 protected:
52 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
53
54 private:
55 SVGGradientElement* gradientElement() const;
56 };
57
toRenderSVGGradientStop(const RenderObject * object)58 inline const RenderSVGGradientStop* toRenderSVGGradientStop(const RenderObject* object)
59 {
60 ASSERT(!object || object->isSVGGradientStop());
61 return static_cast<const RenderSVGGradientStop*>(object);
62 }
63
64 }
65
66 #endif // ENABLE(SVG)
67 #endif // RenderSVGGradientStop_h
68