~ubuntu-branches/ubuntu/maverick/webkit/maverick

« back to all changes in this revision

Viewing changes to WebCore/rendering/RenderBlock.h

  • Committer: Bazaar Package Importer
  • Author(s): Mike Hommey
  • Date: 2007-08-19 15:54:12 UTC
  • Revision ID: james.westby@ubuntu.com-20070819155412-uxxg1h9plpghmtbi
Tags: upstream-0~svn25144
ImportĀ upstreamĀ versionĀ 0~svn25144

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the render object implementation for KHTML.
 
3
 *
 
4
 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
 
5
 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
 
6
 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
 
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., 59 Temple Place - Suite 330,
 
21
 * Boston, MA 02111-1307, USA.
 
22
 */
 
23
 
 
24
#ifndef RenderBlock_h
 
25
#define RenderBlock_h
 
26
 
 
27
#include "DeprecatedPtrList.h"
 
28
#include "GapRects.h"
 
29
#include "RenderFlow.h"
 
30
#include "RootInlineBox.h"
 
31
 
 
32
namespace WebCore {
 
33
 
 
34
class BidiIterator;
 
35
class BidiRun;
 
36
class Position;
 
37
class RootInlineBox;
 
38
 
 
39
template <class Iterator, class Run> class BidiResolver;
 
40
typedef BidiResolver<BidiIterator, BidiRun> BidiState;
 
41
 
 
42
enum CaretType { CursorCaret, DragCaret };
 
43
 
 
44
class RenderBlock : public RenderFlow {
 
45
public:
 
46
    RenderBlock(Node*);
 
47
    virtual ~RenderBlock();
 
48
 
 
49
    virtual const char* renderName() const;
 
50
 
 
51
    // These two functions are overridden for inline-block.
 
52
    virtual short lineHeight(bool firstLine, bool isRootLineBox = false) const;
 
53
    virtual short baselinePosition(bool firstLine, bool isRootLineBox = false) const;
 
54
 
 
55
    virtual bool isRenderBlock() const { return true; }
 
56
    virtual bool isBlockFlow() const { return (!isInline() || isReplaced()) && !isTable(); }
 
57
    virtual bool isInlineFlow() const { return isInline() && !isReplaced(); }
 
58
    virtual bool isInlineBlockOrInlineTable() const { return isInline() && isReplaced(); }
 
59
 
 
60
    virtual bool childrenInline() const { return m_childrenInline; }
 
61
    virtual void setChildrenInline(bool b) { m_childrenInline = b; }
 
62
    void makeChildrenNonInline(RenderObject* insertionPoint = 0);
 
63
    void deleteLineBoxTree();
 
64
 
 
65
    // The height (and width) of a block when you include overflow spillage out of the bottom
 
66
    // of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
 
67
    // it would have an overflow height of borderTop() + paddingTop() + 100px.
 
68
    virtual int overflowHeight(bool includeInterior = true) const;
 
69
    virtual int overflowWidth(bool includeInterior = true) const;
 
70
    virtual int overflowLeft(bool includeInterior = true) const;
 
71
    virtual int overflowTop(bool includeInterior = true) const;
 
72
    virtual IntRect overflowRect(bool includeInterior = true) const;
 
73
    virtual void setOverflowHeight(int h) { m_overflowHeight = h; }
 
74
    virtual void setOverflowWidth(int w) { m_overflowWidth = w; }
 
75
 
 
76
    void addVisualOverflow(const IntRect&);
 
77
 
 
78
    virtual bool isSelfCollapsingBlock() const;
 
79
    virtual bool isTopMarginQuirk() const { return m_topMarginQuirk; }
 
80
    virtual bool isBottomMarginQuirk() const { return m_bottomMarginQuirk; }
 
81
 
 
82
    virtual int maxTopMargin(bool positive) const { return positive ? maxTopPosMargin() : maxTopNegMargin(); }
 
83
    virtual int maxBottomMargin(bool positive) const { return positive ? maxBottomPosMargin() : maxBottomNegMargin(); }
 
84
 
 
85
    int maxTopPosMargin() const { return m_maxMargin ? m_maxMargin->m_topPos : MaxMargin::topPosDefault(this); }
 
86
    int maxTopNegMargin() const { return m_maxMargin ? m_maxMargin->m_topNeg : MaxMargin::topNegDefault(this); }
 
87
    int maxBottomPosMargin() const { return m_maxMargin ? m_maxMargin->m_bottomPos : MaxMargin::bottomPosDefault(this); }
 
88
    int maxBottomNegMargin() const { return m_maxMargin ? m_maxMargin->m_bottomNeg : MaxMargin::bottomNegDefault(this); }
 
89
    void setMaxTopMargins(int pos, int neg);
 
90
    void setMaxBottomMargins(int pos, int neg);
 
91
    
 
92
    void initMaxMarginValues()
 
93
    {
 
94
        if (m_maxMargin) {
 
95
            m_maxMargin->m_topPos = MaxMargin::topPosDefault(this);
 
96
            m_maxMargin->m_topNeg = MaxMargin::topNegDefault(this);
 
97
            m_maxMargin->m_bottomPos = MaxMargin::bottomPosDefault(this);
 
98
            m_maxMargin->m_bottomNeg = MaxMargin::bottomNegDefault(this);
 
99
        }
 
100
    }
 
101
 
 
102
    virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild);
 
103
    virtual void removeChild(RenderObject*);
 
104
 
 
105
    virtual void repaintOverhangingFloats(bool paintAllDescendants);
 
106
 
 
107
    virtual void setStyle(RenderStyle*);
 
108
 
 
109
    virtual void layout();
 
110
    virtual void layoutBlock(bool relayoutChildren);
 
111
    void layoutBlockChildren(bool relayoutChildren);
 
112
    void layoutInlineChildren(bool relayoutChildren, int& repaintTop, int& repaintBottom);
 
113
 
 
114
    void layoutPositionedObjects(bool relayoutChildren);
 
115
    void insertPositionedObject(RenderObject*);
 
116
    void removePositionedObject(RenderObject*);
 
117
    virtual void removePositionedObjects(RenderBlock*);
 
118
 
 
119
    virtual void positionListMarker() { }
 
120
 
 
121
    virtual void borderFitAdjust(int& x, int& w) const; // Shrink the box in which the border paints if border-fit is set.
 
122
 
 
123
    // Called to lay out the legend for a fieldset.
 
124
    virtual RenderObject* layoutLegend(bool relayoutChildren) { return 0; };
 
125
 
 
126
    // the implementation of the following functions is in bidi.cpp
 
127
    void bidiReorderLine(const BidiIterator& start, const BidiIterator& end, BidiState&);
 
128
    RootInlineBox* determineStartPosition(bool fullLayout, BidiIterator& start, BidiState&);
 
129
    RootInlineBox* determineEndPosition(RootInlineBox* startBox, BidiIterator& cleanLineStart,
 
130
                                        BidiStatus& cleanLineBidiStatus,
 
131
                                        int& yPos);
 
132
    bool matchedEndLine(const BidiIterator& start, const BidiStatus& status,
 
133
                        const BidiIterator& endLineStart, const BidiStatus& endLineStatus,
 
134
                        RootInlineBox*& endLine, int& endYPos, int& repaintBottom, int& repaintTop);
 
135
    bool generatesLineBoxesForInlineChild(RenderObject*);
 
136
    int skipWhitespace(BidiIterator&, BidiState&);
 
137
    BidiIterator findNextLineBreak(BidiIterator& start, BidiState& info);
 
138
    RootInlineBox* constructLine(const BidiIterator& start, const BidiIterator& end);
 
139
    InlineFlowBox* createLineBoxes(RenderObject*);
 
140
    void computeHorizontalPositionsForLine(RootInlineBox*, bool reachedEnd);
 
141
    void computeVerticalPositionsForLine(RootInlineBox*);
 
142
    void checkLinesForOverflow();
 
143
    void deleteEllipsisLineBoxes();
 
144
    void checkLinesForTextOverflow();
 
145
    // end bidi.cpp functions
 
146
 
 
147
    virtual void paint(PaintInfo&, int tx, int ty);
 
148
    virtual void paintObject(PaintInfo&, int tx, int ty);
 
149
    void paintFloats(PaintInfo&, int tx, int ty, bool paintSelection = false);
 
150
    void paintContents(PaintInfo&, int tx, int ty);
 
151
    void paintColumns(PaintInfo&, int tx, int ty, bool paintFloats = false);
 
152
    void paintChildren(PaintInfo&, int tx, int ty);
 
153
    void paintEllipsisBoxes(PaintInfo&, int tx, int ty);
 
154
    void paintSelection(PaintInfo&, int tx, int ty);
 
155
    void paintCaret(PaintInfo&, CaretType);
 
156
    
 
157
    void insertFloatingObject(RenderObject*);
 
158
    void removeFloatingObject(RenderObject*);
 
159
 
 
160
    // called from lineWidth, to position the floats added in the last line.
 
161
    void positionNewFloats();
 
162
    void clearFloats();
 
163
    int getClearDelta(RenderObject* child);
 
164
    virtual void markAllDescendantsWithFloatsForLayout(RenderObject* floatToRemove = 0);
 
165
    void markPositionedObjectsForLayout();
 
166
 
 
167
    // FIXME: containsFloats() should not return true if the floating objects list
 
168
    // is empty. However, layoutInlineChildren() relies on the current behavior.
 
169
    // http://bugs.webkit.org/show_bug.cgi?id=7395#c3
 
170
    virtual bool containsFloats() { return m_floatingObjects; }
 
171
    virtual bool containsFloat(RenderObject*);
 
172
 
 
173
    virtual bool avoidsFloats() const;
 
174
 
 
175
    virtual bool hasOverhangingFloats() { return !hasColumns() && floatBottom() > m_height; }
 
176
    void addIntrudingFloats(RenderBlock* prev, int xoffset, int yoffset);
 
177
    void addOverhangingFloats(RenderBlock* child, int xoffset, int yoffset);
 
178
 
 
179
    int nearestFloatBottom(int height) const;
 
180
    int floatBottom() const;
 
181
    inline int leftBottom();
 
182
    inline int rightBottom();
 
183
    IntRect floatRect() const;
 
184
 
 
185
    virtual int lineWidth(int y) const;
 
186
    virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
 
187
    virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
 
188
    virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
 
189
 
 
190
    int rightOffset() const;
 
191
    int rightRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const;
 
192
    int rightOffset(int y) const { return rightRelOffset(y, rightOffset(), true); }
 
193
 
 
194
    int leftOffset() const;
 
195
    int leftRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const;
 
196
    int leftOffset(int y) const { return leftRelOffset(y, leftOffset(), true); }
 
197
 
 
198
    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
 
199
    virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
 
200
    virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
 
201
 
 
202
    virtual bool isPointInOverflowControl(HitTestResult&, int x, int y, int tx, int ty);
 
203
 
 
204
    virtual VisiblePosition positionForCoordinates(int x, int y);
 
205
    
 
206
    // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.)
 
207
    virtual int availableWidth() const;
 
208
    
 
209
    virtual void calcPrefWidths();
 
210
    void calcInlinePrefWidths();
 
211
    void calcBlockPrefWidths();
 
212
 
 
213
    virtual int getBaselineOfFirstLineBox() const;
 
214
    virtual int getBaselineOfLastLineBox() const;
 
215
 
 
216
    RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(firstLineBox()); }
 
