| 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" | 9 #include "core/layout/ng/geometry/ng_margin_strut.h" |
| 10 #include "core/layout/ng/ng_block_break_token.h" | 10 #include "core/layout/ng/ng_block_break_token.h" |
| 11 #include "core/layout/ng/ng_block_node.h" | 11 #include "core/layout/ng/ng_block_node.h" |
| 12 #include "core/layout/ng/ng_constraint_space_builder.h" | 12 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 13 #include "core/layout/ng/ng_fragment_builder.h" | 13 #include "core/layout/ng/ng_fragment_builder.h" |
| 14 #include "core/layout/ng/ng_layout_algorithm.h" | 14 #include "core/layout/ng/ng_layout_algorithm.h" |
| 15 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class NGConstraintSpace; | 19 class NGConstraintSpace; |
| 20 class NGLayoutResult; | 20 class NGLayoutResult; |
| 21 | 21 |
| 22 // Updates the fragment's BFC offset if it's not already set. |
| 23 void MaybeUpdateFragmentBfcOffset(const NGConstraintSpace&, |
| 24 const NGLogicalOffset&, |
| 25 NGFragmentBuilder* builder); |
| 26 |
| 22 // A class for general block layout (e.g. a <div> with no special style). | 27 // A class for general block layout (e.g. a <div> with no special style). |
| 23 // Lays out the children in sequence. | 28 // Lays out the children in sequence. |
| 24 class CORE_EXPORT NGBlockLayoutAlgorithm | 29 class CORE_EXPORT NGBlockLayoutAlgorithm |
| 25 : public NGLayoutAlgorithm<NGBlockNode, NGBlockBreakToken> { | 30 : public NGLayoutAlgorithm<NGBlockNode, NGBlockBreakToken> { |
| 26 public: | 31 public: |
| 27 // Default constructor. | 32 // Default constructor. |
| 28 // @param node The input node to perform layout upon. | 33 // @param node The input node to perform layout upon. |
| 29 // @param space The constraint space which the algorithm should generate a | 34 // @param space The constraint space which the algorithm should generate a |
| 30 // fragment within. | 35 // fragment within. |
| 31 // @param break_token The break token from which the layout should start. | 36 // @param break_token The break token from which the layout should start. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 // token if we're out of space. | 57 // token if we're out of space. |
| 53 void FinalizeForFragmentation(); | 58 void FinalizeForFragmentation(); |
| 54 | 59 |
| 55 // Calculates logical offset for the current fragment using either | 60 // Calculates logical offset for the current fragment using either |
| 56 // {@code content_size_} when the fragment doesn't know it's offset | 61 // {@code content_size_} when the fragment doesn't know it's offset |
| 57 // or {@code known_fragment_offset} if the fragment knows it's offset | 62 // or {@code known_fragment_offset} if the fragment knows it's offset |
| 58 // @return Fragment's offset relative to the fragment's parent. | 63 // @return Fragment's offset relative to the fragment's parent. |
| 59 NGLogicalOffset CalculateLogicalOffset( | 64 NGLogicalOffset CalculateLogicalOffset( |
| 60 const WTF::Optional<NGLogicalOffset>& known_fragment_offset); | 65 const WTF::Optional<NGLogicalOffset>& known_fragment_offset); |
| 61 | 66 |
| 62 // Updates the fragment's BFC offset if it's not already set. | |
| 63 void UpdateFragmentBfcOffset(const NGLogicalOffset& offset); | |
| 64 | |
| 65 NGFragmentBuilder builder_; | 67 NGFragmentBuilder builder_; |
| 66 NGConstraintSpaceBuilder space_builder_; | 68 NGConstraintSpaceBuilder space_builder_; |
| 67 | 69 |
| 68 NGBoxStrut border_and_padding_; | 70 NGBoxStrut border_and_padding_; |
| 69 LayoutUnit content_size_; | 71 LayoutUnit content_size_; |
| 70 LayoutUnit max_inline_size_; | 72 LayoutUnit max_inline_size_; |
| 71 // MarginStrut for the previous child. | 73 // MarginStrut for the previous child. |
| 72 NGMarginStrut curr_margin_strut_; | 74 NGMarginStrut curr_margin_strut_; |
| 73 NGLogicalOffset curr_bfc_offset_; | 75 NGLogicalOffset curr_bfc_offset_; |
| 74 NGBoxStrut curr_child_margins_; | 76 NGBoxStrut curr_child_margins_; |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 } // namespace blink | 79 } // namespace blink |
| 78 | 80 |
| 79 #endif // NGBlockLayoutAlgorithm_h | 81 #endif // NGBlockLayoutAlgorithm_h |
| OLD | NEW |