OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NGConstraintSpace_h | |
6 #define NGConstraintSpace_h | |
7 | |
8 #include "platform/LayoutUnit.h" | |
9 #include "platform/PlatformExport.h" | |
10 | |
11 namespace blink { | |
12 | |
13 class NGDerivedConstraintSpace; | |
14 class NGExclusion; | |
15 | |
16 class PLATFORM_EXPORT NGConstraintSpace { | |
ikilpatrick
2016/07/27 21:14:12
CORE_EXPORT:)
ikilpatrick
2016/07/27 21:14:12
We'll also want to think about how this will work
eae
2016/07/27 21:24:16
I'd argue that we should have constraint spaces be
eae
2016/07/27 21:24:16
Done.
| |
17 public: | |
18 NGConstraintSpace(); | |
19 ~NGConstraintSpace(); | |
20 | |
21 enum NGClearExclusion { | |
22 ClearNone = 0, | |
23 ClearFloatLeft = 1, | |
24 ClearFloatRight = 2, | |
25 ClearFragment = 4 | |
26 }; | |
27 | |
28 enum NGFragmentationType { | |
29 FragmentNone, | |
30 FragmentPage, | |
31 FragmentColumn, | |
32 FragmentRegion | |
33 }; | |
34 | |
35 enum NGExclusionType { | |
36 ExcludeNone, | |
37 ExcludeInlineFlow, | |
38 ExcludeInlineStart, | |
39 ExcludeInlineEnd, | |
40 ExcludeInlineBoth | |
41 }; | |
42 | |
43 NGConstraintSpace(); | |
44 ~NGConstraintSpace(); | |
45 | |
46 LayoutUnit inlineSize() const; | |
47 LayoutUnit blockSize() const; | |
48 | |
49 // Some layout modes “stretch” their children to a fixed size (e.g. flex, | |
50 // grid). These flags represented whether a layout needs to produce a | |
51 // fragment that satisfies a fixed constraint in the inline and block | |
52 // direction respectively. | |
53 bool fixedInlineSize() const; | |
54 bool fixedBlockSize() const; | |
55 | |
56 // The size threashold in the inline and block directions respesvitely that | |
ikilpatrick
2016/07/27 21:14:12
respectively
| |
57 // triggers the presence of a scrollbar. If exceeded the current layout | |
58 // should be aborted and invoked again with a constraint space modified to | |
59 // reserve space for a scrollbar. | |
60 LayoutUnit inlineOverflowSize() const; | |
61 LayoutUnit blockOverflowSize() const; | |
ikilpatrick
2016/07/27 21:14:12
Same as below... any time when there would be diff
eae
2016/07/27 21:24:15
Yes. For a regular document the body would have an
| |
62 | |
63 // If specified a layout should produce a Fragment which fragments at the | |
64 // blockFragmentationSize if possible. | |
65 LayoutUnit blockFragmentationSize() const; | |
ikilpatrick
2016/07/27 21:14:11
So when working on the spec I couldn't think of a
eae
2016/07/27 21:24:16
None comes to mind. I'll remove it.
| |
66 NGFragmentationType blockFragmentationType() const; | |
67 | |
68 void addExclusion(NGExclusion, unsigned options = 0); | |
69 List<NGExclusion> exclusions(unsigned options = 0) const; | |
70 | |
71 List<const DerivedNGConstraintSpace> layoutOpportunities( | |
ikilpatrick
2016/07/27 21:14:11
TODO(layout-dev): move to generator eventually?
| |
72 unsigned clear = ClearNone, | |
73 NGClearExclusion = ExcludeNone) const; | |
ikilpatrick
2016/07/27 21:14:12
Is NGClearExclusion meant to be "avoid"?
ikilpatrick
2016/07/27 21:14:12
Do we have any place today where the "step"/"jump-
eae
2016/07/27 21:24:16
Not today. I intentionally skipped the step-size a
eae
2016/07/27 21:24:16
Yeah
| |
74 }; | |
75 | |
76 class PLATFORM_EXPORT NGDerivedConstraintSpace : NGConstraintSpace { | |
77 public: | |
78 ~NGDerivedConstraintSpace(); | |
79 LayoutUnit inlineOffset() const; | |
80 LayoutUnit blockOffset() const; | |
81 | |
82 // When creating a derived NGConstraintSpace for the next inline level | |
83 // layout opportunity, inlineSize and blockSize of the NGConstraintSpace | |
84 // may be different from its parent. These properties hold the inline and | |
85 // block size of the original NGConstraintSpaces, allowing percentage | |
86 // resolution to work correctly. | |
87 LayoutUnit inlineSizeForPercentageResolution() const; | |
88 LayoutUnit blockSizeForPercentageResolution() const; | |
89 | |
90 private: | |
91 NGDerivedConstraintSpace(); | |
92 }; | |
93 | |
94 } // namespace blink | |
95 | |
96 #endif // NGConstraintSpace_h | |
OLD | NEW |