217
    RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(lastLineBox()); }
 
218
 
 
219
    // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
 
220
    // children.
 
221
    virtual RenderBlock* firstLineBlock() const;
 
222
    virtual void updateFirstLetter();
 
223
 
 
224
    bool inRootBlockContext() const;
 
225
 
 
226
    void setHasMarkupTruncation(bool b = true) { m_hasMarkupTruncation = b; }
 
227
    bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }
 
228
 
 
229
    virtual bool hasSelectedChildren() const { return m_selectionState != SelectionNone; }
 
230
    virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
 
231
    virtual void setSelectionState(SelectionState s);
 
232
 
 
233
    struct BlockSelectionInfo {
 
234
        RenderBlock* m_block;
 
235
        GapRects m_rects;
 
236
        SelectionState m_state;
 
237
 
 
238
        BlockSelectionInfo()
 
239
            : m_block(0)
 
240
            , m_state(SelectionNone)
 
241
        {
 
242
        }
 
243
 
 
244
        BlockSelectionInfo(RenderBlock* b)
 
245
            : m_block(b)
 
246
            , m_rects(b->needsLayout() ? GapRects() : b->selectionGapRects())
 
247
            , m_state(b->selectionState())
 
248
        { 
 
249
        }
 
250
 
 
251
        RenderBlock* block() const { return m_block; }
 
252
        GapRects rects() const { return m_rects; }
 
253
        SelectionState state() const { return m_state; }
 
254
    };
 
