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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class LineWidth; | 49 class LineWidth; |
50 class RenderMultiColumnFlowThread; | 50 class RenderMultiColumnFlowThread; |
51 class RenderMultiColumnSpannerPlaceholder; | 51 class RenderMultiColumnSpannerPlaceholder; |
52 class LayoutRubyRun; | 52 class LayoutRubyRun; |
53 template <class Run> class BidiRunList; | 53 template <class Run> class BidiRunList; |
54 | 54 |
55 class RenderBlockFlow : public RenderBlock { | 55 class RenderBlockFlow : public RenderBlock { |
56 public: | 56 public: |
57 explicit RenderBlockFlow(ContainerNode*); | 57 explicit RenderBlockFlow(ContainerNode*); |
58 virtual ~RenderBlockFlow(); | 58 virtual ~RenderBlockFlow(); |
59 virtual void trace(Visitor*) override; | |
60 | 59 |
61 static RenderBlockFlow* createAnonymous(Document*); | 60 static RenderBlockFlow* createAnonymous(Document*); |
62 | 61 |
63 virtual bool isRenderBlockFlow() const override final { return true; } | 62 virtual bool isRenderBlockFlow() const override final { return true; } |
64 | 63 |
65 virtual void layoutBlock(bool relayoutChildren) override; | 64 virtual void layoutBlock(bool relayoutChildren) override; |
66 | 65 |
67 virtual void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFl
oats = false) override; | 66 virtual void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFl
oats = false) override; |
68 | 67 |
69 virtual void deleteLineBoxTree() override final; | 68 virtual void deleteLineBoxTree() override final; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT
ext); | 162 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT
ext); |
164 | 163 |
165 void setStaticInlinePositionForChild(RenderBox&, LayoutUnit inlinePosition); | 164 void setStaticInlinePositionForChild(RenderBox&, LayoutUnit inlinePosition); |
166 void updateStaticInlinePositionForChild(RenderBox&, LayoutUnit logicalTop); | 165 void updateStaticInlinePositionForChild(RenderBox&, LayoutUnit logicalTop); |
167 | 166 |
168 static bool shouldSkipCreatingRunsForObject(RenderObject* obj) | 167 static bool shouldSkipCreatingRunsForObject(RenderObject* obj) |
169 { | 168 { |
170 return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style
()->isOriginalDisplayInlineType() && !obj->container()->isRenderInline()); | 169 return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style
()->isOriginalDisplayInlineType() && !obj->container()->isRenderInline()); |
171 } | 170 } |
172 | 171 |
173 RenderMultiColumnFlowThread* multiColumnFlowThread() const { return m_rareDa
ta ? m_rareData->m_multiColumnFlowThread.get() : 0; } | 172 RenderMultiColumnFlowThread* multiColumnFlowThread() const { return m_rareDa
ta ? m_rareData->m_multiColumnFlowThread : 0; } |
174 void resetMultiColumnFlowThread() | 173 void resetMultiColumnFlowThread() |
175 { | 174 { |
176 if (m_rareData) | 175 if (m_rareData) |
177 m_rareData->m_multiColumnFlowThread = nullptr; | 176 m_rareData->m_multiColumnFlowThread = nullptr; |
178 } | 177 } |
179 | 178 |
180 void addOverflowFromInlineChildren(); | 179 void addOverflowFromInlineChildren(); |
181 | 180 |
182 // FIXME: This should be const to avoid a const_cast, but can modify child d
irty bits and RenderCombineText | 181 // FIXME: This should be const to avoid a const_cast, but can modify child d
irty bits and RenderCombineText |
183 void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, Layout
Unit& maxLogicalWidth); | 182 void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, Layout
Unit& maxLogicalWidth); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 377 |
379 private: | 378 private: |
380 LayoutUnit m_positiveMarginBefore; | 379 LayoutUnit m_positiveMarginBefore; |
381 LayoutUnit m_negativeMarginBefore; | 380 LayoutUnit m_negativeMarginBefore; |
382 LayoutUnit m_positiveMarginAfter; | 381 LayoutUnit m_positiveMarginAfter; |
383 LayoutUnit m_negativeMarginAfter; | 382 LayoutUnit m_negativeMarginAfter; |
384 }; | 383 }; |
385 MarginValues marginValuesForChild(RenderBox& child) const; | 384 MarginValues marginValuesForChild(RenderBox& child) const; |
386 | 385 |
387 // Allocated only when some of these fields have non-default values | 386 // Allocated only when some of these fields have non-default values |
388 struct RenderBlockFlowRareData : public NoBaseWillBeGarbageCollected<RenderB
lockFlowRareData> { | 387 struct RenderBlockFlowRareData { |
389 WTF_MAKE_NONCOPYABLE(RenderBlockFlowRareData); WTF_MAKE_FAST_ALLOCATED_W
ILL_BE_REMOVED; | 388 WTF_MAKE_NONCOPYABLE(RenderBlockFlowRareData); WTF_MAKE_FAST_ALLOCATED; |
390 public: | 389 public: |
391 RenderBlockFlowRareData(const RenderBlockFlow* block) | 390 RenderBlockFlowRareData(const RenderBlockFlow* block) |
392 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore
Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl
ock)) | 391 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore
Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl
ock)) |
393 , m_paginationStrut(0) | 392 , m_paginationStrut(0) |
394 , m_multiColumnFlowThread(nullptr) | 393 , m_multiColumnFlowThread(nullptr) |
395 , m_lineBreakToAvoidWidow(-1) | 394 , m_lineBreakToAvoidWidow(-1) |
396 , m_didBreakAtLineToAvoidWidow(false) | 395 , m_didBreakAtLineToAvoidWidow(false) |
397 , m_discardMarginBefore(false) | 396 , m_discardMarginBefore(false) |
398 , m_discardMarginAfter(false) | 397 , m_discardMarginAfter(false) |
399 { | 398 { |
400 } | 399 } |
401 void trace(Visitor*); | |
402 | 400 |
403 static LayoutUnit positiveMarginBeforeDefault(const RenderBlockFlow* blo
ck) | 401 static LayoutUnit positiveMarginBeforeDefault(const RenderBlockFlow* blo
ck) |
404 { | 402 { |
405 return std::max<LayoutUnit>(block->marginBefore(), 0); | 403 return std::max<LayoutUnit>(block->marginBefore(), 0); |
406 } | 404 } |
407 static LayoutUnit negativeMarginBeforeDefault(const RenderBlockFlow* blo
ck) | 405 static LayoutUnit negativeMarginBeforeDefault(const RenderBlockFlow* blo
ck) |
408 { | 406 { |
409 return std::max<LayoutUnit>(-block->marginBefore(), 0); | 407 return std::max<LayoutUnit>(-block->marginBefore(), 0); |
410 } | 408 } |
411 static LayoutUnit positiveMarginAfterDefault(const RenderBlockFlow* bloc
k) | 409 static LayoutUnit positiveMarginAfterDefault(const RenderBlockFlow* bloc
k) |
412 { | 410 { |
413 return std::max<LayoutUnit>(block->marginAfter(), 0); | 411 return std::max<LayoutUnit>(block->marginAfter(), 0); |
414 } | 412 } |
415 static LayoutUnit negativeMarginAfterDefault(const RenderBlockFlow* bloc
k) | 413 static LayoutUnit negativeMarginAfterDefault(const RenderBlockFlow* bloc
k) |
416 { | 414 { |
417 return std::max<LayoutUnit>(-block->marginAfter(), 0); | 415 return std::max<LayoutUnit>(-block->marginAfter(), 0); |
418 } | 416 } |
419 | 417 |
420 MarginValues m_margins; | 418 MarginValues m_margins; |
421 LayoutUnit m_paginationStrut; | 419 LayoutUnit m_paginationStrut; |
422 | 420 |
423 RawPtrWillBeMember<RenderMultiColumnFlowThread> m_multiColumnFlowThread; | 421 RenderMultiColumnFlowThread* m_multiColumnFlowThread; |
424 | 422 |
425 int m_lineBreakToAvoidWidow; | 423 int m_lineBreakToAvoidWidow; |
426 bool m_didBreakAtLineToAvoidWidow : 1; | 424 bool m_didBreakAtLineToAvoidWidow : 1; |
427 bool m_discardMarginBefore : 1; | 425 bool m_discardMarginBefore : 1; |
428 bool m_discardMarginAfter : 1; | 426 bool m_discardMarginAfter : 1; |
429 }; | 427 }; |
430 LayoutUnit marginOffsetForSelfCollapsingBlock(); | 428 LayoutUnit marginOffsetForSelfCollapsingBlock(); |
431 | 429 |
432 FloatingObjects* floatingObjects() { return m_floatingObjects.get(); } | 430 FloatingObjects* floatingObjects() { return m_floatingObjects.get(); } |
433 | 431 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 static bool s_canPropagateFloatIntoSibling; | 487 static bool s_canPropagateFloatIntoSibling; |
490 | 488 |
491 RenderBlockFlowRareData& ensureRareData(); | 489 RenderBlockFlowRareData& ensureRareData(); |
492 | 490 |
493 LayoutUnit m_paintInvalidationLogicalTop; | 491 LayoutUnit m_paintInvalidationLogicalTop; |
494 LayoutUnit m_paintInvalidationLogicalBottom; | 492 LayoutUnit m_paintInvalidationLogicalBottom; |
495 | 493 |
496 virtual bool isSelfCollapsingBlock() const override; | 494 virtual bool isSelfCollapsingBlock() const override; |
497 | 495 |
498 protected: | 496 protected: |
499 OwnPtrWillBeMember<RenderBlockFlowRareData> m_rareData; | 497 OwnPtr<RenderBlockFlowRareData> m_rareData; |
500 OwnPtr<FloatingObjects> m_floatingObjects; | 498 OwnPtr<FloatingObjects> m_floatingObjects; |
501 | 499 |
502 friend class BreakingContext; // FIXME: It uses insertFloatingObject and pos
itionNewFloatOnLine, if we move those out from the private scope/add a helper to
LineBreaker, we can remove this friend | 500 friend class BreakingContext; // FIXME: It uses insertFloatingObject and pos
itionNewFloatOnLine, if we move those out from the private scope/add a helper to
LineBreaker, we can remove this friend |
503 friend class MarginInfo; | 501 friend class MarginInfo; |
504 friend class LineBreaker; | 502 friend class LineBreaker; |
505 friend class LineWidth; // needs to know FloatingObject | 503 friend class LineWidth; // needs to know FloatingObject |
506 | 504 |
507 // FIXME-BLOCKFLOW: These methods have implementations in | 505 // FIXME-BLOCKFLOW: These methods have implementations in |
508 // RenderBlockLineLayout. They should be moved to the proper header once the | 506 // RenderBlockLineLayout. They should be moved to the proper header once the |
509 // line layout code is separated from RenderBlock and RenderBlockFlow. | 507 // line layout code is separated from RenderBlock and RenderBlockFlow. |
(...skipping 29 matching lines...) Expand all Loading... |
539 | 537 |
540 // END METHODS DEFINED IN RenderBlockLineLayout | 538 // END METHODS DEFINED IN RenderBlockLineLayout |
541 | 539 |
542 }; | 540 }; |
543 | 541 |
544 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow()); | 542 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow()); |
545 | 543 |
546 } // namespace blink | 544 } // namespace blink |
547 | 545 |
548 #endif // RenderBlockFlow_h | 546 #endif // RenderBlockFlow_h |
OLD | NEW |