2 * This file is part of the WebKit project.
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>
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.
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.
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.
25 #ifndef SVGRootInlineBox_h
26 #define SVGRootInlineBox_h
29 #include "RootInlineBox.h"
30 #include "SVGCharacterLayoutInfo.h"
36 class SVGInlineTextBox
;
38 struct LastGlyphInfo
{
39 LastGlyphInfo() : isValid(false) { }
46 class SVGRootInlineBox
: public RootInlineBox
{
48 SVGRootInlineBox(RenderObject
* obj
)
53 virtual bool isSVGRootInlineBox() { return true; }
55 virtual void paint(RenderObject::PaintInfo
&, int tx
, int ty
);
57 virtual int placeBoxesHorizontally(int x
, int& leftPosition
, int& rightPosition
, bool& needsWordSpacing
);
58 virtual int verticallyAlignBoxes(int heightOfBlock
);
60 virtual void computePerCharacterLayoutInformation();
62 // Used by SVGInlineTextBox
63 const Vector
<SVGTextChunk
>& svgTextChunks() const;
65 void walkTextChunks(SVGTextChunkWalkerBase
*, const SVGInlineTextBox
* textBox
= 0);
68 friend struct SVGRootInlineBoxPaintWalker
;
70 void layoutInlineBoxes();
71 void layoutInlineBoxes(InlineFlowBox
* start
, Vector
<SVGChar
>::iterator
& it
, int& minX
, int& maxX
, int& minY
, int& maxY
);
73 void buildLayoutInformation(InlineFlowBox
* start
, SVGCharacterLayoutInfo
&);
74 void buildLayoutInformationForTextBox(SVGCharacterLayoutInfo
&, InlineTextBox
*, LastGlyphInfo
&);
76 void buildTextChunks(Vector
<SVGChar
>&, Vector
<SVGTextChunk
>&, InlineFlowBox
* start
);
77 void buildTextChunks(Vector
<SVGChar
>&, InlineFlowBox
* start
, SVGTextChunkLayoutInfo
&);
78 void layoutTextChunks();
80 SVGTextDecorationInfo
retrievePaintServersForTextDecoration(RenderObject
* start
);
83 Vector
<SVGChar
> m_svgChars
;
84 Vector
<SVGTextChunk
> m_svgTextChunks
;
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
);
93 RenderSVGRoot
* findSVGRootObject(RenderObject
* start
);
95 } // namespace WebCore
99 #endif // SVGRootInlineBox_h