OLD | NEW |
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 Loading... |
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 |
OLD | NEW |