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-2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * Copyright (C) 2013 Google Inc. All rights reserved. | 7 * Copyright (C) 2013 Google Inc. All rights reserved. |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions are | 10 * modification, are permitted provided that the following conditions are |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las
tLogicalRight, | 211 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las
tLogicalRight, |
212 const PaintInfo* = nullptr, ClipScope* = nullptr) const; | 212 const PaintInfo* = nullptr, ClipScope* = nullptr) const; |
213 GapRects inlineSelectionGaps(const LayoutBlock* rootBlock, const LayoutPoint
& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, | 213 GapRects inlineSelectionGaps(const LayoutBlock* rootBlock, const LayoutPoint
& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, |
214 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las
tLogicalRight, const PaintInfo*) const; | 214 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las
tLogicalRight, const PaintInfo*) const; |
215 GapRects blockSelectionGaps(const LayoutBlock* rootBlock, const LayoutPoint&
rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, | 215 GapRects blockSelectionGaps(const LayoutBlock* rootBlock, const LayoutPoint&
rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, |
216 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las
tLogicalRight, const PaintInfo*) const; | 216 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las
tLogicalRight, const PaintInfo*) const; |
217 LayoutRect blockSelectionGap(const LayoutBlock* rootBlock, const LayoutPoint
& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, | 217 LayoutRect blockSelectionGap(const LayoutBlock* rootBlock, const LayoutPoint
& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, |
218 LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLo
gicalRight, LayoutUnit logicalBottom, const PaintInfo*) const; | 218 LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLo
gicalRight, LayoutUnit logicalBottom, const PaintInfo*) const; |
219 | 219 |
220 bool allowsPaginationStrut() const; | 220 bool allowsPaginationStrut() const; |
221 LayoutUnit paginationStrut() const { return m_rareData ? m_rareData->m_pagin
ationStrut : LayoutUnit(); } | 221 // Pagination strut caused by the first line or child block inside this bloc
k-level object. |
222 void setPaginationStrut(LayoutUnit); | 222 // |
| 223 // When the first piece of content (first child block or line) inside an obj
ect wants to insert |
| 224 // a soft page or column break, rather than setting a pagination strut on it
self it normally |
| 225 // propagates the strut to its containing block (|this|), as long as our imp
lementation can |
| 226 // handle it. The idea is that we want to push the entire object to the next
page or column |
| 227 // along with the child content that caused the break, instead of leaving un
usable space at the |
| 228 // beginning of the object at the end of one column or page and just push th
e first line or |
| 229 // block to the next column or page. That would waste space in the container
for no good |
| 230 // reason, and it would also be a spec violation, since there is no break op
portunity defined |
| 231 // between the content logical top of an object and its first child or line
(only *between* |
| 232 // blocks or lines). |
| 233 LayoutUnit paginationStrutPropagatedFromChild() const { return m_rareData ?
m_rareData->m_paginationStrutPropagatedFromChild : LayoutUnit(); } |
| 234 void setPaginationStrutPropagatedFromChild(LayoutUnit); |
223 | 235 |
224 void positionSpannerDescendant(LayoutMultiColumnSpannerPlaceholder& child); | 236 void positionSpannerDescendant(LayoutMultiColumnSpannerPlaceholder& child); |
225 | 237 |
226 bool avoidsFloats() const override; | 238 bool avoidsFloats() const override; |
227 | 239 |
228 using LayoutBoxModelObject::moveChildrenTo; | 240 using LayoutBoxModelObject::moveChildrenTo; |
229 void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, LayoutObject* st
artChild, LayoutObject* endChild, LayoutObject* beforeChild, bool fullRemoveInse
rt = false) override; | 241 void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, LayoutObject* st
artChild, LayoutObject* endChild, LayoutObject* beforeChild, bool fullRemoveInse
rt = false) override; |
230 | 242 |
231 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject& child) con
st | 243 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject& child) con
st |
232 { | 244 { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 LayoutUnit m_negativeMarginAfter; | 427 LayoutUnit m_negativeMarginAfter; |
416 }; | 428 }; |
417 MarginValues marginValuesForChild(LayoutBox& child) const; | 429 MarginValues marginValuesForChild(LayoutBox& child) const; |
418 | 430 |
419 // Allocated only when some of these fields have non-default values | 431 // Allocated only when some of these fields have non-default values |
420 struct LayoutBlockFlowRareData { | 432 struct LayoutBlockFlowRareData { |
421 WTF_MAKE_NONCOPYABLE(LayoutBlockFlowRareData); WTF_MAKE_FAST_ALLOCATED(L
ayoutBlockFlowRareData); | 433 WTF_MAKE_NONCOPYABLE(LayoutBlockFlowRareData); WTF_MAKE_FAST_ALLOCATED(L
ayoutBlockFlowRareData); |
422 public: | 434 public: |
423 LayoutBlockFlowRareData(const LayoutBlockFlow* block) | 435 LayoutBlockFlowRareData(const LayoutBlockFlow* block) |
424 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore
Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl
ock)) | 436 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore
Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl
ock)) |
425 , m_paginationStrut(0) | |
426 , m_multiColumnFlowThread(nullptr) | 437 , m_multiColumnFlowThread(nullptr) |
427 , m_lineBreakToAvoidWidow(-1) | 438 , m_lineBreakToAvoidWidow(-1) |
428 , m_didBreakAtLineToAvoidWidow(false) | 439 , m_didBreakAtLineToAvoidWidow(false) |
429 , m_discardMarginBefore(false) | 440 , m_discardMarginBefore(false) |
430 , m_discardMarginAfter(false) | 441 , m_discardMarginAfter(false) |
431 { | 442 { |
432 } | 443 } |
433 | 444 |
434 static LayoutUnit positiveMarginBeforeDefault(const LayoutBlockFlow* blo
ck) | 445 static LayoutUnit positiveMarginBeforeDefault(const LayoutBlockFlow* blo
ck) |
435 { | 446 { |
436 return std::max<LayoutUnit>(block->marginBefore(), 0); | 447 return std::max<LayoutUnit>(block->marginBefore(), 0); |
437 } | 448 } |
438 static LayoutUnit negativeMarginBeforeDefault(const LayoutBlockFlow* blo
ck) | 449 static LayoutUnit negativeMarginBeforeDefault(const LayoutBlockFlow* blo
ck) |
439 { | 450 { |
440 return std::max<LayoutUnit>(-block->marginBefore(), 0); | 451 return std::max<LayoutUnit>(-block->marginBefore(), 0); |
441 } | 452 } |
442 static LayoutUnit positiveMarginAfterDefault(const LayoutBlockFlow* bloc
k) | 453 static LayoutUnit positiveMarginAfterDefault(const LayoutBlockFlow* bloc
k) |
443 { | 454 { |
444 return std::max<LayoutUnit>(block->marginAfter(), 0); | 455 return std::max<LayoutUnit>(block->marginAfter(), 0); |
445 } | 456 } |
446 static LayoutUnit negativeMarginAfterDefault(const LayoutBlockFlow* bloc
k) | 457 static LayoutUnit negativeMarginAfterDefault(const LayoutBlockFlow* bloc
k) |
447 { | 458 { |
448 return std::max<LayoutUnit>(-block->marginAfter(), 0); | 459 return std::max<LayoutUnit>(-block->marginAfter(), 0); |
449 } | 460 } |
450 | 461 |
451 MarginValues m_margins; | 462 MarginValues m_margins; |
452 LayoutUnit m_paginationStrut; | 463 LayoutUnit m_paginationStrutPropagatedFromChild; |
453 | 464 |
454 LayoutMultiColumnFlowThread* m_multiColumnFlowThread; | 465 LayoutMultiColumnFlowThread* m_multiColumnFlowThread; |
455 | 466 |
456 int m_lineBreakToAvoidWidow; | 467 int m_lineBreakToAvoidWidow; |
457 bool m_didBreakAtLineToAvoidWidow : 1; | 468 bool m_didBreakAtLineToAvoidWidow : 1; |
458 bool m_discardMarginBefore : 1; | 469 bool m_discardMarginBefore : 1; |
459 bool m_discardMarginAfter : 1; | 470 bool m_discardMarginAfter : 1; |
460 }; | 471 }; |
461 | 472 |
462 const FloatingObjects* floatingObjects() const { return m_floatingObjects.ge
t(); } | 473 const FloatingObjects* floatingObjects() const { return m_floatingObjects.ge
t(); } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 579 |
569 // END METHODS DEFINED IN LayoutBlockFlowLine | 580 // END METHODS DEFINED IN LayoutBlockFlowLine |
570 | 581 |
571 }; | 582 }; |
572 | 583 |
573 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); | 584 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); |
574 | 585 |
575 } // namespace blink | 586 } // namespace blink |
576 | 587 |
577 #endif // LayoutBlockFlow_h | 588 #endif // LayoutBlockFlow_h |
OLD | NEW |