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

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

Issue 2214483002: [LayoutNG] Change size members on NGConstraintSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove out of date comment. Created 4 years, 4 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/NGConstraintSpace.cpp » ('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 NGConstraintSpace_h 5 #ifndef NGConstraintSpace_h
6 #define NGConstraintSpace_h 6 #define NGConstraintSpace_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/LayoutUnit.h" 9 #include "platform/LayoutUnit.h"
10 #include "wtf/DoublyLinkedList.h" 10 #include "wtf/DoublyLinkedList.h"
(...skipping 28 matching lines...) Expand all
39 }; 39 };
40 40
41 class NGExclusion { 41 class NGExclusion {
42 public: 42 public:
43 NGExclusion(); 43 NGExclusion();
44 ~NGExclusion() { } 44 ~NGExclusion() { }
45 }; 45 };
46 46
47 class CORE_EXPORT NGConstraintSpace { 47 class CORE_EXPORT NGConstraintSpace {
48 public: 48 public:
49 NGConstraintSpace(LayoutUnit inlineSize, LayoutUnit blockSize); 49 NGConstraintSpace(LayoutUnit inlineContainerSize,
50 LayoutUnit blockContainerSize);
50 ~NGConstraintSpace() { } 51 ~NGConstraintSpace() { }
51 52
52 void addExclusion(const NGExclusion, unsigned options = 0); 53 void addExclusion(const NGExclusion, unsigned options = 0);
53 void setOverflowSize(LayoutUnit inlineSize, LayoutUnit blockSize); 54 void setOverflowTriggersScrollbar(bool inlineTriggers,
55 bool blockTriggers);
54 void setFixedSize(bool inlineFixed, bool blockFixed); 56 void setFixedSize(bool inlineFixed, bool blockFixed);
55 void setFragmentationType(NGFragmentationType blockFragmentationType); 57 void setFragmentationType(NGFragmentationType);
56 58
57 // Available space in each direction, -1 indicates infinite space. 59 // Size of the container in each direction. Used for the following
58 LayoutUnit inlineSize() const { return m_inlineSize; } 60 // three cases:
59 LayoutUnit blockSize() const { return m_blockSize; } 61 // 1) Percentage resolution.
62 // 2) Resolving absolute positions of children.
63 // 3) Defining the threashold that triggers the presence of a
64 // scrollbar. Only applies if the corresponding scrollbarTrigger
65 // flag has been set for the direction.
66 LayoutUnit inlineContainerSize() const
67 {
68 return m_inlineContainerSize;
69 }
70 LayoutUnit blockContainerSize() const
71 {
72 return m_blockContainerSize;
73 }
60 74
61 // The size threashold in the inline and block directions respectively that 75 // Whether exceeding the containerSize triggers the presence of a
62 // triggers the presence of a scrollbar. If exceeded the current layout 76 // scrollbar for the indicated direction.
63 // should be aborted and invoked again with a constraint space modified to 77 // If exceeded the current layout should be aborted and invoked again
64 // reserve space for a scrollbar. -1 indicates no limit. 78 // with a constraint space modified to reserve space for a scrollbar.
65 LayoutUnit inlineOverflowSize() const { return m_inlineOverflowSize; } 79 bool inlineTriggersScrollbar() const
66 LayoutUnit blockOverflowSize() const { return m_blockOverflowSize; } 80 {
81 return m_inlineTriggersScrollbar;
82 }
83 bool blockTriggersScrollbar() const
84 {
85 return m_blockTriggersScrollbar;
86 }
67 87
68 // Some layout modes “stretch” their children to a fixed size (e.g. flex, 88 // Some layout modes “stretch” their children to a fixed size (e.g. flex,
69 // grid). These flags represented whether a layout needs to produce a 89 // grid). These flags represented whether a layout needs to produce a
70 // fragment that satisfies a fixed constraint in the inline and block 90 // fragment that satisfies a fixed constraint in the inline and block
71 // direction respectively. 91 // direction respectively.
72 bool fixedInlineSize() const { return m_fixedInlineSize; } 92 bool fixedInlineSize() const { return m_fixedInlineSize; }
73 bool fixedBlockSize() const { return m_fixedBlockSize; } 93 bool fixedBlockSize() const { return m_fixedBlockSize; }
74 94
75 // If specified a layout should produce a Fragment which fragments at the 95 // If specified a layout should produce a Fragment which fragments at the
76 // blockSize if possible. 96 // blockSize if possible.
77 NGFragmentationType blockFragmentationType() const 97 NGFragmentationType blockFragmentationType() const
78 { 98 {
79 return static_cast<NGFragmentationType>(m_blockFragmentationType); 99 return static_cast<NGFragmentationType>(m_blockFragmentationType);
80 } 100 }
81 101
82 DoublyLinkedList<const NGExclusion> exclusions(unsigned options = 0) const; 102 DoublyLinkedList<const NGExclusion> exclusions(unsigned options = 0) const;
83 103
84 NGLayoutOpportunityIterator layoutOpportunities( 104 NGLayoutOpportunityIterator layoutOpportunities(
85 unsigned clear = ClearNone, 105 unsigned clear = ClearNone,
86 NGExclusionFlowType avoid = ExcludeNone) const; 106 NGExclusionFlowType avoid = ExcludeNone) const;
87 107
88 // Modifies constraint space to account for a placed fragment. Depending on 108 // Modifies constraint space to account for a placed fragment. Depending on
89 // the shape of the fragment this will either modify the inline or block 109 // the shape of the fragment this will either modify the inline or block
90 // size, or add an exclusion. 110 // size, or add an exclusion.
91 void subtract(const NGFragment); 111 void subtract(const NGFragment);
92 112
93 private: 113 private:
94 LayoutUnit m_inlineSize; 114 LayoutUnit m_inlineContainerSize;
95 LayoutUnit m_blockSize; 115 LayoutUnit m_blockContainerSize;
96 LayoutUnit m_inlineOverflowSize;
97 LayoutUnit m_blockOverflowSize;
98 116
99 unsigned m_fixedInlineSize : 1; 117 unsigned m_fixedInlineSize : 1;
100 unsigned m_fixedBlockSize : 1; 118 unsigned m_fixedBlockSize : 1;
119 unsigned m_inlineTriggersScrollbar : 1;
120 unsigned m_blockTriggersScrollbar : 1;
101 unsigned m_blockFragmentationType : 2; 121 unsigned m_blockFragmentationType : 2;
102 122
103 DoublyLinkedList<const NGExclusion> m_exclusions; 123 DoublyLinkedList<const NGExclusion> m_exclusions;
104 }; 124 };
105 125
106 126
107 class CORE_EXPORT NGLayoutOpportunityIterator final { 127 class CORE_EXPORT NGLayoutOpportunityIterator final {
108 public: 128 public:
109 NGLayoutOpportunityIterator(const NGConstraintSpace* space, 129 NGLayoutOpportunityIterator(const NGConstraintSpace* space,
110 unsigned clear, NGExclusionFlowType avoid) 130 unsigned clear, NGExclusionFlowType avoid)
(...skipping 10 matching lines...) Expand all
121 NGExclusionFlowType m_avoid; 141 NGExclusionFlowType m_avoid;
122 }; 142 };
123 143
124 144
125 class CORE_EXPORT NGDerivedConstraintSpace final : NGConstraintSpace { 145 class CORE_EXPORT NGDerivedConstraintSpace final : NGConstraintSpace {
126 public: 146 public:
127 ~NGDerivedConstraintSpace(); 147 ~NGDerivedConstraintSpace();
128 148
129 LayoutUnit inlineOffset() const; 149 LayoutUnit inlineOffset() const;
130 LayoutUnit blockOffset() const; 150 LayoutUnit blockOffset() const;
131 151 LayoutUnit inlineSize() const;
132 // When creating a derived NGConstraintSpace for the next inline level 152 LayoutUnit blockSize() const;
133 // layout opportunity, inlineSize and blockSize of the NGConstraintSpace
134 // may be different from its parent. These properties hold the inline and
135 // block size of the original NGConstraintSpaces, allowing percentage
136 // resolution to work correctly.
137 LayoutUnit inlineSizeForPercentageResolution() const;
138 LayoutUnit blockSizeForPercentageResolution() const;
139 153
140 private: 154 private:
141 NGDerivedConstraintSpace(); 155 NGDerivedConstraintSpace();
142 156
143 LayoutUnit m_inlineOffset; 157 LayoutUnit m_inlineOffset;
144 LayoutUnit m_blockOffset; 158 LayoutUnit m_blockOffset;
159 LayoutUnit m_inlineSize;
160 LayoutUnit m_blockSize;
145 NGConstraintSpace* m_original; 161 NGConstraintSpace* m_original;
146 }; 162 };
147 163
148 } // namespace blink 164 } // namespace blink
149 165
150 #endif // NGConstraintSpace_h 166 #endif // NGConstraintSpace_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698