2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / WebCore / rendering / SVGInlineTextBox.h
blob1ddc23a61deab5dd5c572317ac1a4b675a72c39b
1 /*
2 * This file is part of the DOM implementation for KDE.
4 * Copyright (C) 2007 Rob Buis <buis@kde.org>
5 * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #ifndef SVGInlineTextBox_h
25 #define SVGInlineTextBox_h
27 #if ENABLE(SVG)
28 #include "InlineTextBox.h"
30 namespace WebCore {
32 class SVGChar;
33 class SVGRootInlineBox;
34 class SVGTextDecorationInfo;
36 class SVGInlineTextBox : public InlineTextBox {
37 public:
38 SVGInlineTextBox(RenderObject* obj);
40 virtual int selectionTop();
41 virtual int selectionHeight();
43 virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const;
44 virtual int positionForOffset(int offset) const;
46 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);
47 virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos);
49 // SVGs custom paint text method
50 void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVGPaintServer*);
52 // SVGs custom paint selection method
53 void paintSelection(int boxStartOffset, const SVGChar&, const UChar*, int length, GraphicsContext*, RenderStyle*, const Font*);
55 // SVGs custom paint decoration method
56 void paintDecoration(ETextDecoration, GraphicsContext*, int tx, int ty, int width, const SVGChar&, const SVGTextDecorationInfo&);
58 SVGRootInlineBox* svgRootInlineBox() const;
60 // Helper functions shared with SVGRootInlineBox
61 float calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const;
62 float calculateGlyphHeight(RenderStyle*, int offset, int extraCharsAvailable) const;
64 FloatRect calculateGlyphBoundaries(RenderStyle*, int offset, const SVGChar&) const;
65 SVGChar* closestCharacterToPosition(int x, int y, int& offset) const;
67 private:
68 friend class RenderSVGInlineText;
69 bool svgCharacterHitsPosition(int x, int y, int& offset) const;
72 } // namespace WebCore
74 #endif
75 #endif // SVGInlineTextBox_h