OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NGMultiColumnLayoutAlgorithm_h |
| 6 #define NGMultiColumnLayoutAlgorithm_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/ng_block_node.h" |
| 10 #include "core/layout/ng/ng_break_token.h" |
| 11 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 12 #include "core/layout/ng/ng_fragment_builder.h" |
| 13 #include "core/layout/ng/ng_layout_algorithm.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class ComputedStyle; |
| 18 class NGConstraintSpace; |
| 19 class NGConstraintSpaceBuilder; |
| 20 |
| 21 // A class for general block layout (e.g. a <div> with no special style). |
| 22 // Lays out the children in sequence. |
| 23 class CORE_EXPORT NGMultiColumnLayoutAlgorithm : public NGLayoutAlgorithm { |
| 24 public: |
| 25 // Default constructor. |
| 26 // @param layout_object The layout object associated with this block. |
| 27 // @param style Style reference of the block that is being laid out. |
| 28 // @param first_child Our first child; the algorithm will use its NextSibling |
| 29 // method to access all the children. |
| 30 // @param space The constraint space which the algorithm should generate a |
| 31 // fragment within. |
| 32 NGMultiColumnLayoutAlgorithm(NGBlockNode* node, |
| 33 NGConstraintSpace* space, |
| 34 NGBreakToken* break_token = nullptr); |
| 35 |
| 36 RefPtr<NGLayoutResult> Layout() override; |
| 37 Optional<MinMaxContentSize> ComputeMinMaxContentSize() const override; |
| 38 |
| 39 private: |
| 40 const NGConstraintSpace& ConstraintSpace() const { |
| 41 DCHECK(constraint_space_); |
| 42 return *constraint_space_; |
| 43 } |
| 44 |
| 45 const ComputedStyle& Style() const { return node_->Style(); } |
| 46 |
| 47 Persistent<NGBlockNode> node_; |
| 48 NGConstraintSpace* constraint_space_; |
| 49 |
| 50 // The break token from which we are currently resuming layout. |
| 51 NGBreakToken* break_token_; |
| 52 |
| 53 NGFragmentBuilder builder_; |
| 54 NGConstraintSpaceBuilder space_builder_; |
| 55 |
| 56 NGBoxStrut border_and_padding_; |
| 57 LayoutUnit content_size_; |
| 58 LayoutUnit max_inline_size_; |
| 59 }; |
| 60 |
| 61 } // namespace blink |
| 62 |
| 63 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |