fix logic
[personal-kdelibs.git] / khtml / rendering / SVGInlineTextBox.h
bloba2cfbc97c3f3e09ab2f03dfb92755943aff6dd5b
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"
29 #include "rendering/render_text.h"
30 #include "svg/graphics/SVGPaintServer.h"
32 namespace WebCore {
33 using namespace khtml;
35 class SVGChar;
36 class SVGRootInlineBox;
37 class SVGTextDecorationInfo;
39 class SVGInlineTextBox : public InlineTextBox {
40 public:
41 SVGInlineTextBox(RenderObject* obj);
43 virtual int selectionTop();
44 virtual int selectionHeight();
46 virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const;
47 virtual int positionForOffset(int offset) const;
49 /*virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);*/
50 virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos);
52 // SVGs custom paint text method
53 void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVGPaintServer*);
55 // SVGs custom paint selection method
56 void paintSelection(int boxStartOffset, const SVGChar&, const UChar*, int length, GraphicsContext*, RenderStyle*, const Font*);
58 // SVGs custom paint decoration method
59 void paintDecoration(ETextDecoration, GraphicsContext*, int tx, int ty, int width, const SVGChar&, const SVGTextDecorationInfo&);
61 SVGRootInlineBox* svgRootInlineBox() const;
63 // Helper functions shared with SVGRootInlineBox
64 float calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const;
65 float calculateGlyphHeight(RenderStyle*, int offset, int extraCharsAvailable) const;
67 FloatRect calculateGlyphBoundaries(RenderStyle*, int offset, const SVGChar&) const;
68 SVGChar* closestCharacterToPosition(int x, int y, int& offset) const;
70 private:
71 friend class RenderSVGInlineText;
72 bool svgCharacterHitsPosition(int x, int y, int& offset) const;
75 } // namespace WebCore
77 #endif
78 #endif // SVGInlineTextBox_h