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

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

Issue 2632523002: [LayoutNG] Initial support for multicol, introducing NGBlockBreakToken. (Closed)
Patch Set: Created 3 years, 11 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_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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // The available space size. 64 // The available space size.
65 // See: https://drafts.csswg.org/css-sizing/#available 65 // See: https://drafts.csswg.org/css-sizing/#available
66 NGLogicalSize AvailableSize() const { return available_size_; } 66 NGLogicalSize AvailableSize() const { return available_size_; }
67 67
68 // Offset relative to the root constraint space. 68 // Offset relative to the root constraint space.
69 NGLogicalOffset Offset() const { return offset_; } 69 NGLogicalOffset Offset() const { return offset_; }
70 // TODO(layout-ng): Set offset via NGConstraintSpacebuilder. 70 // TODO(layout-ng): Set offset via NGConstraintSpacebuilder.
71 void SetOffset(const NGLogicalOffset& offset) { offset_ = offset; } 71 void SetOffset(const NGLogicalOffset& offset) { offset_ = offset; }
72 72
73 // Return the block-direction space available in the current fragmentainer.
74 LayoutUnit FragmentainerSpaceAvailable() const {
75 return fragmentainer_space_available_;
76 }
77
73 // Whether the current constraint space is for the newly established 78 // Whether the current constraint space is for the newly established
74 // Formatting Context. 79 // Formatting Context.
75 bool IsNewFormattingContext() const { return is_new_fc_; } 80 bool IsNewFormattingContext() const { return is_new_fc_; }
76 81
77 // Whether exceeding the AvailableSize() triggers the presence of a scrollbar 82 // Whether exceeding the AvailableSize() triggers the presence of a scrollbar
78 // for the indicated direction. 83 // for the indicated direction.
79 // If exceeded the current layout should be aborted and invoked again with a 84 // If exceeded the current layout should be aborted and invoked again with a
80 // constraint space modified to reserve space for a scrollbar. 85 // constraint space modified to reserve space for a scrollbar.
81 bool IsInlineDirectionTriggersScrollbar() const { 86 bool IsInlineDirectionTriggersScrollbar() const {
82 return is_inline_direction_triggers_scrollbar_; 87 return is_inline_direction_triggers_scrollbar_;
(...skipping 14 matching lines...) Expand all
97 bool IsFixedSizeBlock() const { return is_fixed_size_block_; } 102 bool IsFixedSizeBlock() const { return is_fixed_size_block_; }
98 103
99 // Whether an auto inline-size should be interpreted as shrink-to-fit 104 // Whether an auto inline-size should be interpreted as shrink-to-fit
100 // (ie. fit-content). This is used for inline-block, floats, etc. 105 // (ie. fit-content). This is used for inline-block, floats, etc.
101 bool IsShrinkToFit() const { return is_shrink_to_fit_; } 106 bool IsShrinkToFit() const { return is_shrink_to_fit_; }
102 107
103 // If specified a layout should produce a Fragment which fragments at the 108 // If specified a layout should produce a Fragment which fragments at the
104 // blockSize if possible. 109 // blockSize if possible.
105 NGFragmentationType BlockFragmentationType() const; 110 NGFragmentationType BlockFragmentationType() const;
106 111
112 // Return true if this contraint space participates in a fragmentation
113 // context.
114 bool HasBlockFragmentation() const {
115 return BlockFragmentationType() != kFragmentNone;
116 }
117
107 // Modifies constraint space to account for a placed fragment. Depending on 118 // Modifies constraint space to account for a placed fragment. Depending on
108 // the shape of the fragment this will either modify the inline or block 119 // the shape of the fragment this will either modify the inline or block
109 // size, or add an exclusion. 120 // size, or add an exclusion.
110 void Subtract(const NGBoxFragment*); 121 void Subtract(const NGBoxFragment*);
111 122
112 NGLayoutOpportunityIterator* LayoutOpportunities( 123 NGLayoutOpportunityIterator* LayoutOpportunities(
113 unsigned clear = kNGClearNone, 124 unsigned clear = kNGClearNone,
114 bool for_inline_or_bfc = false); 125 bool for_inline_or_bfc = false);
115 126
116 DEFINE_INLINE_VIRTUAL_TRACE() {} 127 DEFINE_INLINE_VIRTUAL_TRACE() {}
117 128
118 String ToString() const; 129 String ToString() const;
119 130
120 private: 131 private:
121 friend class NGConstraintSpaceBuilder; 132 friend class NGConstraintSpaceBuilder;
122 // Default constructor. 133 // Default constructor.
123 NGConstraintSpace(NGWritingMode, 134 NGConstraintSpace(NGWritingMode,
124 TextDirection, 135 TextDirection,
125 NGLogicalSize available_size, 136 NGLogicalSize available_size,
126 NGLogicalSize percentage_resolution_size, 137 NGLogicalSize percentage_resolution_size,
138 LayoutUnit fragmentainer_space_available,
127 bool is_fixed_size_inline, 139 bool is_fixed_size_inline,
128 bool is_fixed_size_block, 140 bool is_fixed_size_block,
129 bool is_shrink_to_fit, 141 bool is_shrink_to_fit,
130 bool is_inline_direction_triggers_scrollbar, 142 bool is_inline_direction_triggers_scrollbar,
131 bool is_block_direction_triggers_scrollbar, 143 bool is_block_direction_triggers_scrollbar,
132 NGFragmentationType block_direction_fragmentation_type, 144 NGFragmentationType block_direction_fragmentation_type,
133 bool is_new_fc, 145 bool is_new_fc,
134 const std::shared_ptr<NGExclusions>& exclusions_); 146 const std::shared_ptr<NGExclusions>& exclusions_);
135 147
136 NGLogicalSize available_size_; 148 NGLogicalSize available_size_;
137 NGLogicalSize percentage_resolution_size_; 149 NGLogicalSize percentage_resolution_size_;
138 150
151 LayoutUnit fragmentainer_space_available_;
152
139 unsigned is_fixed_size_inline_ : 1; 153 unsigned is_fixed_size_inline_ : 1;
140 unsigned is_fixed_size_block_ : 1; 154 unsigned is_fixed_size_block_ : 1;
141 155
142 unsigned is_shrink_to_fit_ : 1; 156 unsigned is_shrink_to_fit_ : 1;
143 157
144 unsigned is_inline_direction_triggers_scrollbar_ : 1; 158 unsigned is_inline_direction_triggers_scrollbar_ : 1;
145 unsigned is_block_direction_triggers_scrollbar_ : 1; 159 unsigned is_block_direction_triggers_scrollbar_ : 1;
146 160
147 unsigned block_direction_fragmentation_type_ : 2; 161 unsigned block_direction_fragmentation_type_ : 2;
148 162
149 // Whether the current constraint space is for the newly established 163 // Whether the current constraint space is for the newly established
150 // formatting Context 164 // formatting Context
151 unsigned is_new_fc_ : 1; 165 unsigned is_new_fc_ : 1;
152 166
153 NGLogicalOffset offset_; 167 NGLogicalOffset offset_;
154 unsigned writing_mode_ : 3; 168 unsigned writing_mode_ : 3;
155 unsigned direction_ : 1; 169 unsigned direction_ : 1;
156 170
157 const std::shared_ptr<NGExclusions> exclusions_; 171 const std::shared_ptr<NGExclusions> exclusions_;
158 }; 172 };
159 173
160 inline std::ostream& operator<<(std::ostream& stream, 174 inline std::ostream& operator<<(std::ostream& stream,
161 const NGConstraintSpace& value) { 175 const NGConstraintSpace& value) {
162 return stream << value.ToString(); 176 return stream << value.ToString();
163 } 177 }
164 178
165 } // namespace blink 179 } // namespace blink
166 180
167 #endif // NGConstraintSpace_h 181 #endif // NGConstraintSpace_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698