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

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: Get IsNewBfc from layout_box->createsNewFormattingContext() 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 Block
89 // Formatting Context(BFC).
90 bool IsNewBfc() const { return is_new_bfc_; }
ikilpatrick 2016/09/29 00:18:11 thought we were just going to have a method on NGB
Gleb Lanbin 2016/09/29 17:11:15 Acknowledged.
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 void SetIsNewBfc(bool is_new_bfc) { is_new_bfc_ = is_new_bfc; }
122 127
123 String ToString() const; 128 String ToString() const;
124 129
125 private: 130 private:
126 Member<NGPhysicalConstraintSpace> physical_space_; 131 Member<NGPhysicalConstraintSpace> physical_space_;
127 NGLogicalOffset offset_; 132 NGLogicalOffset offset_;
128 NGLogicalSize size_; 133 NGLogicalSize size_;
129 unsigned writing_mode_ : 3; 134 unsigned writing_mode_ : 3;
130 unsigned direction_ : 1; 135 unsigned direction_ : 1;
136 // Whether the current constraint space is for the newly established Block
137 // Formatting Context(BFC).
138 bool is_new_bfc_ : 1;
131 }; 139 };
132 140
133 inline std::ostream& operator<<(std::ostream& stream, 141 inline std::ostream& operator<<(std::ostream& stream,
134 const NGConstraintSpace& value) { 142 const NGConstraintSpace& value) {
135 return stream << value.ToString(); 143 return stream << value.ToString();
136 } 144 }
137 145
138 } // namespace blink 146 } // namespace blink
139 147
140 #endif // NGConstraintSpace_h 148 #endif // NGConstraintSpace_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698