2
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3
* (C) 1999 Antti Koivisto (koivisto@kde.org)
4
* Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public License
17
* along with this library; see the file COPYING.LIB. If not, write to
18
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
26
#include "RenderContainer.h"
31
* all geometry managing stuff is only in the block elements.
33
* Inline elements don't layout themselves, but the whole paragraph
34
* gets flowed by the surrounding block element. This is, because
35
* one needs to know the whole paragraph to calculate bidirectional
36
* behaviour of text, so putting the layouting routines in the inline
37
* elements is impossible.
39
class RenderFlow : public RenderContainer {
41
RenderFlow(Node* node)
42
: RenderContainer(node)
47
, m_childrenInline(true)
49
, m_clearStatus(CNONE)
50
, m_topMarginQuirk(false)
51
, m_bottomMarginQuirk(false)
52
, m_hasMarkupTruncation(false)
53
, m_selectionState(SelectionNone)
55
, m_isContinuation(false)
59
virtual ~RenderFlow();
62
virtual RenderFlow* continuation() const { return m_continuation; }
63
void setContinuation(RenderFlow* c) { m_continuation = c; }
64
RenderFlow* continuationBefore(RenderObject* beforeChild);
66
void addChildWithContinuation(RenderObject* newChild, RenderObject* beforeChild);
67
virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild) = 0;
68
virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
70
static RenderFlow* createAnonymousFlow(Document*, RenderStyle*);
72
void extractLineBox(InlineFlowBox*);
73
void attachLineBox(InlineFlowBox*);
74
void removeLineBox(InlineFlowBox*);
75
void deleteLineBoxes();
76
virtual void destroy();
78
virtual void dirtyLinesFromChangedChild(RenderObject* child);
80
virtual short lineHeight(bool firstLine, bool isRootLineBox = false) const;
82
InlineFlowBox* firstLineBox() const { return m_firstLineBox; }
83
InlineFlowBox* lastLineBox() const { return m_lastLineBox; }
85
virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
86
virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
88
void paintLines(PaintInfo&, int tx, int ty);
89
bool hitTestLines(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
91
virtual IntRect absoluteClippedOverflowRect();
93
virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
94
virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
95
virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
97
virtual IntRect caretRect(int offset, EAffinity = UPSTREAM, int* extraWidthToEndOfLine = 0);
99
virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
100
void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect& prevLine, const IntRect& thisLine, const IntRect& nextLine);
101
void paintOutline(GraphicsContext*, int tx, int ty);
103
virtual bool hasColumns() const { return m_hasColumns; }
105
virtual bool isWordBreak() const { ASSERT(isInlineFlow()); return false; }
107
void checkConsistency() const;
110
// An inline can be split with blocks occurring in between the inline content.
111
// When this occurs we need a pointer to our next object. We can basically be
112
// split into a sequence of inlines and blocks. The continuation will either be
113
// an anonymous block (that houses other blocks) or it will be an inline flow.
114
RenderFlow* m_continuation;
117
// For block flows, each box represents the root inline box for a line in the
119
// For inline flows, each box represents a portion of that inline.
120
InlineFlowBox* m_firstLineBox;
121
InlineFlowBox* m_lastLineBox;
123
mutable short m_lineHeight;
125
// These bitfields are moved here from subclasses to pack them together
127
bool m_childrenInline : 1;
128
bool m_firstLine : 1;
129
unsigned m_clearStatus : 2; // EClear
130
bool m_topMarginQuirk : 1;
131
bool m_bottomMarginQuirk : 1;
132
bool m_hasMarkupTruncation : 1;
133
unsigned m_selectionState : 3; // SelectionState
134
bool m_hasColumns : 1;
137
bool m_isContinuation : 1; // Whether or not we're a continuation of an inline.
141
inline void RenderFlow::checkConsistency() const
146
} // namespace WebCore
148
#endif // RenderFlow_h