]> git.saurik.com Git - iphone-api.git/blob - WebCore/SVGInlineTextBox.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / SVGInlineTextBox.h
1 /*
2 * This file is part of the DOM implementation for KDE.
3 *
4 * Copyright (C) 2007 Rob Buis <buis@kde.org>
5 * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
6 *
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.
11 *
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.
16 *
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.
21 *
22 */
23
24 #ifndef SVGInlineTextBox_h
25 #define SVGInlineTextBox_h
26
27 #if ENABLE(SVG)
28 #include "InlineTextBox.h"
29
30 namespace WebCore {
31
32 class SVGChar;
33 class SVGRootInlineBox;
34 class SVGTextDecorationInfo;
35
36 class SVGInlineTextBox : public InlineTextBox {
37 public:
38 SVGInlineTextBox(RenderObject* obj);
39
40 virtual int selectionTop();
41 virtual int selectionHeight();
42
43 virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const;
44 virtual int positionForOffset(int offset) const;
45
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);
48
49 // SVGs custom paint text method
50 void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVGPaintServer*);
51
52 // SVGs custom paint selection method
53 void paintSelection(int boxStartOffset, const SVGChar&, const UChar*, int length, GraphicsContext*, RenderStyle*, const Font&);
54
55 // SVGs custom paint decoration method
56 void paintDecoration(ETextDecoration, GraphicsContext*, int tx, int ty, int width, const SVGChar&, const SVGTextDecorationInfo&);
57
58 SVGRootInlineBox* svgRootInlineBox() const;
59
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;
63
64 FloatRect calculateGlyphBoundaries(RenderStyle*, int offset, const SVGChar&) const;
65 SVGChar* closestCharacterToPosition(int x, int y, int& offset) const;
66
67 private:
68 friend class RenderSVGInlineText;
69 bool svgCharacterHitsPosition(int x, int y, int& offset) const;
70 };
71
72 } // namespace WebCore
73
74 #endif
75 #endif // SVGInlineTextBox_h