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

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

Issue 2583063004: [layoutng] Add a function to compute the min- and max-content contribution (Closed)
Patch Set: include margins Created 3 years, 12 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_units.h ('k') | no next file » | 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 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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_units.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698