| 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 namespace blink { | 7 namespace blink { |
| 8 | 8 |
| 9 LayoutUnit MinAndMaxContentSizes::ShrinkToFit(LayoutUnit available_size) const { | 9 LayoutUnit MinAndMaxContentSizes::ShrinkToFit(LayoutUnit available_size) const { |
| 10 DCHECK_GE(max_content, min_content); | 10 DCHECK_GE(max_content, min_content); |
| 11 return std::min(max_content, std::max(min_content, available_size)); | 11 return std::min(max_content, std::max(min_content, available_size)); |
| 12 } | 12 } |
| 13 | 13 |
| 14 bool MinAndMaxContentSizes::operator==( |
| 15 const MinAndMaxContentSizes& other) const { |
| 16 return min_content == other.min_content && max_content == other.max_content; |
| 17 } |
| 18 |
| 14 NGPhysicalSize NGLogicalSize::ConvertToPhysical(NGWritingMode mode) const { | 19 NGPhysicalSize NGLogicalSize::ConvertToPhysical(NGWritingMode mode) const { |
| 15 return mode == kHorizontalTopBottom ? NGPhysicalSize(inline_size, block_size) | 20 return mode == kHorizontalTopBottom ? NGPhysicalSize(inline_size, block_size) |
| 16 : NGPhysicalSize(block_size, inline_size); | 21 : NGPhysicalSize(block_size, inline_size); |
| 17 } | 22 } |
| 18 | 23 |
| 19 bool NGLogicalSize::operator==(const NGLogicalSize& other) const { | 24 bool NGLogicalSize::operator==(const NGLogicalSize& other) const { |
| 20 return std::tie(other.inline_size, other.block_size) == | 25 return std::tie(other.inline_size, other.block_size) == |
| 21 std::tie(inline_size, block_size); | 26 std::tie(inline_size, block_size); |
| 22 } | 27 } |
| 23 | 28 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 position.type = (direction == LTR) ? kTopLeft : kBottomLeft; | 282 position.type = (direction == LTR) ? kTopLeft : kBottomLeft; |
| 278 break; | 283 break; |
| 279 case kSidewaysLeftRight: | 284 case kSidewaysLeftRight: |
| 280 position.type = (direction == LTR) ? kBottomLeft : kTopLeft; | 285 position.type = (direction == LTR) ? kBottomLeft : kTopLeft; |
| 281 break; | 286 break; |
| 282 } | 287 } |
| 283 return position; | 288 return position; |
| 284 } | 289 } |
| 285 | 290 |
| 286 } // namespace blink | 291 } // namespace blink |
| OLD | NEW |