| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NGBlockNode_h | 5 #ifndef NGBlockNode_h |
| 6 #define NGBlockNode_h | 6 #define NGBlockNode_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/ng_layout_input_node.h" | 9 #include "core/layout/ng/ng_layout_input_node.h" |
| 10 #include "core/layout/ng/ng_physical_box_fragment.h" |
| 10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 class ComputedStyle; | 15 class ComputedStyle; |
| 15 class LayoutBox; | 16 class LayoutBox; |
| 16 class LayoutObject; | 17 class LayoutObject; |
| 18 class NGBreakToken; |
| 17 class NGConstraintSpace; | 19 class NGConstraintSpace; |
| 18 class NGFragment; | 20 class NGFragment; |
| 19 class NGLayoutAlgorithm; | 21 class NGLayoutAlgorithm; |
| 20 class NGLayoutCoordinator; | 22 class NGLayoutCoordinator; |
| 21 class NGPhysicalBoxFragment; | |
| 22 struct MinAndMaxContentSizes; | 23 struct MinAndMaxContentSizes; |
| 23 | 24 |
| 24 // Represents a node to be laid out. | 25 // Represents a node to be laid out. |
| 25 class CORE_EXPORT NGBlockNode final : public NGLayoutInputNode { | 26 class CORE_EXPORT NGBlockNode final : public NGLayoutInputNode { |
| 26 friend NGLayoutInputNode; | 27 friend NGLayoutInputNode; |
| 27 | 28 |
| 28 public: | 29 public: |
| 29 explicit NGBlockNode(LayoutObject*); | 30 explicit NGBlockNode(LayoutObject*); |
| 30 | 31 |
| 31 // TODO(layout-ng): make it private and declare a friend class to use in tests | 32 // TODO(layout-ng): make it private and declare a friend class to use in tests |
| (...skipping 16 matching lines...) Expand all Loading... |
| 48 bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*); | 49 bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*); |
| 49 | 50 |
| 50 const ComputedStyle* Style() const; | 51 const ComputedStyle* Style() const; |
| 51 ComputedStyle* MutableStyle(); | 52 ComputedStyle* MutableStyle(); |
| 52 | 53 |
| 53 NGLayoutInputNode* FirstChild(); | 54 NGLayoutInputNode* FirstChild(); |
| 54 | 55 |
| 55 void SetNextSibling(NGBlockNode*); | 56 void SetNextSibling(NGBlockNode*); |
| 56 void SetFirstChild(NGLayoutInputNode*); | 57 void SetFirstChild(NGLayoutInputNode*); |
| 57 | 58 |
| 59 void SetFragment(NGPhysicalBoxFragment* fragment) { fragment_ = fragment; } |
| 60 NGBreakToken* CurrentBreakToken() const; |
| 61 bool IsLayoutFinished() const { |
| 62 return fragment_ && !fragment_->BreakToken(); |
| 63 } |
| 64 |
| 58 DECLARE_VIRTUAL_TRACE(); | 65 DECLARE_VIRTUAL_TRACE(); |
| 59 | 66 |
| 60 // Runs layout on layout_box_ and creates a fragment for the resulting | 67 // Runs layout on layout_box_ and creates a fragment for the resulting |
| 61 // geometry. | 68 // geometry. |
| 62 NGPhysicalBoxFragment* RunOldLayout(const NGConstraintSpace&); | 69 NGPhysicalBoxFragment* RunOldLayout(const NGConstraintSpace&); |
| 63 | 70 |
| 64 // Called if this is an out-of-flow block which needs to be | 71 // Called if this is an out-of-flow block which needs to be |
| 65 // positioned with legacy layout. | 72 // positioned with legacy layout. |
| 66 void UseOldOutOfFlowPositioning(); | 73 void UseOldOutOfFlowPositioning(); |
| 67 | 74 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 82 void CopyFragmentDataToLayoutBox(const NGConstraintSpace&); | 89 void CopyFragmentDataToLayoutBox(const NGConstraintSpace&); |
| 83 | 90 |
| 84 // We can either wrap a layout_box_ or a style_/next_sibling_/first_child_ | 91 // We can either wrap a layout_box_ or a style_/next_sibling_/first_child_ |
| 85 // combination. | 92 // combination. |
| 86 LayoutBox* layout_box_; | 93 LayoutBox* layout_box_; |
| 87 RefPtr<ComputedStyle> style_; | 94 RefPtr<ComputedStyle> style_; |
| 88 Member<NGBlockNode> next_sibling_; | 95 Member<NGBlockNode> next_sibling_; |
| 89 Member<NGLayoutInputNode> first_child_; | 96 Member<NGLayoutInputNode> first_child_; |
| 90 Member<NGLayoutCoordinator> layout_coordinator_; | 97 Member<NGLayoutCoordinator> layout_coordinator_; |
| 91 Member<NGLayoutAlgorithm> minmax_algorithm_; | 98 Member<NGLayoutAlgorithm> minmax_algorithm_; |
| 99 // TODO(mstensho): An input node may produce multiple fragments, so this |
| 100 // should probably be renamed to last_fragment_ or something like that, since |
| 101 // the last fragment is all we care about when resuming layout. |
| 92 Member<NGPhysicalBoxFragment> fragment_; | 102 Member<NGPhysicalBoxFragment> fragment_; |
| 93 }; | 103 }; |
| 94 | 104 |
| 95 DEFINE_TYPE_CASTS(NGBlockNode, | 105 DEFINE_TYPE_CASTS(NGBlockNode, |
| 96 NGLayoutInputNode, | 106 NGLayoutInputNode, |
| 97 node, | 107 node, |
| 98 node->Type() == NGLayoutInputNode::kLegacyBlock, | 108 node->Type() == NGLayoutInputNode::kLegacyBlock, |
| 99 node.Type() == NGLayoutInputNode::kLegacyBlock); | 109 node.Type() == NGLayoutInputNode::kLegacyBlock); |
| 100 | 110 |
| 101 } // namespace blink | 111 } // namespace blink |
| 102 | 112 |
| 103 #endif // NGBlockNode | 113 #endif // NGBlockNode |
| OLD | NEW |