255
 
 
256
    virtual IntRect selectionRect(bool) { return selectionGapRects(); }
 
257
    GapRects selectionGapRects();
 
258
    virtual bool shouldPaintSelectionGaps() const;
 
259
    bool isSelectionRoot() const;
 
260
    GapRects fillSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
 
261
                               int& lastTop, int& lastLeft, int& lastRight, const PaintInfo* = 0);
 
262
    GapRects fillInlineSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
 
263
                                     int& lastTop, int& lastLeft, int& lastRight, const PaintInfo*);
 
264
    GapRects fillBlockSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
 
265
                                    int& lastTop, int& lastLeft, int& lastRight, const PaintInfo*);
 
266
    IntRect fillVerticalSelectionGap(int lastTop, int lastLeft, int lastRight, int bottomY, RenderBlock* rootBlock,
 
267
                                     int blockX, int blockY, const PaintInfo*);
 
268
    IntRect fillLeftSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock, 
 
269
                                 int blockX, int blockY, int tx, int ty, const PaintInfo*);
 
270
    IntRect fillRightSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
 
271
                                  int blockX, int blockY, int tx, int ty, const PaintInfo*);
 
272
    IntRect fillHorizontalSelectionGap(RenderObject* selObj, int xPos, int yPos, int width, int height, const PaintInfo*);
 
