2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef RenderSVGText_h
23 #define RenderSVGText_h
27 #include "AffineTransform.h"
28 #include "RenderSVGBlock.h"
29 #include "SVGTextLayoutAttributes.h"
35 class RenderSVGText : public RenderSVGBlock {
37 RenderSVGText(SVGTextElement*);
39 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
41 void setNeedsPositioningValuesUpdate() { m_needsPositioningValuesUpdate = true; }
42 virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; }
43 virtual FloatRect repaintRectInLocalCoordinates() const;
45 static RenderSVGText* locateRenderSVGTextAncestor(RenderObject*);
46 static const RenderSVGText* locateRenderSVGTextAncestor(const RenderObject*);
48 Vector<SVGTextLayoutAttributes>& layoutAttributes() { return m_layoutAttributes; }
49 bool needsReordering() const { return m_needsReordering; }
52 virtual const char* renderName() const { return "RenderSVGText"; }
53 virtual bool isSVGText() const { return true; }
55 virtual void paint(PaintInfo&, const LayoutPoint&);
56 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
57 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
58 virtual VisiblePosition positionForPoint(const LayoutPoint&);
60 virtual bool requiresLayer() const { return false; }
61 virtual void layout();
63 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed);
65 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
66 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const;
68 virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
70 virtual FloatRect objectBoundingBox() const { return frameRect(); }
71 virtual FloatRect strokeBoundingBox() const;
73 virtual const AffineTransform& localToParentTransform() const { return m_localTransform; }
74 virtual AffineTransform localTransform() const { return m_localTransform; }
75 virtual RootInlineBox* createRootInlineBox();
77 virtual RenderBlock* firstLineBlock() const;
78 virtual void updateFirstLetter();
80 bool m_needsReordering : 1;
81 bool m_needsPositioningValuesUpdate : 1;
82 bool m_needsTransformUpdate : 1;
83 AffineTransform m_localTransform;
84 Vector<SVGTextLayoutAttributes> m_layoutAttributes;
87 inline RenderSVGText* toRenderSVGText(RenderObject* object)
89 ASSERT(!object || object->isSVGText());
90 return static_cast<RenderSVGText*>(object);
93 inline const RenderSVGText* toRenderSVGText(const RenderObject* object)
95 ASSERT(!object || object->isSVGText());
96 return static_cast<const RenderSVGText*>(object);
99 // This will catch anyone doing an unnecessary cast.
100 void toRenderSVGText(const RenderSVGText*);
104 #endif // ENABLE(SVG)