Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc

Issue 2711803007: Add ClearanceOffset to LayoutNG Constraint space. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 text_direction_ = static_cast<unsigned>(text_direction); 64 text_direction_ = static_cast<unsigned>(text_direction);
65 return *this; 65 return *this;
66 } 66 }
67 67
68 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetMarginStrut( 68 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetMarginStrut(
69 const NGMarginStrut& margin_strut) { 69 const NGMarginStrut& margin_strut) {
70 margin_strut_ = margin_strut; 70 margin_strut_ = margin_strut;
71 return *this; 71 return *this;
72 } 72 }
73 73
74 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetBfcOffset(
75 const NGLogicalOffset& offset) {
76 bfc_offset_ = offset;
77 return *this;
78 }
79
80 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetClearanceOffset(
81 const WTF::Optional<LayoutUnit>& clearance_offset) {
82 clearance_offset_ = clearance_offset;
83 return *this;
84 }
85
74 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsFixedSizeInline( 86 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsFixedSizeInline(
75 bool is_fixed_size_inline) { 87 bool is_fixed_size_inline) {
76 is_fixed_size_inline_ = is_fixed_size_inline; 88 is_fixed_size_inline_ = is_fixed_size_inline;
77 return *this; 89 return *this;
78 } 90 }
79 91
80 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsFixedSizeBlock( 92 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsFixedSizeBlock(
81 bool is_fixed_size_block) { 93 bool is_fixed_size_block) {
82 is_fixed_size_block_ = is_fixed_size_block; 94 is_fixed_size_block_ = is_fixed_size_block;
83 return *this; 95 return *this;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 percentage_resolution_size.inline_size = 163 percentage_resolution_size.inline_size =
152 initial_containing_block_size_.height; 164 initial_containing_block_size_.height;
153 } 165 }
154 } 166 }
155 167
156 // Exclusions do not pass the formatting context boundary. 168 // Exclusions do not pass the formatting context boundary.
157 std::shared_ptr<NGExclusions> exclusions( 169 std::shared_ptr<NGExclusions> exclusions(
158 is_new_fc_ ? std::make_shared<NGExclusions>() : exclusions_); 170 is_new_fc_ ? std::make_shared<NGExclusions>() : exclusions_);
159 NGLogicalOffset bfc_offset = is_new_fc_ ? NGLogicalOffset() : bfc_offset_; 171 NGLogicalOffset bfc_offset = is_new_fc_ ? NGLogicalOffset() : bfc_offset_;
160 NGMarginStrut margin_strut = is_new_fc_ ? NGMarginStrut() : margin_strut_; 172 NGMarginStrut margin_strut = is_new_fc_ ? NGMarginStrut() : margin_strut_;
173 WTF::Optional<LayoutUnit> clearance_offset =
ikilpatrick 2017/02/24 17:36:57 worth adding more comments here for the is_new_fc_
Gleb Lanbin 2017/02/24 18:37:00 Done.
174 is_new_fc_ ? WTF::nullopt : clearance_offset_;
161 175
162 if (is_in_parallel_flow) { 176 if (is_in_parallel_flow) {
163 return new NGConstraintSpace( 177 return new NGConstraintSpace(
164 static_cast<NGWritingMode>(out_writing_mode), 178 static_cast<NGWritingMode>(out_writing_mode),
165 static_cast<TextDirection>(text_direction_), available_size, 179 static_cast<TextDirection>(text_direction_), available_size,
166 percentage_resolution_size, initial_containing_block_size_, 180 percentage_resolution_size, initial_containing_block_size_,
167 fragmentainer_space_available_, is_fixed_size_inline_, 181 fragmentainer_space_available_, is_fixed_size_inline_,
168 is_fixed_size_block_, is_shrink_to_fit_, 182 is_fixed_size_block_, is_shrink_to_fit_,
169 is_inline_direction_triggers_scrollbar_, 183 is_inline_direction_triggers_scrollbar_,
170 is_block_direction_triggers_scrollbar_, 184 is_block_direction_triggers_scrollbar_,
171 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, 185 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
172 margin_strut, bfc_offset, exclusions); 186 margin_strut, bfc_offset, exclusions, clearance_offset);
173 } 187 }
174 return new NGConstraintSpace( 188 return new NGConstraintSpace(
175 out_writing_mode, static_cast<TextDirection>(text_direction_), 189 out_writing_mode, static_cast<TextDirection>(text_direction_),
176 available_size, percentage_resolution_size, 190 available_size, percentage_resolution_size,
177 initial_containing_block_size_, fragmentainer_space_available_, 191 initial_containing_block_size_, fragmentainer_space_available_,
178 is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_, 192 is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_,
179 is_block_direction_triggers_scrollbar_, 193 is_block_direction_triggers_scrollbar_,
180 is_inline_direction_triggers_scrollbar_, 194 is_inline_direction_triggers_scrollbar_,
181 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, 195 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
182 margin_strut, bfc_offset, exclusions); 196 margin_strut, bfc_offset, exclusions, clearance_offset);
183 } 197 }
184 198
185 } // namespace blink 199 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698