273
 
 
274
    void getHorizontalSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap);
 
275
    int leftSelectionOffset(RenderBlock* rootBlock, int y);
 
276
    int rightSelectionOffset(RenderBlock* rootBlock, int y);
 
277
 
 
278
#ifndef NDEBUG
 
279
    virtual void dump(TextStream*, DeprecatedString ind = "") const;
 
280
#endif
 
281
 
 
282
    // Helper methods for computing line counts and heights for line counts.
 
283
    RootInlineBox* lineAtIndex(int);
 
284
    int lineCount();
 
285
    int heightForLineCount(int);
 
286
    void clearTruncation();
 
287
 
 
288
    int desiredColumnWidth() const;
 
289
    unsigned desiredColumnCount() const;
 
290
    Vector<IntRect>* columnRects() const;
 
291
    void setDesiredColumnCountAndWidth(int count, int width);
 
292
    
 
293
    void adjustRectForColumns(IntRect&) const;
 
294
 
 
295
    void addContinuationWithOutline(RenderFlow*);
 
296
    void paintContinuationOutlines(PaintInfo&, int tx, int ty);
 
297
 
 
298
private:
 
299
    void adjustPointToColumnContents(IntPoint&) const;
 
300
    void adjustForBorderFit(int x, int& left, int& right) const; // Helper function for borderFitAdjust
 
301
 
 
302
protected:
 
303
    void newLine();
 
304
    virtual bool hasLineIfEmpty() const;
 
305
    bool layoutOnlyPositionedObjects();
 
306
 
 
307
private:
 
308
    Position positionForBox(InlineBox*, bool start = true) const;
 
309
    Position positionForRenderer(RenderObject*, bool start = true) const;
 
310
 
 
311
    int columnGap() const;
 
312
    void calcColumnWidth();
 
313
    int layoutColumns(int endOfContent = -1);
 
314
 
 
315
protected:
 
316
    struct FloatingObject {
 
317
        enum Type {
 
318
            FloatLeft,
 
319
            FloatRight
 
320
        };
 
321
 
 
322
        FloatingObject(Type type)
 
323
            : node(0)
 
324
            , startY(0)
 
325
            , endY(0)
 
326
            , left(0)
 
327
            , width(0)
 
328
            , m_type(type)
 
329
            , noPaint(false)
 
330
        {
 
331
        }
 
332
 
 
333
        Type type() { return static_cast<Type>(m_type); }
 
334
 
 
335
        RenderObject* node;
 
336
        int startY;
 
337
        int endY;
 
338
        int left;
 
339
        int width;
 
340
        unsigned m_type : 1; // Type (left or right aligned)
 
341
        bool noPaint : 1;
 
342
    };
 
