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

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

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
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 #ifndef NGUnits_h 5 #ifndef NGUnits_h
6 #define NGUnits_h 6 #define NGUnits_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_writing_mode.h" 9 #include "core/layout/ng/ng_writing_mode.h"
10 #include "platform/LayoutUnit.h" 10 #include "platform/LayoutUnit.h"
11 #include "platform/text/TextDirection.h" 11 #include "platform/text/TextDirection.h"
12 #include "wtf/text/WTFString.h" 12 #include "wtf/text/WTFString.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class LayoutUnit; 16 class LayoutUnit;
17 struct NGPhysicalOffset; 17 struct NGPhysicalOffset;
18 struct NGPhysicalSize; 18 struct NGPhysicalSize;
19 struct NGBoxStrut; 19 struct NGBoxStrut;
20 20
21 struct CORE_EXPORT MinAndMaxContentSizes { 21 struct CORE_EXPORT MinAndMaxContentSizes {
22 LayoutUnit min_content; 22 LayoutUnit min_content;
23 LayoutUnit max_content; 23 LayoutUnit max_content;
24 LayoutUnit ShrinkToFit(LayoutUnit available_size) const; 24 LayoutUnit ShrinkToFit(LayoutUnit available_size) const;
25 bool operator==(const MinAndMaxContentSizes& other) const;
25 }; 26 };
26 27
28 inline std::ostream& operator<<(std::ostream& stream,
29 const MinAndMaxContentSizes& value) {
30 return stream << "(" << value.min_content << ", " << value.max_content << ")";
31 }
32
27 struct NGLogicalSize { 33 struct NGLogicalSize {
28 NGLogicalSize() {} 34 NGLogicalSize() {}
29 NGLogicalSize(LayoutUnit inline_size, LayoutUnit block_size) 35 NGLogicalSize(LayoutUnit inline_size, LayoutUnit block_size)
30 : inline_size(inline_size), block_size(block_size) {} 36 : inline_size(inline_size), block_size(block_size) {}
31 37
32 LayoutUnit inline_size; 38 LayoutUnit inline_size;
33 LayoutUnit block_size; 39 LayoutUnit block_size;
34 40
35 NGPhysicalSize ConvertToPhysical(NGWritingMode mode) const; 41 NGPhysicalSize ConvertToPhysical(NGWritingMode mode) const;
36 bool operator==(const NGLogicalSize& other) const; 42 bool operator==(const NGLogicalSize& other) const;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (position_matches) 353 if (position_matches)
348 return position; 354 return position;
349 else 355 else
350 return container_size - position - length - margin_start - margin_end; 356 return container_size - position - length - margin_start - margin_end;
351 } 357 }
352 }; 358 };
353 359
354 } // namespace blink 360 } // namespace blink
355 361
356 #endif // NGUnits_h 362 #endif // NGUnits_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc ('k') | third_party/WebKit/Source/core/layout/ng/ng_units.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698