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

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

Issue 2528433006: [LayoutNG] Unit tests for MinAndMaxContentSizes::ShrinkToFit(). (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_units_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_units.h" 5 #include "core/layout/ng/ng_units.h"
6 6
7 #include "core/layout/ng/ng_writing_mode.h" 7 #include "core/layout/ng/ng_writing_mode.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 LayoutUnit MinAndMaxContentSizes::ShrinkToFit(LayoutUnit available_size) const { 11 LayoutUnit MinAndMaxContentSizes::ShrinkToFit(LayoutUnit available_size) const {
12 DCHECK_GE(max_content, min_content);
12 return std::min(max_content, std::max(min_content, available_size)); 13 return std::min(max_content, std::max(min_content, available_size));
13 } 14 }
14 15
15 NGPhysicalSize NGLogicalSize::ConvertToPhysical(NGWritingMode mode) const { 16 NGPhysicalSize NGLogicalSize::ConvertToPhysical(NGWritingMode mode) const {
16 return mode == HorizontalTopBottom ? NGPhysicalSize(inline_size, block_size) 17 return mode == HorizontalTopBottom ? NGPhysicalSize(inline_size, block_size)
17 : NGPhysicalSize(block_size, inline_size); 18 : NGPhysicalSize(block_size, inline_size);
18 } 19 }
19 20
20 bool NGLogicalSize::operator==(const NGLogicalSize& other) const { 21 bool NGLogicalSize::operator==(const NGLogicalSize& other) const {
21 return std::tie(other.inline_size, other.block_size) == 22 return std::tie(other.inline_size, other.block_size) ==
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 220
220 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { 221 bool NGMarginStrut::operator==(const NGMarginStrut& other) const {
221 return std::tie(other.margin_block_start, other.margin_block_end, 222 return std::tie(other.margin_block_start, other.margin_block_end,
222 other.negative_margin_block_start, 223 other.negative_margin_block_start,
223 other.negative_margin_block_end) == 224 other.negative_margin_block_end) ==
224 std::tie(margin_block_start, margin_block_end, 225 std::tie(margin_block_start, margin_block_end,
225 negative_margin_block_start, negative_margin_block_end); 226 negative_margin_block_start, negative_margin_block_end);
226 } 227 }
227 228
228 } // namespace blink 229 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_units_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698