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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 value = min_and_max->min_content; 92 value = min_and_max->min_content;
93 } else if (length.isMaxContent() || available_size == LayoutUnit::max()) { 93 } else if (length.isMaxContent() || available_size == LayoutUnit::max()) {
94 // If the available space is infinite, fit-content resolves to 94 // If the available space is infinite, fit-content resolves to
95 // max-content. See css-sizing section 2.1. 95 // max-content. See css-sizing section 2.1.
96 value = min_and_max->max_content; 96 value = min_and_max->max_content;
97 } else { 97 } else {
98 NGBoxStrut margins = ComputeMargins( 98 NGBoxStrut margins = ComputeMargins(
99 constraint_space, style, 99 constraint_space, style,
100 FromPlatformWritingMode(style.getWritingMode()), style.direction()); 100 FromPlatformWritingMode(style.getWritingMode()), style.direction());
101 LayoutUnit fill_available = 101 LayoutUnit fill_available =
102 std::max(LayoutUnit(), available_size - margins.InlineSum() - 102 std::max(LayoutUnit(),
103 border_and_padding.InlineSum()); 103 available_size - margins.InlineSum() -
104 border_and_padding.InlineSum());
104 value = min_and_max->ShrinkToFit(fill_available); 105 value = min_and_max->ShrinkToFit(fill_available);
105 } 106 }
106 return value + border_and_padding.InlineSum(); 107 return value + border_and_padding.InlineSum();
107 } 108 }
108 case DeviceWidth: 109 case DeviceWidth:
109 case DeviceHeight: 110 case DeviceHeight:
110 case ExtendToZoom: 111 case ExtendToZoom:
111 NOTREACHED() << "These should only be used for viewport definitions"; 112 NOTREACHED() << "These should only be used for viewport definitions";
112 case MaxSizeNone: 113 case MaxSizeNone:
113 default: 114 default:
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 Optional<LayoutUnit> min, 410 Optional<LayoutUnit> min,
410 Optional<LayoutUnit> max) { 411 Optional<LayoutUnit> max) {
411 if (max && length > max.value()) 412 if (max && length > max.value())
412 length = max.value(); 413 length = max.value();
413 if (min && length < min.value()) 414 if (min && length < min.value())
414 length = min.value(); 415 length = min.value();
415 return length; 416 return length;
416 } 417 }
417 418
418 } // namespace blink 419 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698