KHtml

SVGRootInlineBox.h
1 /*
2  * This file is part of the WebKit project.
3  *
4  * Copyright (C) 2006 Oliver Hunt <[email protected]>
5  * (C) 2006 Apple Computer Inc.
6  * (C) 2007 Nikolas Zimmermann <[email protected]>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  */
24 
25 #ifndef SVGRootInlineBox_h
26 #define SVGRootInlineBox_h
27 
28 #if ENABLE(SVG)
29 #include "rendering/render_line.h" // RootInlineBox
30 #include "SVGCharacterLayoutInfo.h"
31 #include "rendering/render_text.h"
32 
33 namespace WebCore
34 {
35 
36 using namespace khtml;
37 
38 //class InlineTextBox;
39 class RenderSVGRoot;
40 class SVGInlineTextBox;
41 
42 struct LastGlyphInfo {
43  LastGlyphInfo() : isValid(false) { }
44 
45  String unicode;
46  String glyphName;
47  bool isValid;
48 };
49 
50 class SVGRootInlineBox : public RootInlineBox
51 {
52 public:
53  SVGRootInlineBox(RenderObject *obj)
54  : RootInlineBox(obj)
55  {
56  }
57 
58  bool isSVGRootInlineBox() const override
59  {
60  return true;
61  }
62 
63  void paint(RenderObject::PaintInfo &, int tx, int ty) override;
64 
65  virtual int placeBoxesHorizontally(int x, int &leftPosition, int &rightPosition, bool &needsWordSpacing);
66  virtual void verticallyAlignBoxes(int &heightOfBlock);
67 
68  virtual void computePerCharacterLayoutInformation();
69 
70  // Used by SVGInlineTextBox
71  const Vector<SVGTextChunk> &svgTextChunks() const;
72 
73  void walkTextChunks(SVGTextChunkWalkerBase *, const SVGInlineTextBox *textBox = nullptr);
74 
75 private:
76  friend struct SVGRootInlineBoxPaintWalker;
77 
78  void layoutInlineBoxes();
79  void layoutInlineBoxes(InlineFlowBox *start, Vector<SVGChar>::iterator &it, int &minX, int &maxX, int &minY, int &maxY);
80 
81  void buildLayoutInformation(InlineFlowBox *start, SVGCharacterLayoutInfo &);
82  void buildLayoutInformationForTextBox(SVGCharacterLayoutInfo &, InlineTextBox *, LastGlyphInfo &);
83 
84  void buildTextChunks(Vector<SVGChar> &, Vector<SVGTextChunk> &, InlineFlowBox *start);
85  void buildTextChunks(Vector<SVGChar> &, InlineFlowBox *start, SVGTextChunkLayoutInfo &);
86  void layoutTextChunks();
87 
88  SVGTextDecorationInfo retrievePaintServersForTextDecoration(RenderObject *start);
89 
90 private:
91  Vector<SVGChar> m_svgChars;
92  Vector<SVGTextChunk> m_svgTextChunks;
93 };
94 
95 // Shared with SVGRenderTreeAsText / SVGInlineTextBox
96 /*khtml TextRun svgTextRunForInlineTextBox(const UChar*, int len, RenderStyle* style, const InlineTextBox* textBox, float xPos);*/
97 FloatPoint topLeftPositionOfCharacterRange(Vector<SVGChar>::iterator start, Vector<SVGChar>::iterator end);
98 float cummulatedWidthOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange &range);
99 float cummulatedHeightOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange &range);
100 
101 RenderSVGRoot *findSVGRootObject(RenderObject *start);
102 
103 } // namespace WebCore
104 
105 #endif // ENABLE(SVG)
106 
107 #endif // SVGRootInlineBox_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
bool isValid(QStringView ifopt)
Base Class for all rendering tree objects.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:48:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.