]>
git.saurik.com Git - iphone-api.git/blob - WebCore/RenderContainer.h
2 * Copyright (C) 2001 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef RenderContainer_h
22 #define RenderContainer_h
24 #include "RenderBox.h"
26 #include "SelectionRect.h"
30 // Base class for rendering objects that can have children.
31 class RenderContainer
: public RenderBox
{
33 RenderContainer(Node
*);
34 virtual ~RenderContainer();
36 virtual RenderObject
* firstChild() const { return m_firstChild
; }
37 virtual RenderObject
* lastChild() const { return m_lastChild
; }
39 // Use this with caution! No type checking is done!
40 RenderBox
* firstChildBox() const { ASSERT(!firstChild() || firstChild()->isBox()); return toRenderBox(m_firstChild
); }
41 RenderBox
* lastChildBox() const { ASSERT(!lastChild() || lastChild()->isBox()); return toRenderBox(m_lastChild
); }
43 virtual bool canHaveChildren() const;
44 virtual void addChild(RenderObject
* newChild
, RenderObject
* beforeChild
= 0);
45 virtual void removeChild(RenderObject
*);
47 virtual void destroy();
48 void destroyLeftoverChildren();
50 virtual RenderObject
* removeChildNode(RenderObject
*, bool fullRemove
= true);
51 virtual void appendChildNode(RenderObject
*, bool fullAppend
= true);
52 virtual void insertChildNode(RenderObject
* child
, RenderObject
* before
, bool fullInsert
= true);
54 // Designed for speed. Don't waste time doing a bunch of work like layer updating and repainting when we know that our
55 // change in parentage is not going to affect anything.
56 virtual void moveChildNode(RenderObject
* child
) { appendChildNode(child
->parent()->removeChildNode(child
, false), false); }
58 virtual void layout();
59 virtual void calcPrefWidths() { setPrefWidthsDirty(false); }
61 virtual void removeLeftoverAnonymousBlock(RenderBlock
* child
);
63 RenderObject
* beforeAfterContainer(RenderStyle::PseudoId
);
64 virtual void updateBeforeAfterContent(RenderStyle::PseudoId
);
65 void updateBeforeAfterContentForContainer(RenderStyle::PseudoId
, RenderContainer
*);
66 bool isAfterContent(RenderObject
* child
) const;
67 virtual void invalidateCounters();
69 virtual VisiblePosition
positionForCoordinates(int x
, int y
);
71 virtual void addLineBoxRects(Vector
<IntRect
>&, unsigned startOffset
= 0, unsigned endOffset
= UINT_MAX
, bool useSelectionHeight
= false);
72 virtual void collectAbsoluteLineBoxQuads(Vector
<FloatQuad
>&, unsigned startOffset
= 0, unsigned endOffset
= UINT_MAX
, bool useSelectionHeight
= false);
73 virtual void collectSelectionRects(Vector
<SelectionRect
>&, unsigned startOffset
= 0, unsigned endOffset
= UINT_MAX
);
76 RenderObject
* m_firstChild
;
77 RenderObject
* m_lastChild
;
80 } // namespace WebCore
82 #endif // RenderContainer_h