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

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

Issue 2612103004: [ng_layout] Rename NGFragmentBase,NGFragment,NGPhysicalFragment (Closed)
Patch Set: CR: rename ifdef guards Created 3 years, 11 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_base.h"
10 #include "core/style/ComputedStyle.h" 9 #include "core/style/ComputedStyle.h"
10 #include "core/layout/ng/ng_fragment.h"
11 #include "platform/LayoutUnit.h" 11 #include "platform/LayoutUnit.h"
12 #include "platform/Length.h" 12 #include "platform/Length.h"
13 #include "wtf/Optional.h" 13 #include "wtf/Optional.h"
14 14
15 namespace blink { 15 namespace blink {
16 // TODO(layout-ng): 16 // TODO(layout-ng):
17 // - positioned and/or replaced calculations 17 // - positioned and/or replaced calculations
18 // - Take scrollbars into account 18 // - Take scrollbars into account
19 19
20 bool NeedMinAndMaxContentSizes(const NGConstraintSpace& constraint_space, 20 bool NeedMinAndMaxContentSizes(const NGConstraintSpace& constraint_space,
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 constraint_space, style, empty_sizes, style.paddingBefore(), 383 constraint_space, style, empty_sizes, style.paddingBefore(),
384 LengthResolveType::kMarginBorderPaddingSize); 384 LengthResolveType::kMarginBorderPaddingSize);
385 padding.block_end = ResolveInlineLength( 385 padding.block_end = ResolveInlineLength(
386 constraint_space, style, empty_sizes, style.paddingAfter(), 386 constraint_space, style, empty_sizes, style.paddingAfter(),
387 LengthResolveType::kMarginBorderPaddingSize); 387 LengthResolveType::kMarginBorderPaddingSize);
388 return padding; 388 return padding;
389 } 389 }
390 390
391 void ApplyAutoMargins(const NGConstraintSpace& constraint_space, 391 void ApplyAutoMargins(const NGConstraintSpace& constraint_space,
392 const ComputedStyle& style, 392 const ComputedStyle& style,
393 const NGFragmentBase& fragment, 393 const NGFragment& fragment,
394 NGBoxStrut* margins) { 394 NGBoxStrut* margins) {
395 DCHECK(margins) << "Margins cannot be NULL here"; 395 DCHECK(margins) << "Margins cannot be NULL here";
396 const LayoutUnit used_space = fragment.InlineSize() + margins->InlineSum(); 396 const LayoutUnit used_space = fragment.InlineSize() + margins->InlineSum();
397 const LayoutUnit available_space = 397 const LayoutUnit available_space =
398 constraint_space.AvailableSize().inline_size - used_space; 398 constraint_space.AvailableSize().inline_size - used_space;
399 if (available_space < LayoutUnit()) 399 if (available_space < LayoutUnit())
400 return; 400 return;
401 if (style.marginStart().isAuto() && style.marginEnd().isAuto()) { 401 if (style.marginStart().isAuto() && style.marginEnd().isAuto()) {
402 margins->inline_start = available_space / 2; 402 margins->inline_start = available_space / 2;
403 margins->inline_end = available_space - margins->inline_start; 403 margins->inline_end = available_space - margins->inline_start;
404 } else if (style.marginStart().isAuto()) { 404 } else if (style.marginStart().isAuto()) {
405 margins->inline_start = available_space; 405 margins->inline_start = available_space;
406 } else if (style.marginEnd().isAuto()) { 406 } else if (style.marginEnd().isAuto()) {
407 margins->inline_end = available_space; 407 margins->inline_end = available_space;
408 } 408 }
409 } 409 }
410 410
411 } // namespace blink 411 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698