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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_length_utils.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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_length_utils.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 #ifndef NGLengthUtils_h 5 #ifndef NGLengthUtils_h
6 #define NGLengthUtils_h 6 #define NGLengthUtils_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_units.h" 9 #include "core/layout/ng/ng_units.h"
10 #include "core/layout/ng/ng_writing_mode.h" 10 #include "core/layout/ng/ng_writing_mode.h"
(...skipping 17 matching lines...) Expand all
28 }; 28 };
29 29
30 #define NGSizeIndefinite LayoutUnit(-1) 30 #define NGSizeIndefinite LayoutUnit(-1)
31 31
32 // Whether the caller needs to compute min-content and max-content sizes to 32 // Whether the caller needs to compute min-content and max-content sizes to
33 // pass them to ResolveInlineLength / ComputeInlineSizeForFragment. 33 // pass them to ResolveInlineLength / ComputeInlineSizeForFragment.
34 // If this function returns false, it is safe to pass an empty 34 // If this function returns false, it is safe to pass an empty
35 // MinAndMaxContentSizes struct to those functions. 35 // MinAndMaxContentSizes struct to those functions.
36 CORE_EXPORT bool NeedMinAndMaxContentSizes(const ComputedStyle&); 36 CORE_EXPORT bool NeedMinAndMaxContentSizes(const ComputedStyle&);
37 37
38 // Like NeedMinAndMaxContentSizes, but for use when calling
39 // ComputeMinAndMaxContentContribution.
40 CORE_EXPORT bool NeedMinAndMaxContentSizesForContentContribution(
41 const ComputedStyle&);
42
38 // Convert an inline-axis length to a layout unit using the given constraint 43 // Convert an inline-axis length to a layout unit using the given constraint
39 // space. 44 // space.
40 CORE_EXPORT LayoutUnit 45 CORE_EXPORT LayoutUnit
41 ResolveInlineLength(const NGConstraintSpace&, 46 ResolveInlineLength(const NGConstraintSpace&,
42 const ComputedStyle&, 47 const ComputedStyle&,
43 const WTF::Optional<MinAndMaxContentSizes>&, 48 const WTF::Optional<MinAndMaxContentSizes>&,
44 const Length&, 49 const Length&,
45 LengthResolveType); 50 LengthResolveType);
46 51
47 // Convert a block-axis length to a layout unit using the given constraint 52 // Convert a block-axis length to a layout unit using the given constraint
48 // space and content size. 53 // space and content size.
49 CORE_EXPORT LayoutUnit ResolveBlockLength(const NGConstraintSpace&, 54 CORE_EXPORT LayoutUnit ResolveBlockLength(const NGConstraintSpace&,
50 const ComputedStyle&, 55 const ComputedStyle&,
51 const Length&, 56 const Length&,
52 LayoutUnit content_size, 57 LayoutUnit content_size,
53 LengthResolveType); 58 LengthResolveType);
54 59
60 // For the given style and min/max content sizes, computes the min and max
61 // content contribution (https://drafts.csswg.org/css-sizing/#contributions).
62 // This is similar to ComputeInlineSizeForFragment except that it does not
63 // require a constraint space (percentage sizes as well as auto margins compute
64 // to zero) and that an auto inline size resolves to the respective min/max
65 // content size.
66 // Also, the min/max contribution does include the inline margins as well.
67 CORE_EXPORT MinAndMaxContentSizes ComputeMinAndMaxContentContribution(
68 const ComputedStyle&,
69 const WTF::Optional<MinAndMaxContentSizes>&);
70
55 // Resolves the given length to a layout unit, constraining it by the min 71 // Resolves the given length to a layout unit, constraining it by the min
56 // logical width and max logical width properties from the ComputedStyle 72 // logical width and max logical width properties from the ComputedStyle
57 // object. 73 // object.
58 CORE_EXPORT LayoutUnit 74 CORE_EXPORT LayoutUnit
59 ComputeInlineSizeForFragment(const NGConstraintSpace&, 75 ComputeInlineSizeForFragment(const NGConstraintSpace&,
60 const ComputedStyle&, 76 const ComputedStyle&,
61 const WTF::Optional<MinAndMaxContentSizes>&); 77 const WTF::Optional<MinAndMaxContentSizes>&);
62 78
63 // Resolves the given length to a layout unit, constraining it by the min 79 // Resolves the given length to a layout unit, constraining it by the min
64 // logical height and max logical height properties from the ComputedStyle 80 // logical height and max logical height properties from the ComputedStyle
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // the fragment to compute the margins that are auto, if any, and adjusts 116 // the fragment to compute the margins that are auto, if any, and adjusts
101 // the given NGBoxStrut accordingly. 117 // the given NGBoxStrut accordingly.
102 CORE_EXPORT void ApplyAutoMargins(const NGConstraintSpace&, 118 CORE_EXPORT void ApplyAutoMargins(const NGConstraintSpace&,
103 const ComputedStyle&, 119 const ComputedStyle&,
104 const NGFragmentBase&, 120 const NGFragmentBase&,
105 NGBoxStrut* margins); 121 NGBoxStrut* margins);
106 122
107 } // namespace blink 123 } // namespace blink
108 124
109 #endif // NGLengthUtils_h 125 #endif // NGLengthUtils_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698