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/ng_box.h" | 9 #include "core/layout/ng/ng_box.h" |
10 #include "core/layout/ng/ng_fragment_builder.h" | 10 #include "core/layout/ng/ng_fragment_builder.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 // Computes collapsed margins for 2 adjoining blocks and updates the resultant | 49 // Computes collapsed margins for 2 adjoining blocks and updates the resultant |
50 // fragment's MarginStrut if needed. | 50 // fragment's MarginStrut if needed. |
51 // See https://www.w3.org/TR/CSS2/box.html#collapsing-margins | 51 // See https://www.w3.org/TR/CSS2/box.html#collapsing-margins |
52 // | 52 // |
53 // @param space Constraint space for the block. | 53 // @param space Constraint space for the block. |
54 // @param child_margins Margins information for the current child. | 54 // @param child_margins Margins information for the current child. |
55 // @param fragment Current child's fragment. | 55 // @param fragment Current child's fragment. |
56 // @return Margin block start based on collapsed margins result. | 56 // @return NGBoxStrut with margins block start/end. |
57 LayoutUnit CollapseMargins(const NGConstraintSpace& space, | 57 NGBoxStrut CollapseMargins(const NGConstraintSpace& space, |
58 const NGBoxStrut& child_margins, | 58 const NGBoxStrut& child_margins, |
59 const NGFragment& fragment); | 59 const NGFragment& fragment); |
60 | 60 |
61 // Updates block-{start|end} of the currently constructed fragment. | 61 // Updates block-{start|end} of the currently constructed fragment. |
62 // | 62 // |
63 // This method is supposed to be called on every child but it only updates | 63 // This method is supposed to be called on every child but it only updates |
64 // the block-start once (on the first non-zero height child fragment) and | 64 // the block-start once (on the first non-zero height child fragment) and |
65 // keeps updating block-end (on every non-zero height child). | 65 // keeps updating block-end (on every non-zero height child). |
66 void UpdateMarginStrut(const NGMarginStrut& from); | 66 void UpdateMarginStrut(const NGMarginStrut& from); |
67 | 67 |
(...skipping 11 matching lines...) Expand all Loading... |
79 // MarginStrut for the previous child. | 79 // MarginStrut for the previous child. |
80 NGMarginStrut prev_child_margin_strut_; | 80 NGMarginStrut prev_child_margin_strut_; |
81 // Whether the block-start was set for the currently built | 81 // Whether the block-start was set for the currently built |
82 // fragment's margin strut. | 82 // fragment's margin strut. |
83 bool is_fragment_margin_strut_block_start_updated_ : 1; | 83 bool is_fragment_margin_strut_block_start_updated_ : 1; |
84 }; | 84 }; |
85 | 85 |
86 } // namespace blink | 86 } // namespace blink |
87 | 87 |
88 #endif // NGBlockLayoutAlgorithm_h | 88 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |