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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 visitor->trace(current_child_); | 45 visitor->trace(current_child_); |
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 children_margin_strut MarginStrut for children of the current child. | 55 // @param fragment Children's fragment. |
ikilpatrick
2016/09/19 17:04:19
Child fragment or Current child fragment?
Gleb Lanbin
2016/09/19 17:39:52
Done.
| |
56 // @return Margin block start based on collapsed margins result. | 56 // @return Margin block start based on collapsed margins result. |
57 LayoutUnit CollapseMargins(const NGConstraintSpace& space, | 57 LayoutUnit CollapseMargins(const NGConstraintSpace& space, |
58 const NGBoxStrut& child_margins, | 58 const NGBoxStrut& child_margins, |
59 const NGMarginStrut& children_margin_strut); | 59 const NGFragment& fragment); |
60 | 60 |
61 RefPtr<const ComputedStyle> style_; | 61 RefPtr<const ComputedStyle> style_; |
62 Member<NGBox> first_child_; | 62 Member<NGBox> first_child_; |
63 | 63 |
64 enum State { kStateInit, kStateChildLayout, kStateFinalize }; | 64 enum State { kStateInit, kStateChildLayout, kStateFinalize }; |
65 State state_; | 65 State state_; |
66 Member<NGFragmentBuilder> builder_; | 66 Member<NGFragmentBuilder> builder_; |
67 Member<NGConstraintSpace> constraint_space_for_children_; | 67 Member<NGConstraintSpace> constraint_space_for_children_; |
68 Member<NGBox> current_child_; | 68 Member<NGBox> current_child_; |
69 NGBoxStrut border_and_padding_; | 69 NGBoxStrut border_and_padding_; |
70 LayoutUnit content_size_; | 70 LayoutUnit content_size_; |
71 LayoutUnit max_inline_size_; | 71 LayoutUnit max_inline_size_; |
72 // MarginStrut for the previous child. | 72 // MarginStrut for the previous child. |
73 NGMarginStrut prev_child_margin_strut_; | 73 NGMarginStrut prev_child_margin_strut_; |
74 }; | 74 }; |
75 | 75 |
76 } // namespace blink | 76 } // namespace blink |
77 | 77 |
78 #endif // NGBlockLayoutAlgorithm_h | 78 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |