]> git.saurik.com Git - iphone-api.git/blob - WebCore/SVGRootInlineBox.h
Adding the WebCore headers (for Cydget).
[iphone-api.git] / WebCore / SVGRootInlineBox.h
1 /*
2 * This file is part of the WebKit project.
3 *
4 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
5 * (C) 2006 Apple Computer Inc.
6 * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
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 "RootInlineBox.h"
30 #include "SVGCharacterLayoutInfo.h"
31
32 namespace WebCore {
33
34 class InlineTextBox;
35 class RenderSVGRoot;
36 class SVGInlineTextBox;
37
38 struct LastGlyphInfo {
39 LastGlyphInfo() : isValid(false) { }
40
41 String unicode;
42 String glyphName;
43 bool isValid;
44 };
45
46 class SVGRootInlineBox : public RootInlineBox {
47 public:
48 SVGRootInlineBox(RenderObject* obj)
49 : RootInlineBox(obj)
50 {
51 }
52
53 virtual bool isSVGRootInlineBox() { return true; }
54
55 virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
56
57 virtual int placeBoxesHorizontally(int x, int& leftPosition, int& rightPosition, bool& needsWordSpacing);
58 virtual int verticallyAlignBoxes(int heightOfBlock);
59
60 virtual void computePerCharacterLayoutInformation();
61
62 // Used by SVGInlineTextBox
63 const Vector<SVGTextChunk>& svgTextChunks() const;
64
65 void walkTextChunks(SVGTextChunkWalkerBase*, const SVGInlineTextBox* textBox = 0);
66
67 private:
68 friend struct SVGRootInlineBoxPaintWalker;
69
70 void layoutInlineBoxes();
71 void layoutInlineBoxes(InlineFlowBox* start, Vector<SVGChar>::iterator& it, int& minX, int& maxX, int& minY, int& maxY);
72
73 void buildLayoutInformation(InlineFlowBox* start, SVGCharacterLayoutInfo&);
74 void buildLayoutInformationForTextBox(SVGCharacterLayoutInfo&, InlineTextBox*, LastGlyphInfo&);
75
76 void buildTextChunks(Vector<SVGChar>&, Vector<SVGTextChunk>&, InlineFlowBox* start);
77 void buildTextChunks(Vector<SVGChar>&, InlineFlowBox* start, SVGTextChunkLayoutInfo&);
78 void layoutTextChunks();
79
80 SVGTextDecorationInfo retrievePaintServersForTextDecoration(RenderObject* start);
81
82 private:
83 Vector<SVGChar> m_svgChars;
84 Vector<SVGTextChunk> m_svgTextChunks;
85 };
86
87 // Shared with SVGRenderTreeAsText / SVGInlineTextBox
88 TextRun svgTextRunForInlineTextBox(const UChar*, int len, RenderStyle* style, const InlineTextBox* textBox, float xPos);
89 FloatPoint topLeftPositionOfCharacterRange(Vector<SVGChar>::iterator start, Vector<SVGChar>::iterator end);
90 float cummulatedWidthOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange& range);
91 float cummulatedHeightOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange& range);
92
93 RenderSVGRoot* findSVGRootObject(RenderObject* start);
94
95 } // namespace WebCore
96
97 #endif // ENABLE(SVG)
98
99 #endif // SVGRootInlineBox_h