KHtml

SVGInlineTextBox.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright (C) 2007 Rob Buis <[email protected]>
5  * (C) 2007 Nikolas Zimmermann <[email protected]>
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 #include "rendering/render_text.h"
30 #include "svg/graphics/SVGPaintServer.h"
31 
32 namespace WebCore
33 {
34 using namespace khtml;
35 
36 struct SVGChar;
37 class SVGRootInlineBox;
38 struct SVGTextDecorationInfo;
39 
40 class SVGInlineTextBox : public InlineTextBox
41 {
42 public:
43  SVGInlineTextBox(RenderObject *obj);
44 
45  virtual int selectionTop();
46  virtual int selectionHeight();
47 
48  virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const;
49  virtual int positionForOffset(int offset) const;
50 
51  /*virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);*/
52  virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos);
53 
54  // SVGs custom paint text method
55  void paintCharacters(RenderObject::PaintInfo &, int tx, int ty, const SVGChar &, const UChar *chars, int length, SVGPaintServer *);
56 
57  // SVGs custom paint selection method
58  void paintSelection(int boxStartOffset, const SVGChar &, const UChar *, int length, RenderObject::PaintInfo &, RenderStyle *, const Font *);
59 
60  // SVGs custom paint decoration method
61  void paintDecoration(ETextDecoration, RenderObject::PaintInfo &, int tx, int ty, int width, const SVGChar &, const SVGTextDecorationInfo &);
62 
63  SVGRootInlineBox *svgRootInlineBox() const;
64 
65  // Helper functions shared with SVGRootInlineBox
66  float calculateGlyphWidth(RenderStyle *style, int offset, int extraCharsAvailable, int &charsConsumed, String &glyphName) const;
67  float calculateGlyphHeight(RenderStyle *, int offset, int extraCharsAvailable) const;
68 
69  FloatRect calculateGlyphBoundaries(RenderStyle *, int offset, const SVGChar &) const;
70  SVGChar *closestCharacterToPosition(int x, int y, int &offset) const;
71 
72 private:
73  friend class RenderSVGInlineText;
74  bool svgCharacterHitsPosition(int x, int y, int &offset) const;
75 };
76 
77 } // namespace WebCore
78 
79 #endif
80 #endif // SVGInlineTextBox_h
This file is part of the HTML rendering engine for KDE.
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
Base Class for all rendering tree objects.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 22:48:22 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.