Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 34 */ | 34 */ |
| 35 | 35 |
| 36 #ifndef LayoutBlockFlow_h | 36 #ifndef LayoutBlockFlow_h |
| 37 #define LayoutBlockFlow_h | 37 #define LayoutBlockFlow_h |
| 38 | 38 |
| 39 #include <memory> | |
| 39 #include "core/CoreExport.h" | 40 #include "core/CoreExport.h" |
| 40 #include "core/layout/FloatingObjects.h" | 41 #include "core/layout/FloatingObjects.h" |
| 41 #include "core/layout/LayoutBlock.h" | 42 #include "core/layout/LayoutBlock.h" |
| 42 #include "core/layout/api/LineLayoutItem.h" | 43 #include "core/layout/api/LineLayoutItem.h" |
| 43 #include "core/layout/line/LineBoxList.h" | 44 #include "core/layout/line/LineBoxList.h" |
| 44 #include "core/layout/line/RootInlineBox.h" | 45 #include "core/layout/line/RootInlineBox.h" |
| 45 #include "core/layout/line/TrailingObjects.h" | 46 #include "core/layout/line/TrailingObjects.h" |
| 46 #include <memory> | 47 #include "core/layout/ng/inline/ng_inline_node_data.h" |
| 47 | 48 |
| 48 namespace blink { | 49 namespace blink { |
| 49 | 50 |
| 50 class BlockChildrenLayoutInfo; | 51 class BlockChildrenLayoutInfo; |
| 51 class MarginInfo; | 52 class MarginInfo; |
| 52 class LayoutInline; | 53 class LayoutInline; |
| 53 class LineInfo; | 54 class LineInfo; |
| 54 class LineLayoutState; | 55 class LineLayoutState; |
| 55 class LineWidth; | 56 class LineWidth; |
| 56 class LayoutMultiColumnFlowThread; | 57 class LayoutMultiColumnFlowThread; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 } | 277 } |
| 277 | 278 |
| 278 LayoutMultiColumnFlowThread* MultiColumnFlowThread() const { | 279 LayoutMultiColumnFlowThread* MultiColumnFlowThread() const { |
| 279 return rare_data_ ? rare_data_->multi_column_flow_thread_ : 0; | 280 return rare_data_ ? rare_data_->multi_column_flow_thread_ : 0; |
| 280 } | 281 } |
| 281 void ResetMultiColumnFlowThread() { | 282 void ResetMultiColumnFlowThread() { |
| 282 if (rare_data_) | 283 if (rare_data_) |
| 283 rare_data_->multi_column_flow_thread_ = nullptr; | 284 rare_data_->multi_column_flow_thread_ = nullptr; |
| 284 } | 285 } |
| 285 | 286 |
| 287 NGInlineNodeData& GetNGInlineNodeData() const { | |
| 288 DCHECK(rare_data_); | |
| 289 DCHECK(rare_data_->ng_inline_node_data_); | |
| 290 return *rare_data_->ng_inline_node_data_.get(); | |
| 291 } | |
| 292 | |
| 293 void InitNGInlineNodeData() { | |
| 294 LayoutBlockFlowRareData& rare_data = EnsureRareData(); | |
| 295 if (!rare_data.ng_inline_node_data_) | |
| 296 rare_data.ng_inline_node_data_ = WTF::WrapUnique(new NGInlineNodeData); | |
|
kojii
2017/04/26 02:21:17
nit: MakeUnique()?
https://sites.google.com/a/chro
ikilpatrick
2017/05/01 20:46:34
Done.
| |
| 297 } | |
| 298 | |
| 286 void AddOverflowFromInlineChildren(); | 299 void AddOverflowFromInlineChildren(); |
| 287 | 300 |
| 288 // FIXME: This should be const to avoid a const_cast, but can modify child | 301 // FIXME: This should be const to avoid a const_cast, but can modify child |
| 289 // dirty bits and LayoutTextCombine. | 302 // dirty bits and LayoutTextCombine. |
| 290 void ComputeInlinePreferredLogicalWidths(LayoutUnit& min_logical_width, | 303 void ComputeInlinePreferredLogicalWidths(LayoutUnit& min_logical_width, |
| 291 LayoutUnit& max_logical_width); | 304 LayoutUnit& max_logical_width); |
| 292 | 305 |
| 293 bool AllowsPaginationStrut() const; | 306 bool AllowsPaginationStrut() const; |
| 294 // Pagination strut caused by the first line or child block inside this | 307 // Pagination strut caused by the first line or child block inside this |
| 295 // block-level object. | 308 // block-level object. |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 WTF_MAKE_NONCOPYABLE(LayoutBlockFlowRareData); | 703 WTF_MAKE_NONCOPYABLE(LayoutBlockFlowRareData); |
| 691 USING_FAST_MALLOC(LayoutBlockFlowRareData); | 704 USING_FAST_MALLOC(LayoutBlockFlowRareData); |
| 692 | 705 |
| 693 public: | 706 public: |
| 694 LayoutBlockFlowRareData(const LayoutBlockFlow* block) | 707 LayoutBlockFlowRareData(const LayoutBlockFlow* block) |
| 695 : margins_(PositiveMarginBeforeDefault(block), | 708 : margins_(PositiveMarginBeforeDefault(block), |
| 696 NegativeMarginBeforeDefault(block), | 709 NegativeMarginBeforeDefault(block), |
| 697 PositiveMarginAfterDefault(block), | 710 PositiveMarginAfterDefault(block), |
| 698 NegativeMarginAfterDefault(block)), | 711 NegativeMarginAfterDefault(block)), |
| 699 multi_column_flow_thread_(nullptr), | 712 multi_column_flow_thread_(nullptr), |
| 713 ng_inline_node_data_(nullptr), | |
| 700 break_before_(static_cast<unsigned>(EBreakBetween::kAuto)), | 714 break_before_(static_cast<unsigned>(EBreakBetween::kAuto)), |
| 701 break_after_(static_cast<unsigned>(EBreakBetween::kAuto)), | 715 break_after_(static_cast<unsigned>(EBreakBetween::kAuto)), |
| 702 line_break_to_avoid_widow_(-1), | 716 line_break_to_avoid_widow_(-1), |
| 703 did_break_at_line_to_avoid_widow_(false), | 717 did_break_at_line_to_avoid_widow_(false), |
| 704 discard_margin_before_(false), | 718 discard_margin_before_(false), |
| 705 discard_margin_after_(false) {} | 719 discard_margin_after_(false) {} |
| 706 | 720 |
| 707 static LayoutUnit PositiveMarginBeforeDefault( | 721 static LayoutUnit PositiveMarginBeforeDefault( |
| 708 const LayoutBlockFlow* block) { | 722 const LayoutBlockFlow* block) { |
| 709 return block->MarginBefore().ClampNegativeToZero(); | 723 return block->MarginBefore().ClampNegativeToZero(); |
| 710 } | 724 } |
| 711 static LayoutUnit NegativeMarginBeforeDefault( | 725 static LayoutUnit NegativeMarginBeforeDefault( |
| 712 const LayoutBlockFlow* block) { | 726 const LayoutBlockFlow* block) { |
| 713 return (-block->MarginBefore()).ClampNegativeToZero(); | 727 return (-block->MarginBefore()).ClampNegativeToZero(); |
| 714 } | 728 } |
| 715 static LayoutUnit PositiveMarginAfterDefault(const LayoutBlockFlow* block) { | 729 static LayoutUnit PositiveMarginAfterDefault(const LayoutBlockFlow* block) { |
| 716 return block->MarginAfter().ClampNegativeToZero(); | 730 return block->MarginAfter().ClampNegativeToZero(); |
| 717 } | 731 } |
| 718 static LayoutUnit NegativeMarginAfterDefault(const LayoutBlockFlow* block) { | 732 static LayoutUnit NegativeMarginAfterDefault(const LayoutBlockFlow* block) { |
| 719 return (-block->MarginAfter()).ClampNegativeToZero(); | 733 return (-block->MarginAfter()).ClampNegativeToZero(); |
| 720 } | 734 } |
| 721 | 735 |
| 722 MarginValues margins_; | 736 MarginValues margins_; |
| 723 LayoutUnit pagination_strut_propagated_from_child_; | 737 LayoutUnit pagination_strut_propagated_from_child_; |
| 724 | 738 |
| 725 LayoutUnit first_forced_break_offset_; | 739 LayoutUnit first_forced_break_offset_; |
| 726 | 740 |
| 727 LayoutMultiColumnFlowThread* multi_column_flow_thread_; | 741 LayoutMultiColumnFlowThread* multi_column_flow_thread_; |
| 742 std::unique_ptr<NGInlineNodeData> ng_inline_node_data_; | |
| 728 | 743 |
| 729 unsigned break_before_ : 4; | 744 unsigned break_before_ : 4; |
| 730 unsigned break_after_ : 4; | 745 unsigned break_after_ : 4; |
| 731 int line_break_to_avoid_widow_; | 746 int line_break_to_avoid_widow_; |
| 732 bool did_break_at_line_to_avoid_widow_ : 1; | 747 bool did_break_at_line_to_avoid_widow_ : 1; |
| 733 bool discard_margin_before_ : 1; | 748 bool discard_margin_before_ : 1; |
| 734 bool discard_margin_after_ : 1; | 749 bool discard_margin_after_ : 1; |
| 735 }; | 750 }; |
| 736 | 751 |
| 737 const FloatingObjects* GetFloatingObjects() const { | 752 const FloatingObjects* GetFloatingObjects() const { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 974 void PositionDialog(); | 989 void PositionDialog(); |
| 975 | 990 |
| 976 // END METHODS DEFINED IN LayoutBlockFlowLine | 991 // END METHODS DEFINED IN LayoutBlockFlowLine |
| 977 }; | 992 }; |
| 978 | 993 |
| 979 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, IsLayoutBlockFlow()); | 994 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, IsLayoutBlockFlow()); |
| 980 | 995 |
| 981 } // namespace blink | 996 } // namespace blink |
| 982 | 997 |
| 983 #endif // LayoutBlockFlow_h | 998 #endif // LayoutBlockFlow_h |
| OLD | NEW |