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 #include "core/layout/ng/ng_block_layout_algorithm.h" | 5 #include "core/layout/ng/ng_block_layout_algorithm.h" |
6 | 6 |
7 #include "core/layout/ng/ng_constraint_space.h" | 7 #include "core/layout/ng/ng_constraint_space.h" |
8 #include "core/layout/ng/ng_fragment_builder.h" | 8 #include "core/layout/ng/ng_fragment_builder.h" |
9 #include "core/layout/ng/ng_fragment.h" | 9 #include "core/layout/ng/ng_fragment.h" |
10 #include "core/layout/ng/ng_length_utils.h" | 10 #include "core/layout/ng/ng_length_utils.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 border_and_padding_.InlineSum()); | 97 border_and_padding_.InlineSum()); |
98 current_child_ = current_child_->NextSibling(); | 98 current_child_ = current_child_->NextSibling(); |
99 if (current_child_) | 99 if (current_child_) |
100 return false; | 100 return false; |
101 } | 101 } |
102 state_ = kStateFinalize; | 102 state_ = kStateFinalize; |
103 return false; | 103 return false; |
104 } | 104 } |
105 case kStateFinalize: { | 105 case kStateFinalize: { |
106 content_size_ += border_and_padding_.block_end; | 106 content_size_ += border_and_padding_.block_end; |
107 // Margins of the newly established formatting context do not participate | |
108 // in Collapsing Margins and therefore need to be added to the current | |
109 // content_size. | |
110 if (constraint_space->IsNewFormattingContext()) { | |
111 content_size_ += builder_->MarginStrut().BlockEndSum(); | |
cbiesinger
2016/10/03 19:58:27
That does not look right, shouldn't this be handle
Gleb Lanbin
2016/10/04 14:47:49
the logic is correct, I double verified it with Ia
| |
112 builder_->ClearMarginStrut(); | |
113 } | |
114 | |
107 // Recompute the block-axis size now that we know our content size. | 115 // Recompute the block-axis size now that we know our content size. |
108 LayoutUnit block_size = computeBlockSizeForFragment( | 116 LayoutUnit block_size = computeBlockSizeForFragment( |
109 *constraint_space, *style_, content_size_); | 117 *constraint_space, *style_, content_size_); |
110 | 118 |
111 builder_->SetBlockSize(block_size) | 119 builder_->SetBlockSize(block_size) |
112 .SetInlineOverflow(max_inline_size_) | 120 .SetInlineOverflow(max_inline_size_) |
113 .SetBlockOverflow(content_size_); | 121 .SetBlockOverflow(content_size_); |
114 *out = builder_->ToFragment(); | 122 *out = builder_->ToFragment(); |
115 state_ = kStateInit; | 123 state_ = kStateInit; |
116 return true; | 124 return true; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 | 184 |
177 void NGBlockLayoutAlgorithm::UpdateMarginStrut(const NGMarginStrut& from) { | 185 void NGBlockLayoutAlgorithm::UpdateMarginStrut(const NGMarginStrut& from) { |
178 if (!is_fragment_margin_strut_block_start_updated_) { | 186 if (!is_fragment_margin_strut_block_start_updated_) { |
179 builder_->SetMarginStrutBlockStart(from); | 187 builder_->SetMarginStrutBlockStart(from); |
180 is_fragment_margin_strut_block_start_updated_ = true; | 188 is_fragment_margin_strut_block_start_updated_ = true; |
181 } | 189 } |
182 builder_->SetMarginStrutBlockEnd(from); | 190 builder_->SetMarginStrutBlockEnd(from); |
183 } | 191 } |
184 | 192 |
185 } // namespace blink | 193 } // namespace blink |
OLD | NEW |