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

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

Issue 2724133003: [LayoutNG] Switch NGConstraintSpace to being RefCounted. (Closed)
Patch Set: moar. 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_length_utils.h" 5 #include "core/layout/ng/ng_length_utils.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_constraint_space_builder.h" 8 #include "core/layout/ng/ng_constraint_space_builder.h"
9 #include "core/layout/ng/ng_fragment.h" 9 #include "core/layout/ng/ng_fragment.h"
10 #include "core/style/ComputedStyle.h" 10 #include "core/style/ComputedStyle.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 MinAndMaxContentSizes ComputeMinAndMaxContentContribution( 186 MinAndMaxContentSizes ComputeMinAndMaxContentContribution(
187 const ComputedStyle& style, 187 const ComputedStyle& style,
188 const WTF::Optional<MinAndMaxContentSizes>& min_and_max) { 188 const WTF::Optional<MinAndMaxContentSizes>& min_and_max) {
189 // Synthesize a zero-sized constraint space for passing to 189 // Synthesize a zero-sized constraint space for passing to
190 // ResolveInlineLength. 190 // ResolveInlineLength.
191 NGWritingMode writing_mode = FromPlatformWritingMode(style.getWritingMode()); 191 NGWritingMode writing_mode = FromPlatformWritingMode(style.getWritingMode());
192 NGConstraintSpaceBuilder builder(writing_mode); 192 NGConstraintSpaceBuilder builder(writing_mode);
193 builder.SetInitialContainingBlockSize( 193 builder.SetInitialContainingBlockSize(
194 NGPhysicalSize{LayoutUnit(), LayoutUnit()}); 194 NGPhysicalSize{LayoutUnit(), LayoutUnit()});
195 NGConstraintSpace* space = builder.ToConstraintSpace(writing_mode); 195 RefPtr<NGConstraintSpace> space = builder.ToConstraintSpace(writing_mode);
196 196
197 MinAndMaxContentSizes computed_sizes; 197 MinAndMaxContentSizes computed_sizes;
198 Length inline_size = style.logicalWidth(); 198 Length inline_size = style.logicalWidth();
199 if (inline_size.isAuto()) { 199 if (inline_size.isAuto()) {
200 CHECK(min_and_max.has_value()); 200 CHECK(min_and_max.has_value());
201 NGBoxStrut border_and_padding = 201 NGBoxStrut border_and_padding =
202 ComputeBorders(*space, style) + ComputePadding(*space, style); 202 ComputeBorders(*space, style) + ComputePadding(*space, style);
203 computed_sizes.min_content = 203 computed_sizes.min_content =
204 min_and_max->min_content + border_and_padding.InlineSum(); 204 min_and_max->min_content + border_and_padding.InlineSum();
205 computed_sizes.max_content = 205 computed_sizes.max_content =
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 Optional<LayoutUnit> min, 420 Optional<LayoutUnit> min,
421 Optional<LayoutUnit> max) { 421 Optional<LayoutUnit> max) {
422 if (max && length > max.value()) 422 if (max && length > max.value())
423 length = max.value(); 423 length = max.value();
424 if (min && length < min.value()) 424 if (min && length < min.value())
425 length = min.value(); 425 length = min.value();
426 return length; 426 return length;
427 } 427 }
428 428
429 } // namespace blink 429 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698