| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 is_new_fc_ = is_new_fc; | 130 is_new_fc_ = is_new_fc; |
| 131 return *this; | 131 return *this; |
| 132 } | 132 } |
| 133 | 133 |
| 134 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsAnonymous( | 134 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsAnonymous( |
| 135 bool is_anonymous) { | 135 bool is_anonymous) { |
| 136 is_anonymous_ = is_anonymous; | 136 is_anonymous_ = is_anonymous; |
| 137 return *this; | 137 return *this; |
| 138 } | 138 } |
| 139 | 139 |
| 140 NGConstraintSpace* NGConstraintSpaceBuilder::ToConstraintSpace( | 140 RefPtr<NGConstraintSpace> NGConstraintSpaceBuilder::ToConstraintSpace( |
| 141 NGWritingMode out_writing_mode) { | 141 NGWritingMode out_writing_mode) { |
| 142 // Whether the child and the containing block are parallel to each other. | 142 // Whether the child and the containing block are parallel to each other. |
| 143 // Example: vertical-rl and vertical-lr | 143 // Example: vertical-rl and vertical-lr |
| 144 bool is_in_parallel_flow = IsParallelWritingMode( | 144 bool is_in_parallel_flow = IsParallelWritingMode( |
| 145 static_cast<NGWritingMode>(parent_writing_mode_), out_writing_mode); | 145 static_cast<NGWritingMode>(parent_writing_mode_), out_writing_mode); |
| 146 | 146 |
| 147 NGLogicalSize available_size = available_size_; | 147 NGLogicalSize available_size = available_size_; |
| 148 NGLogicalSize percentage_resolution_size = percentage_resolution_size_; | 148 NGLogicalSize percentage_resolution_size = percentage_resolution_size_; |
| 149 if (!is_in_parallel_flow) { | 149 if (!is_in_parallel_flow) { |
| 150 std::swap(available_size.inline_size, available_size.block_size); | 150 std::swap(available_size.inline_size, available_size.block_size); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 175 | 175 |
| 176 // Reset things that do not pass the Formatting Context boundary. | 176 // Reset things that do not pass the Formatting Context boundary. |
| 177 std::shared_ptr<NGExclusions> exclusions( | 177 std::shared_ptr<NGExclusions> exclusions( |
| 178 is_new_fc_ ? std::make_shared<NGExclusions>() : exclusions_); | 178 is_new_fc_ ? std::make_shared<NGExclusions>() : exclusions_); |
| 179 NGLogicalOffset bfc_offset = is_new_fc_ ? NGLogicalOffset() : bfc_offset_; | 179 NGLogicalOffset bfc_offset = is_new_fc_ ? NGLogicalOffset() : bfc_offset_; |
| 180 NGMarginStrut margin_strut = is_new_fc_ ? NGMarginStrut() : margin_strut_; | 180 NGMarginStrut margin_strut = is_new_fc_ ? NGMarginStrut() : margin_strut_; |
| 181 WTF::Optional<LayoutUnit> clearance_offset = | 181 WTF::Optional<LayoutUnit> clearance_offset = |
| 182 is_new_fc_ ? WTF::nullopt : clearance_offset_; | 182 is_new_fc_ ? WTF::nullopt : clearance_offset_; |
| 183 | 183 |
| 184 if (is_in_parallel_flow) { | 184 if (is_in_parallel_flow) { |
| 185 return new NGConstraintSpace( | 185 return adoptRef(new NGConstraintSpace( |
| 186 static_cast<NGWritingMode>(out_writing_mode), | 186 static_cast<NGWritingMode>(out_writing_mode), |
| 187 static_cast<TextDirection>(text_direction_), available_size, | 187 static_cast<TextDirection>(text_direction_), available_size, |
| 188 percentage_resolution_size, initial_containing_block_size_, | 188 percentage_resolution_size, initial_containing_block_size_, |
| 189 fragmentainer_space_available_, is_fixed_size_inline_, | 189 fragmentainer_space_available_, is_fixed_size_inline_, |
| 190 is_fixed_size_block_, is_shrink_to_fit_, | 190 is_fixed_size_block_, is_shrink_to_fit_, |
| 191 is_inline_direction_triggers_scrollbar_, | 191 is_inline_direction_triggers_scrollbar_, |
| 192 is_block_direction_triggers_scrollbar_, | 192 is_block_direction_triggers_scrollbar_, |
| 193 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, | 193 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, |
| 194 is_anonymous_, margin_strut, bfc_offset, exclusions, clearance_offset); | 194 is_anonymous_, margin_strut, bfc_offset, exclusions, clearance_offset)); |
| 195 } | 195 } |
| 196 return new NGConstraintSpace( | 196 return adoptRef(new NGConstraintSpace( |
| 197 out_writing_mode, static_cast<TextDirection>(text_direction_), | 197 out_writing_mode, static_cast<TextDirection>(text_direction_), |
| 198 available_size, percentage_resolution_size, | 198 available_size, percentage_resolution_size, |
| 199 initial_containing_block_size_, fragmentainer_space_available_, | 199 initial_containing_block_size_, fragmentainer_space_available_, |
| 200 is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_, | 200 is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_, |
| 201 is_block_direction_triggers_scrollbar_, | 201 is_block_direction_triggers_scrollbar_, |
| 202 is_inline_direction_triggers_scrollbar_, | 202 is_inline_direction_triggers_scrollbar_, |
| 203 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, | 203 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, |
| 204 is_anonymous_, margin_strut, bfc_offset, exclusions, clearance_offset); | 204 is_anonymous_, margin_strut, bfc_offset, exclusions, clearance_offset)); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |