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

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

Issue 2368153003: Compute margin block start for 1st block in LayoutNG root constraint space (Closed)
Patch Set: rename IsNewBfc -> IsNewFormattingContext Created 4 years, 2 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 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 "core/layout/ng/ng_physical_constraint_space.h" 9 #include "core/layout/ng/ng_physical_constraint_space.h"
10 #include "core/layout/ng/ng_writing_mode.h" 10 #include "core/layout/ng/ng_writing_mode.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 NGLogicalSize ContainerSize() const; 78 NGLogicalSize ContainerSize() const;
79 79
80 // Offset relative to the root constraint space. 80 // Offset relative to the root constraint space.
81 NGLogicalOffset Offset() const { return offset_; } 81 NGLogicalOffset Offset() const { return offset_; }
82 82
83 // Returns the effective size of the constraint space. Equal to the 83 // Returns the effective size of the constraint space. Equal to the
84 // ContainerSize() for the root constraint space but derived constraint spaces 84 // ContainerSize() for the root constraint space but derived constraint spaces
85 // return the size of the layout opportunity. 85 // return the size of the layout opportunity.
86 virtual NGLogicalSize Size() const { return size_; } 86 virtual NGLogicalSize Size() const { return size_; }
87 87
88 // Whether the current constraint space is for the newly established
89 // Formatting Context.
90 bool IsNewFormattingContext() const { return is_new_fc_; }
91
88 // Whether exceeding the containerSize triggers the presence of a scrollbar 92 // Whether exceeding the containerSize triggers the presence of a scrollbar
89 // for the indicated direction. 93 // for the indicated direction.
90 // If exceeded the current layout should be aborted and invoked again with a 94 // If exceeded the current layout should be aborted and invoked again with a
91 // constraint space modified to reserve space for a scrollbar. 95 // constraint space modified to reserve space for a scrollbar.
92 bool InlineTriggersScrollbar() const; 96 bool InlineTriggersScrollbar() const;
93 bool BlockTriggersScrollbar() const; 97 bool BlockTriggersScrollbar() const;
94 98
95 // Some layout modes “stretch” their children to a fixed size (e.g. flex, 99 // Some layout modes “stretch” their children to a fixed size (e.g. flex,
96 // grid). These flags represented whether a layout needs to produce a 100 // grid). These flags represented whether a layout needs to produce a
97 // fragment that satisfies a fixed constraint in the inline and block 101 // fragment that satisfies a fixed constraint in the inline and block
(...skipping 14 matching lines...) Expand all
112 unsigned clear = NGClearNone, 116 unsigned clear = NGClearNone,
113 bool for_inline_or_bfc = false); 117 bool for_inline_or_bfc = false);
114 118
115 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(physical_space_); } 119 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(physical_space_); }
116 120
117 // The setters for the NGConstraintSpace should only be used when constructing 121 // The setters for the NGConstraintSpace should only be used when constructing
118 // a derived NGConstraintSpace. 122 // a derived NGConstraintSpace.
119 void SetOverflowTriggersScrollbar(bool inlineTriggers, bool blockTriggers); 123 void SetOverflowTriggersScrollbar(bool inlineTriggers, bool blockTriggers);
120 void SetFixedSize(bool inlineFixed, bool blockFixed); 124 void SetFixedSize(bool inlineFixed, bool blockFixed);
121 void SetFragmentationType(NGFragmentationType); 125 void SetFragmentationType(NGFragmentationType);
126 // TODO(layout-ng): Add m_isNewFc flag to ComputedStyle and use it instead of
127 // the function below.
128 void SetIsNewFormattingContext(bool is_new_fc) { is_new_fc_ = is_new_fc; }
122 129
123 String ToString() const; 130 String ToString() const;
124 131
125 private: 132 private:
126 Member<NGPhysicalConstraintSpace> physical_space_; 133 Member<NGPhysicalConstraintSpace> physical_space_;
127 NGLogicalOffset offset_; 134 NGLogicalOffset offset_;
128 NGLogicalSize size_; 135 NGLogicalSize size_;
129 unsigned writing_mode_ : 3; 136 unsigned writing_mode_ : 3;
130 unsigned direction_ : 1; 137 unsigned direction_ : 1;
138 // Whether the current constraint space is for the newly established
139 // formatting Context
140 bool is_new_fc_ : 1;
131 }; 141 };
132 142
133 inline std::ostream& operator<<(std::ostream& stream, 143 inline std::ostream& operator<<(std::ostream& stream,
134 const NGConstraintSpace& value) { 144 const NGConstraintSpace& value) {
135 return stream << value.ToString(); 145 return stream << value.ToString();
136 } 146 }
137 147
138 } // namespace blink 148 } // namespace blink
139 149
140 #endif // NGConstraintSpace_h 150 #endif // NGConstraintSpace_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_box.cc ('k') | third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698