| 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 NGBlockLayoutAlgorithm_h | 5 #ifndef NGBlockLayoutAlgorithm_h |
| 6 #define NGBlockLayoutAlgorithm_h | 6 #define NGBlockLayoutAlgorithm_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/geometry/ng_margin_strut.h" | |
| 10 #include "core/layout/ng/ng_block_node.h" | 9 #include "core/layout/ng/ng_block_node.h" |
| 11 #include "core/layout/ng/ng_break_token.h" | 10 #include "core/layout/ng/ng_break_token.h" |
| 12 #include "core/layout/ng/ng_fragment_builder.h" | 11 #include "core/layout/ng/ng_fragment_builder.h" |
| 13 #include "core/layout/ng/ng_layout_algorithm.h" | 12 #include "core/layout/ng/ng_layout_algorithm.h" |
| 13 #include "core/layout/ng/ng_units.h" |
| 14 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class ComputedStyle; | 18 class ComputedStyle; |
| 19 class NGBlockBreakToken; | 19 class NGBlockBreakToken; |
| 20 class NGConstraintSpace; | 20 class NGConstraintSpace; |
| 21 class NGConstraintSpaceBuilder; | 21 class NGConstraintSpaceBuilder; |
| 22 class NGInlineNode; | 22 class NGInlineNode; |
| 23 class NGLayoutResult; | 23 class NGLayoutResult; |
| 24 | 24 |
| 25 // A class for general block layout (e.g. a <div> with no special style). | 25 // A class for general block layout (e.g. a <div> with no special style). |
| 26 // Lays out the children in sequence. | 26 // Lays out the children in sequence. |
| 27 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { | 27 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { |
| 28 public: | 28 public: |
| 29 // Default constructor. | 29 // Default constructor. |
| 30 // @param node The input node to perform layout upon. | 30 // @param node The input node to perform layout upon. |
| 31 // @param space The constraint space which the algorithm should generate a | 31 // @param space The constraint space which the algorithm should generate a |
| 32 // fragment within. | 32 // fragment within. |
| 33 // @param break_token The break token from which the layout should start. | 33 // @param break_token The break token from which the layout should start. |
| 34 NGBlockLayoutAlgorithm(NGBlockNode* node, | 34 NGBlockLayoutAlgorithm(NGBlockNode* node, |
| 35 NGConstraintSpace* space, | 35 NGConstraintSpace* space, |
| 36 NGBlockBreakToken* break_token = nullptr); | 36 NGBlockBreakToken* break_token = nullptr); |
| 37 | 37 |
| 38 Optional<MinMaxContentSize> ComputeMinMaxContentSize() const override; | 38 Optional<MinAndMaxContentSizes> ComputeMinAndMaxContentSizes() const override; |
| 39 RefPtr<NGLayoutResult> Layout() override; | 39 RefPtr<NGLayoutResult> Layout() override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 NGBoxStrut CalculateMargins(const NGConstraintSpace& space, | 42 NGBoxStrut CalculateMargins(const NGConstraintSpace& space, |
| 43 const ComputedStyle& style); | 43 const ComputedStyle& style); |
| 44 | 44 |
| 45 // Creates a new constraint space for the current child. | 45 // Creates a new constraint space for the current child. |
| 46 NGConstraintSpace* CreateConstraintSpaceForCurrentChild(); | 46 NGConstraintSpace* CreateConstraintSpaceForCurrentChild(); |
| 47 void FinishCurrentChildLayout(RefPtr<NGLayoutResult>); | 47 void FinishCurrentChildLayout(RefPtr<NGLayoutResult>); |
| 48 | 48 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // MarginStrut for the previous child. | 101 // MarginStrut for the previous child. |
| 102 NGMarginStrut curr_margin_strut_; | 102 NGMarginStrut curr_margin_strut_; |
| 103 NGLogicalOffset bfc_offset_; | 103 NGLogicalOffset bfc_offset_; |
| 104 NGLogicalOffset curr_bfc_offset_; | 104 NGLogicalOffset curr_bfc_offset_; |
| 105 NGBoxStrut curr_child_margins_; | 105 NGBoxStrut curr_child_margins_; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace blink | 108 } // namespace blink |
| 109 | 109 |
| 110 #endif // NGBlockLayoutAlgorithm_h | 110 #endif // NGBlockLayoutAlgorithm_h |
| OLD | NEW |