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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class LineLayoutState; | 40 class LineLayoutState; |
41 struct PaintInfo; | 41 struct PaintInfo; |
42 class LayoutInline; | 42 class LayoutInline; |
43 class WordMeasurement; | 43 class WordMeasurement; |
44 | 44 |
45 typedef WTF::ListHashSet<LayoutBox*, 16> TrackedLayoutBoxListHashSet; | 45 typedef WTF::ListHashSet<LayoutBox*, 16> TrackedLayoutBoxListHashSet; |
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*, LayoutBlock*> TrackedContainerMap; |
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 // LayoutBlock is the class that is used by any LayoutObject | 52 // LayoutBlock is the class that is used by any LayoutObject |
53 // that is a containing block. | 53 // that is a containing block. |
54 // http://www.w3.org/TR/CSS2/visuren.html#containing-block | 54 // http://www.w3.org/TR/CSS2/visuren.html#containing-block |
55 // See also LayoutObject::containingBlock() that is the function | 55 // See also LayoutObject::containingBlock() that is the function |
56 // used to get the containing block of a LayoutObject. | 56 // used to get the containing block of a LayoutObject. |
57 // | 57 // |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nullptr) o
verride; | 153 void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nullptr) o
verride; |
154 void removeChild(LayoutObject*) override; | 154 void removeChild(LayoutObject*) override; |
155 | 155 |
156 virtual void layoutBlock(bool relayoutChildren); | 156 virtual void layoutBlock(bool relayoutChildren); |
157 | 157 |
158 void insertPositionedObject(LayoutBox*); | 158 void insertPositionedObject(LayoutBox*); |
159 static void removePositionedObject(LayoutBox*); | 159 static void removePositionedObject(LayoutBox*); |
160 void removePositionedObjects(LayoutBlock*, ContainingBlockState = SameContai
ningBlock); | 160 void removePositionedObjects(LayoutBlock*, ContainingBlockState = SameContai
ningBlock); |
161 | 161 |
162 TrackedLayoutBoxListHashSet* positionedObjects() const; | 162 TrackedLayoutBoxListHashSet* positionedObjects() const { return hasPositione
dObjects() ? positionedObjectsInternal() : nullptr; } |
163 bool hasPositionedObjects() const | 163 bool hasPositionedObjects() const |
164 { | 164 { |
165 TrackedLayoutBoxListHashSet* objects = positionedObjects(); | 165 ASSERT(m_hasPositionedObjects ? (positionedObjectsInternal() && !positio
nedObjectsInternal()->isEmpty()) : !positionedObjectsInternal()); |
166 return objects && !objects->isEmpty(); | 166 return m_hasPositionedObjects; |
167 } | 167 } |
168 | 168 |
169 void addPercentHeightDescendant(LayoutBox*); | 169 void addPercentHeightDescendant(LayoutBox*); |
170 static void removePercentHeightDescendant(LayoutBox*); | 170 void removePercentHeightDescendant(LayoutBox*); |
171 static bool hasPercentHeightContainerMap(); | 171 bool hasPercentHeightDescendant(LayoutBox* o) const { return hasPercentHeigh
tDescendants() && percentHeightDescendantsInternal()->contains(o); } |
172 static bool hasPercentHeightDescendant(LayoutBox*); | |
173 static void clearPercentHeightDescendantsFrom(LayoutBox*); | |
174 static void removePercentHeightDescendantIfNeeded(LayoutBox*); | |
175 | 172 |
176 TrackedLayoutBoxListHashSet* percentHeightDescendants() const; | 173 TrackedLayoutBoxListHashSet* percentHeightDescendants() const { return hasPe
rcentHeightDescendants() ? percentHeightDescendantsInternal() : nullptr; } |
177 bool hasPercentHeightDescendants() const | 174 bool hasPercentHeightDescendants() const |
178 { | 175 { |
179 TrackedLayoutBoxListHashSet* descendants = percentHeightDescendants(); | 176 ASSERT(m_hasPercentHeightDescendants ? (percentHeightDescendantsInternal
() && !percentHeightDescendantsInternal()->isEmpty()) : !percentHeightDescendant
sInternal()); |
180 return descendants && !descendants->isEmpty(); | 177 return m_hasPercentHeightDescendants; |
181 } | 178 } |
182 | 179 |
183 void notifyScrollbarThicknessChanged() { m_widthAvailableToChildrenChanged =
true; } | 180 void notifyScrollbarThicknessChanged() { m_widthAvailableToChildrenChanged =
true; } |
184 | 181 |
185 void setHasMarkupTruncation(bool b) { m_hasMarkupTruncation = b; } | 182 void setHasMarkupTruncation(bool b) { m_hasMarkupTruncation = b; } |
186 bool hasMarkupTruncation() const { return m_hasMarkupTruncation; } | 183 bool hasMarkupTruncation() const { return m_hasMarkupTruncation; } |
187 | 184 |
188 void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; } | 185 void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; } |
189 void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; } | 186 void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; } |
190 | 187 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 389 |
393 static void collapseAnonymousBlockChild(LayoutBlock* parent, LayoutBlock* ch
ild); | 390 static void collapseAnonymousBlockChild(LayoutBlock* parent, LayoutBlock* ch
ild); |
394 void makeChildrenInlineIfPossible(); | 391 void makeChildrenInlineIfPossible(); |
395 | 392 |
396 void dirtyLinesFromChangedChild(LayoutObject* child) final { m_lineBoxes.dir
tyLinesFromChangedChild(LineLayoutItem(this), LineLayoutItem(child)); } | 393 void dirtyLinesFromChangedChild(LayoutObject* child) final { m_lineBoxes.dir
tyLinesFromChangedChild(LineLayoutItem(this), LineLayoutItem(child)); } |
397 | 394 |
398 void addChildIgnoringContinuation(LayoutObject* newChild, LayoutObject* befo
reChild) override; | 395 void addChildIgnoringContinuation(LayoutObject* newChild, LayoutObject* befo
reChild) override; |
399 | 396 |
400 bool isSelfCollapsingBlock() const override; | 397 bool isSelfCollapsingBlock() const override; |
401 | 398 |
402 void insertIntoTrackedLayoutBoxMaps(LayoutBox* descendant, TrackedDescendant
sMap*&, TrackedContainerMap*&); | 399 TrackedLayoutBoxListHashSet* positionedObjectsInternal() const; |
403 static void removeFromTrackedLayoutBoxMaps(LayoutBox* descendant, TrackedDes
cendantsMap*&, TrackedContainerMap*&); | 400 TrackedLayoutBoxListHashSet* percentHeightDescendantsInternal() const; |
404 | 401 |
405 Node* nodeForHitTest() const; | 402 Node* nodeForHitTest() const; |
406 | 403 |
407 bool tryLayoutDoingPositionedMovementOnly(); | 404 bool tryLayoutDoingPositionedMovementOnly(); |
408 | 405 |
409 bool avoidsFloats() const override { return true; } | 406 bool avoidsFloats() const override { return true; } |
410 | 407 |
411 bool hitTestChildren(HitTestResult&, const HitTestLocation& locationInContai
ner, const LayoutPoint& accumulatedOffset, HitTestAction); | 408 bool hitTestChildren(HitTestResult&, const HitTestLocation& locationInContai
ner, const LayoutPoint& accumulatedOffset, HitTestAction); |
412 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to Layo
utBlockFlow | 409 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to Layo
utBlockFlow |
413 virtual bool hitTestFloats(HitTestResult&, const HitTestLocation&, const Lay
outPoint&) { return false; } | 410 virtual bool hitTestFloats(HitTestResult&, const HitTestLocation&, const Lay
outPoint&) { return false; } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 486 |
490 unsigned m_hasMarginBeforeQuirk : 1; // Note these quirk values can't be put
in LayoutBlockRareData since they are set too frequently. | 487 unsigned m_hasMarginBeforeQuirk : 1; // Note these quirk values can't be put
in LayoutBlockRareData since they are set too frequently. |
491 unsigned m_hasMarginAfterQuirk : 1; | 488 unsigned m_hasMarginAfterQuirk : 1; |
492 unsigned m_beingDestroyed : 1; | 489 unsigned m_beingDestroyed : 1; |
493 unsigned m_hasMarkupTruncation : 1; | 490 unsigned m_hasMarkupTruncation : 1; |
494 unsigned m_widthAvailableToChildrenChanged : 1; | 491 unsigned m_widthAvailableToChildrenChanged : 1; |
495 mutable unsigned m_hasOnlySelfCollapsingChildren : 1; | 492 mutable unsigned m_hasOnlySelfCollapsingChildren : 1; |
496 mutable unsigned m_descendantsWithFloatsMarkedForLayout : 1; | 493 mutable unsigned m_descendantsWithFloatsMarkedForLayout : 1; |
497 mutable unsigned m_needsRecalcLogicalWidthAfterLayoutChildren : 1; | 494 mutable unsigned m_needsRecalcLogicalWidthAfterLayoutChildren : 1; |
498 | 495 |
| 496 unsigned m_hasPositionedObjects : 1; |
| 497 unsigned m_hasPercentHeightDescendants : 1; |
| 498 |
499 // LayoutRubyBase objects need to be able to split and merge, moving their c
hildren around | 499 // LayoutRubyBase objects need to be able to split and merge, moving their c
hildren around |
500 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). | 500 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). |
501 friend class LayoutRubyBase; | 501 friend class LayoutRubyBase; |
502 // FIXME-BLOCKFLOW: Remove this when the line layout stuff has all moved out
of LayoutBlock | 502 // FIXME-BLOCKFLOW: Remove this when the line layout stuff has all moved out
of LayoutBlock |
503 friend class LineBreaker; | 503 friend class LineBreaker; |
504 | 504 |
505 // FIXME: This is temporary as we move code that accesses block flow | 505 // FIXME: This is temporary as we move code that accesses block flow |
506 // member variables out of LayoutBlock and into LayoutBlockFlow. | 506 // member variables out of LayoutBlock and into LayoutBlockFlow. |
507 friend class LayoutBlockFlow; | 507 friend class LayoutBlockFlow; |
508 }; | 508 }; |
509 | 509 |
510 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlock, isLayoutBlock()); | 510 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlock, isLayoutBlock()); |
511 | 511 |
512 } // namespace blink | 512 } // namespace blink |
513 | 513 |
514 #endif // LayoutBlock_h | 514 #endif // LayoutBlock_h |
OLD | NEW |