OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 typedef WTF::HashMap<const LayoutBlock*, OwnPtr<TrackedLayoutBoxListHashSet>> Tr ackedDescendantsMap; | 46 typedef WTF::HashMap<const LayoutBlock*, OwnPtr<TrackedLayoutBoxListHashSet>> Tr ackedDescendantsMap; |
47 typedef WTF::HashMap<const LayoutBox*, OwnPtr<HashSet<LayoutBlock*>>> TrackedCon tainerMap; | 47 typedef WTF::HashMap<const LayoutBox*, OwnPtr<HashSet<LayoutBlock*>>> TrackedCon tainerMap; |
48 typedef Vector<WordMeasurement, 64> WordMeasurements; | 48 typedef Vector<WordMeasurement, 64> WordMeasurements; |
49 | 49 |
50 enum ContainingBlockState { NewContainingBlock, SameContainingBlock }; | 50 enum ContainingBlockState { NewContainingBlock, SameContainingBlock }; |
51 | 51 |
52 typedef WTF::HashMap<LayoutBlock*, OwnPtr<ListHashSet<LayoutInline*>>> Continuat ionOutlineTableMap; | 52 typedef WTF::HashMap<LayoutBlock*, OwnPtr<ListHashSet<LayoutInline*>>> Continuat ionOutlineTableMap; |
53 | 53 |
54 ContinuationOutlineTableMap* continuationOutlineTable(); | 54 ContinuationOutlineTableMap* continuationOutlineTable(); |
55 | 55 |
56 // LayoutBlock is the class that is used by any LayoutObject | |
57 // that is a containing block. | |
58 // http://www.w3.org/TR/CSS2/visuren.html#containing-block | |
wkorman
2015/08/28 22:01:17
What's the best spec to link to in general, for my
| |
59 // See also LayoutObject::containingBlock() that is the | |
60 // function used to get the containing block of a LayoutObject. | |
61 // | |
62 // Containing blocks are a central concept for layout, in | |
63 // particular to the layout of out-of-flow positioned | |
64 // elements. They are used to determine the sizing as well | |
65 // as the positioning of the LayoutObjects. | |
66 // | |
67 // Out-of-flow positioned elements are laid out by their | |
68 // containing blocks so LayoutBlock keeps track of them | |
69 // through |gPositionedDescendantsMap| (see LayoutBlock.cpp). | |
70 // See LayoutBlock::layoutPositionedObjects() for the logic | |
71 // to lay them out. | |
72 // | |
73 // | |
74 // ***** HANDLING OUT-OF-FLOW POSITIONED OBJECTS ***** | |
75 // Care should be taken to handle out-of-flow positioned objects during | |
76 // certain tree walks (e.g. layout()). The rule is that anything that | |
77 // cares about containing blocks should skip the out-of-flow elements | |
78 // in the normal tree walk and do an optional follow-up pass for them | |
79 // using LayoutBlock::positionedObjects(). | |
80 // Not doing so will result in passing the wrong containing | |
81 // block as tree walks will always pass the parent as the | |
82 // containing block. | |
83 // | |
84 // Sample code of how to handle positioned objects in LayoutBlock: | |
85 // | |
86 // for (LayoutObject* child = firstChild(); child; child = child->nextSibling()) { | |
87 // if (child->isOutOfFlowPositioned()) | |
88 // continue; | |
89 // | |
90 // // Handle normal flow children. | |
91 // ... | |
92 // } | |
93 // for (LayoutObject positionedObject : positionedObjects()) { | |
94 // // Handle out-of-flow positioned objects. | |
95 // ... | |
96 // } | |
56 class CORE_EXPORT LayoutBlock : public LayoutBox { | 97 class CORE_EXPORT LayoutBlock : public LayoutBox { |
57 public: | 98 public: |
58 friend class LineLayoutState; | 99 friend class LineLayoutState; |
59 | 100 |
60 protected: | 101 protected: |
61 explicit LayoutBlock(ContainerNode*); | 102 explicit LayoutBlock(ContainerNode*); |
62 ~LayoutBlock() override; | 103 ~LayoutBlock() override; |
63 | 104 |
64 public: | 105 public: |
65 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); } | 106 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); } |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 // FIXME: This is temporary as we move code that accesses block flow | 471 // FIXME: This is temporary as we move code that accesses block flow |
431 // member variables out of LayoutBlock and into LayoutBlockFlow. | 472 // member variables out of LayoutBlock and into LayoutBlockFlow. |
432 friend class LayoutBlockFlow; | 473 friend class LayoutBlockFlow; |
433 }; | 474 }; |
434 | 475 |
435 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlock, isLayoutBlock()); | 476 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlock, isLayoutBlock()); |
436 | 477 |
437 } // namespace blink | 478 } // namespace blink |
438 | 479 |
439 #endif // LayoutBlock_h | 480 #endif // LayoutBlock_h |
OLD | NEW |