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_constraint_space_builder.h" | 5 #include "core/layout/ng/ng_constraint_space_builder.h" |
6 | 6 |
7 #include "core/layout/ng/ng_length_utils.h" | 7 #include "core/layout/ng/ng_length_utils.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsNewFormattingContext( | 114 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsNewFormattingContext( |
115 bool is_new_fc) { | 115 bool is_new_fc) { |
116 is_new_fc_ = is_new_fc; | 116 is_new_fc_ = is_new_fc; |
117 return *this; | 117 return *this; |
118 } | 118 } |
119 | 119 |
120 NGConstraintSpace* NGConstraintSpaceBuilder::ToConstraintSpace( | 120 NGConstraintSpace* NGConstraintSpaceBuilder::ToConstraintSpace( |
121 NGWritingMode out_writing_mode) { | 121 NGWritingMode out_writing_mode) { |
122 // Whether the child and the containing block are parallel to each other. | 122 // Whether the child and the containing block are parallel to each other. |
123 // Example: vertical-rl and vertical-lr | 123 // Example: vertical-rl and vertical-lr |
124 bool is_in_parallel_flow = (parent_writing_mode_ == kHorizontalTopBottom) == | 124 bool is_in_parallel_flow = IsParallelWritingMode( |
125 (out_writing_mode == kHorizontalTopBottom); | 125 static_cast<NGWritingMode>(parent_writing_mode_), out_writing_mode); |
126 | 126 |
127 NGLogicalSize available_size = available_size_; | 127 NGLogicalSize available_size = available_size_; |
128 NGLogicalSize percentage_resolution_size = percentage_resolution_size_; | 128 NGLogicalSize percentage_resolution_size = percentage_resolution_size_; |
129 if (!is_in_parallel_flow) { | 129 if (!is_in_parallel_flow) { |
130 std::swap(available_size.inline_size, available_size.block_size); | 130 std::swap(available_size.inline_size, available_size.block_size); |
131 std::swap(percentage_resolution_size.inline_size, | 131 std::swap(percentage_resolution_size.inline_size, |
132 percentage_resolution_size.block_size); | 132 percentage_resolution_size.block_size); |
133 } | 133 } |
134 | 134 |
135 // If inline size is indefinite, use size of initial containing block. | 135 // If inline size is indefinite, use size of initial containing block. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 available_size, percentage_resolution_size, | 176 available_size, percentage_resolution_size, |
177 initial_containing_block_size_, fragmentainer_space_available_, | 177 initial_containing_block_size_, fragmentainer_space_available_, |
178 is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_, | 178 is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_, |
179 is_block_direction_triggers_scrollbar_, | 179 is_block_direction_triggers_scrollbar_, |
180 is_inline_direction_triggers_scrollbar_, | 180 is_inline_direction_triggers_scrollbar_, |
181 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, | 181 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, |
182 margin_strut, bfc_offset, exclusions); | 182 margin_strut, bfc_offset, exclusions); |
183 } | 183 } |
184 | 184 |
185 } // namespace blink | 185 } // namespace blink |
OLD | NEW |