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

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

Issue 2668183003: [LayoutNG] Make NG algorithms non-oilpan. (Closed)
Patch Set: fix win compile 2? Created 3 years, 10 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 NGBlockLayoutAlgorithm_h 5 #ifndef NGBlockLayoutAlgorithm_h
6 #define NGBlockLayoutAlgorithm_h 6 #define NGBlockLayoutAlgorithm_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_block_node.h" 9 #include "core/layout/ng/ng_block_node.h"
10 #include "core/layout/ng/ng_box_fragment.h" 10 #include "core/layout/ng/ng_box_fragment.h"
11 #include "core/layout/ng/ng_break_token.h"
12 #include "core/layout/ng/ng_column_mapper.h"
11 #include "core/layout/ng/ng_layout_algorithm.h" 13 #include "core/layout/ng/ng_layout_algorithm.h"
12 #include "core/layout/ng/ng_units.h" 14 #include "core/layout/ng/ng_units.h"
13 #include "wtf/RefPtr.h" 15 #include "wtf/RefPtr.h"
14 16
15 namespace blink { 17 namespace blink {
16 18
17 class ComputedStyle; 19 class ComputedStyle;
18 class NGBlockBreakToken; 20 class NGBlockBreakToken;
19 class NGBreakToken;
20 class NGColumnMapper;
21 class NGConstraintSpace; 21 class NGConstraintSpace;
22 class NGConstraintSpaceBuilder; 22 class NGConstraintSpaceBuilder;
23 class NGFragment; 23 class NGFragment;
24 class NGFragmentBuilder; 24 class NGFragmentBuilder;
25 class NGPhysicalFragment; 25 class NGPhysicalFragment;
26 26
27 // A class for general block layout (e.g. a <div> with no special style). 27 // A class for general block layout (e.g. a <div> with no special style).
28 // Lays out the children in sequence. 28 // Lays out the children in sequence.
29 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { 29 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm {
30 public: 30 public:
31 // Default constructor. 31 // Default constructor.
32 // @param layout_object The layout object associated with this block. 32 // @param layout_object The layout object associated with this block.
33 // @param style Style reference of the block that is being laid out. 33 // @param style Style reference of the block that is being laid out.
34 // @param first_child Our first child; the algorithm will use its NextSibling 34 // @param first_child Our first child; the algorithm will use its NextSibling
35 // method to access all the children. 35 // method to access all the children.
36 // @param space The constraint space which the algorithm should generate a 36 // @param space The constraint space which the algorithm should generate a
37 // fragment within. 37 // fragment within.
38 NGBlockLayoutAlgorithm(LayoutObject* layout_object, 38 NGBlockLayoutAlgorithm(LayoutObject* layout_object,
39 PassRefPtr<const ComputedStyle> style, 39 PassRefPtr<const ComputedStyle> style,
40 NGBlockNode* first_child, 40 NGBlockNode* first_child,
41 NGConstraintSpace* space, 41 NGConstraintSpace* space,
42 NGBreakToken* break_token = nullptr); 42 NGBreakToken* break_token = nullptr);
43 43
44 bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) const override; 44 bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) const override;
45 NGPhysicalFragment* Layout() override; 45 NGPhysicalFragment* Layout() override;
46 46
47 DECLARE_VIRTUAL_TRACE();
48
49 private: 47 private:
50 NGBoxStrut CalculateMargins(const NGConstraintSpace& space, 48 NGBoxStrut CalculateMargins(const NGConstraintSpace& space,
51 const ComputedStyle& style); 49 const ComputedStyle& style);
52 50
53 // Creates a new constraint space for the current child. 51 // Creates a new constraint space for the current child.
54 NGConstraintSpace* CreateConstraintSpaceForCurrentChild(); 52 NGConstraintSpace* CreateConstraintSpaceForCurrentChild();
55 void FinishCurrentChildLayout(NGFragment* fragment); 53 void FinishCurrentChildLayout(NGFragment* fragment);
56 54
57 // Proceed to the next sibling that still needs layout. 55 // Proceed to the next sibling that still needs layout.
58 // 56 //
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 114 }
117 115
118 const NGConstraintSpace& CurrentChildConstraintSpace() const { 116 const NGConstraintSpace& CurrentChildConstraintSpace() const {
119 return *space_for_current_child_.get(); 117 return *space_for_current_child_.get();
120 } 118 }
121 119
122 const ComputedStyle& Style() const { return *style_; } 120 const ComputedStyle& Style() const { return *style_; }
123 121
124 RefPtr<const ComputedStyle> style_; 122 RefPtr<const ComputedStyle> style_;
125 123
126 Member<NGBlockNode> first_child_; 124 Persistent<NGBlockNode> first_child_;
127 Member<NGConstraintSpace> constraint_space_; 125 Persistent<NGConstraintSpace> constraint_space_;
128 126
129 // The break token from which we are currently resuming layout. 127 // The break token from which we are currently resuming layout.
130 Member<NGBreakToken> break_token_; 128 Persistent<NGBreakToken> break_token_;
131 129
132 Member<NGFragmentBuilder> builder_; 130 Persistent<NGFragmentBuilder> builder_;
133 Member<NGConstraintSpaceBuilder> space_builder_; 131 Persistent<NGConstraintSpaceBuilder> space_builder_;
134 Member<NGConstraintSpace> space_for_current_child_; 132 Persistent<NGConstraintSpace> space_for_current_child_;
135 Member<NGBlockNode> current_child_; 133 Persistent<NGBlockNode> current_child_;
136 134
137 // Mapper from the fragmented flow coordinate space coordinates to visual 135 // Mapper from the fragmented flow coordinate space coordinates to visual
138 // coordinates. Only set on fragmentation context roots, such as multicol 136 // coordinates. Only set on fragmentation context roots, such as multicol
139 // containers. Keeps track of the current fragmentainer. 137 // containers. Keeps track of the current fragmentainer.
140 Member<NGColumnMapper> fragmentainer_mapper_; 138 Persistent<NGColumnMapper> fragmentainer_mapper_;
141 139
142 NGBoxStrut border_and_padding_; 140 NGBoxStrut border_and_padding_;
143 LayoutUnit content_size_; 141 LayoutUnit content_size_;
144 LayoutUnit max_inline_size_; 142 LayoutUnit max_inline_size_;
145 // MarginStrut for the previous child. 143 // MarginStrut for the previous child.
146 NGMarginStrut curr_margin_strut_; 144 NGMarginStrut curr_margin_strut_;
147 NGLogicalOffset bfc_offset_; 145 NGLogicalOffset bfc_offset_;
148 NGLogicalOffset curr_bfc_offset_; 146 NGLogicalOffset curr_bfc_offset_;
149 NGBoxStrut curr_child_margins_; 147 NGBoxStrut curr_child_margins_;
150 }; 148 };
151 149
152 } // namespace blink 150 } // namespace blink
153 151
154 #endif // NGBlockLayoutAlgorithm_h 152 #endif // NGBlockLayoutAlgorithm_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698