343
 
 
344
    // The following helper functions and structs are used by layoutBlockChildren.
 
345
    class CompactInfo {
 
346
        // A compact child that needs to be collapsed into the margin of the following block.
 
347
        RenderObject* m_compact;
 
348
 
 
349
        // The block with the open margin that the compact child is going to place itself within.
 
350
        RenderObject* m_block;
 
351
 
 
352
    public:
 
353
        RenderObject* compact() const { return m_compact; }
 
354
        RenderObject* block() const { return m_block; }
 
355
        bool matches(RenderObject* child) const { return m_compact && m_block == child; }
 
356
 
 
357
        void clear() { set(0, 0); }
 
358
        void set(RenderObject* c, RenderObject* b) { m_compact = c; m_block = b; }
 
359
 
 
360
        CompactInfo() { clear(); }
 
361
    };
 
362
 
 
363
    class MarginInfo {
 
364
        // Collapsing flags for whether we can collapse our margins with our children's margins.
 
365
        bool m_canCollapseWithChildren : 1;
 
366
        bool m_canCollapseTopWithChildren : 1;
 
367
        bool m_canCollapseBottomWithChildren : 1;
 
368
 
 
369
        // Whether or not we are a quirky container, i.e., do we collapse away top and bottom
 
370
        // margins in our container.  Table cells and the body are the common examples. We
 
371
        // also have a custom style property for Safari RSS to deal with TypePad blog articles.
 
372
        bool m_quirkContainer : 1;
 
373
 
 
374
        // This flag tracks whether we are still looking at child margins that can all collapse together at the beginning of a block.  
 
375
        // They may or may not collapse with the top margin of the block (|m_canCollapseTopWithChildren| tells us that), but they will
 
376
        // always be collapsing with one another.  This variable can remain set to true through multiple iterations 
 
377
        // as long as we keep encountering self-collapsing blocks.
 
378
        bool m_atTopOfBlock : 1;
 
379
 
 
380
        // This flag is set when we know we're examining bottom margins and we know we're at the bottom of the block.
 
381
        bool m_atBottomOfBlock : 1;
 
382
 
 
383
        // If our last normal flow child was a self-collapsing block that cleared a float,
 
384
        // we track it in this variable.
 
385
        bool m_selfCollapsingBlockClearedFloat : 1;
 
386
 
 
387
        // These variables are used to detect quirky margins that we need to collapse away (in table cells
 
388
        // and in the body element).
 
389
        bool m_topQuirk : 1;
 
390
        bool m_bottomQuirk : 1;
 
391
        bool m_determinedTopQuirk : 1;
 
392
 
 
393
        // These flags track the previous maximal positive and negative margins.
 
394
        int m_posMargin;
 
395
        int m_negMargin;
 
396
 
 
397
    public:
 
398
        MarginInfo(RenderBlock* b, int top, int bottom);
 
399
 
 
400
        void setAtTopOfBlock(bool b) { m_atTopOfBlock = b; }
 
401
        void setAtBottomOfBlock(bool b) { m_atBottomOfBlock = b; }
 
402
        void clearMargin() { m_posMargin = m_negMargin = 0; }
 
403
        void setSelfCollapsingBlockClearedFloat(bool b) { m_selfCollapsingBlockClearedFloat = b; }
 
404
        void setTopQuirk(bool b) { m_topQuirk = b; }
 
405
        void setBottomQuirk(bool b) { m_bottomQuirk = b; }
 
406
        void setDeterminedTopQuirk(bool b) { m_determinedTopQuirk = b; }
 
407
        void setPosMargin(int p) { m_posMargin = p; }
 
408
        void setNegMargin(int n) { m_negMargin = n; }
 
409
        void setPosMarginIfLarger(int p) { if (p > m_posMargin) m_posMargin = p; }
 
410
        void setNegMarginIfLarger(int n) { if (n > m_negMargin) m_negMargin = n; }
 
411
 
 
412
        void setMargin(int p, int n) { m_posMargin = p; m_negMargin = n; }
 
413
 
 
414
        bool atTopOfBlock() const { return m_atTopOfBlock; }
 
415
        bool canCollapseWithTop() const { return m_atTopOfBlock && m_canCollapseTopWithChildren; }
 
416
        bool canCollapseWithBottom() const { return m_atBottomOfBlock && m_canCollapseBottomWithChildren; }
 
417
        bool canCollapseTopWithChildren() const { return m_canCollapseTopWithChildren; }
 
418
        bool canCollapseBottomWithChildren() const { return m_canCollapseBottomWithChildren; }
 
419
        bool selfCollapsingBlockClearedFloat() const { return m_selfCollapsingBlockClearedFloat; }
 
420
        bool quirkContainer() const { return m_quirkContainer; }
 
421
        bool determinedTopQuirk() const { return m_determinedTopQuirk; }
 
422
        bool topQuirk() const { return m_topQuirk; }
 
423
        bool bottomQuirk() const { return m_bottomQuirk; }
 
424
        int posMargin() const { return m_posMargin; }
 
425
        int negMargin() const { return m_negMargin; }
 
426
        int margin() const { return m_posMargin - m_negMargin; }
 
427
    };
 
428
 
 
429
    void adjustPositionedBlock(RenderObject* child, const MarginInfo&);
 
430
    void adjustFloatingBlock(const MarginInfo&);
 
431
    RenderObject* handleSpecialChild(RenderObject* child, const MarginInfo&, CompactInfo&, bool& handled);
 
432
    RenderObject* handleFloatingChild(RenderObject* child, const MarginInfo&, bool& handled);
 
433
    RenderObject* handlePositionedChild(RenderObject* child, const MarginInfo&, bool& handled);
 
434
    RenderObject* handleCompactChild(RenderObject* child, CompactInfo&, bool& handled);
 
435
    RenderObject* handleRunInChild(RenderObject* child, bool& handled);
 
436
    void collapseMargins(RenderObject* child, MarginInfo&, int yPosEstimate);
 
437
    void clearFloatsIfNeeded(RenderObject* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin);
 
438
    void insertCompactIfNeeded(RenderObject* child, CompactInfo&);
 
439
    int estimateVerticalPosition(RenderObject* child, const MarginInfo&);
 
440
    void determineHorizontalPosition(RenderObject* child);
 
441
    void handleBottomOfBlock(int top, int bottom, MarginInfo&);
 
442
    void setCollapsedBottomMargin(const MarginInfo&);
 
443
    // End helper functions and structs used by layoutBlockChildren.
 
444
 
 
445
private:
 
446
    DeprecatedPtrList<FloatingObject>* m_floatingObjects;
 
447
    DeprecatedPtrList<RenderObject>* m_positionedObjects;
 
448
         
 
449
     // Allocated only when some of these fields have non-default values
 
450
     struct MaxMargin {
 
451
         MaxMargin(const RenderBlock* o) 
 
452
             : m_topPos(topPosDefault(o))
 
453
             , m_topNeg(topNegDefault(o))
 
454
             , m_bottomPos(bottomPosDefault(o))
 
455
             , m_bottomNeg(bottomNegDefault(o))
 
456
             { 
 
457
             }
 
458
         static int topPosDefault(const RenderBlock* o) { return o->marginTop() > 0 ? o->marginTop() : 0; }
 
459
         static int topNegDefault(const RenderBlock* o) { return o->marginTop() < 0 ? -o->marginTop() : 0; }
 
460
         static int bottomPosDefault(const RenderBlock* o) { return o->marginBottom() > 0 ? o->marginBottom() : 0; }
 
461
         static int bottomNegDefault(const RenderBlock* o) { return o->marginBottom() < 0 ? -o->marginBottom() : 0; }
 
462
         
 
463
         int m_topPos;
 
464
         int m_topNeg;
 
465
         int m_bottomPos;
 
466
         int m_bottomNeg;
 
467
     };
 
468
 
 
469
    MaxMargin* m_maxMargin;
 
470
 
 
471
protected:
 
472
    // How much content overflows out of our block vertically or horizontally.
 
473
    int m_overflowHeight;
 
474
    int m_overflowWidth;
 
475
    int m_overflowLeft;
 
476
    int m_overflowTop;
 
477
};
 
478
 
 
479
} // namespace WebCore
 
480
 
 
481
#endif // RenderBlock_h