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

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

Issue 2692403003: [LayoutNG] Make NGBlockLayoutAlgorithm accept a NGBlockNode. (Closed)
Patch Set: comments! 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc » ('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 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_break_token.h" 10 #include "core/layout/ng/ng_break_token.h"
(...skipping 10 matching lines...) Expand all
21 class NGConstraintSpace; 21 class NGConstraintSpace;
22 class NGConstraintSpaceBuilder; 22 class NGConstraintSpaceBuilder;
23 class NGInlineNode; 23 class NGInlineNode;
24 class NGPhysicalFragment; 24 class NGPhysicalFragment;
25 25
26 // A class for general block layout (e.g. a <div> with no special style). 26 // A class for general block layout (e.g. a <div> with no special style).
27 // Lays out the children in sequence. 27 // Lays out the children in sequence.
28 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { 28 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm {
29 public: 29 public:
30 // Default constructor. 30 // Default constructor.
31 // @param layout_object The layout object associated with this block. 31 // @param node The input node to perform layout upon.
32 // @param style Style reference of the block that is being laid out.
33 // @param first_child Our first child; the algorithm will use its NextSibling
34 // method to access all the children.
35 // @param space The constraint space which the algorithm should generate a 32 // @param space The constraint space which the algorithm should generate a
36 // fragment within. 33 // fragment within.
37 NGBlockLayoutAlgorithm(LayoutObject* layout_object, 34 // @param break_token The break token from which the layout should start.
38 PassRefPtr<const ComputedStyle> style, 35 NGBlockLayoutAlgorithm(NGBlockNode* node,
39 NGLayoutInputNode* first_child,
40 NGConstraintSpace* space, 36 NGConstraintSpace* space,
41 NGBreakToken* break_token = nullptr); 37 NGBreakToken* break_token = nullptr);
42 38
43 Optional<MinAndMaxContentSizes> ComputeMinAndMaxContentSizes() const override; 39 Optional<MinAndMaxContentSizes> ComputeMinAndMaxContentSizes() const override;
44 RefPtr<NGPhysicalFragment> Layout() override; 40 RefPtr<NGPhysicalFragment> Layout() override;
45 41
46 private: 42 private:
47 NGBoxStrut CalculateMargins(const NGConstraintSpace& space, 43 NGBoxStrut CalculateMargins(const NGConstraintSpace& space,
48 const ComputedStyle& style); 44 const ComputedStyle& style);
49 45
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 111 }
116 112
117 const NGConstraintSpace& ConstraintSpace() const { 113 const NGConstraintSpace& ConstraintSpace() const {
118 return *constraint_space_; 114 return *constraint_space_;
119 } 115 }
120 116
121 const NGConstraintSpace& CurrentChildConstraintSpace() const { 117 const NGConstraintSpace& CurrentChildConstraintSpace() const {
122 return *space_for_current_child_.get(); 118 return *space_for_current_child_.get();
123 } 119 }
124 120
125 const ComputedStyle& Style() const { return *style_; } 121 const ComputedStyle& Style() const { return node_->Style(); }
126 122
127 RefPtr<const ComputedStyle> style_; 123 Persistent<NGBlockNode> node_;
128
129 Persistent<NGLayoutInputNode> first_child_;
130 Persistent<NGConstraintSpace> constraint_space_; 124 Persistent<NGConstraintSpace> constraint_space_;
131 125
132 // The break token from which we are currently resuming layout. 126 // The break token from which we are currently resuming layout.
133 Persistent<NGBreakToken> break_token_; 127 Persistent<NGBreakToken> break_token_;
134 128
135 std::unique_ptr<NGFragmentBuilder> builder_; 129 std::unique_ptr<NGFragmentBuilder> builder_;
136 Persistent<NGConstraintSpaceBuilder> space_builder_; 130 Persistent<NGConstraintSpaceBuilder> space_builder_;
137 Persistent<NGConstraintSpace> space_for_current_child_; 131 Persistent<NGConstraintSpace> space_for_current_child_;
138 Persistent<NGLayoutInputNode> current_child_; 132 Persistent<NGLayoutInputNode> current_child_;
139 133
140 // Mapper from the fragmented flow coordinate space coordinates to visual 134 // Mapper from the fragmented flow coordinate space coordinates to visual
141 // coordinates. Only set on fragmentation context roots, such as multicol 135 // coordinates. Only set on fragmentation context roots, such as multicol
142 // containers. Keeps track of the current fragmentainer. 136 // containers. Keeps track of the current fragmentainer.
143 Persistent<NGColumnMapper> fragmentainer_mapper_; 137 Persistent<NGColumnMapper> fragmentainer_mapper_;
144 138
145 NGBoxStrut border_and_padding_; 139 NGBoxStrut border_and_padding_;
146 LayoutUnit content_size_; 140 LayoutUnit content_size_;
147 LayoutUnit max_inline_size_; 141 LayoutUnit max_inline_size_;
148 // MarginStrut for the previous child. 142 // MarginStrut for the previous child.
149 NGMarginStrut curr_margin_strut_; 143 NGMarginStrut curr_margin_strut_;
150 NGLogicalOffset bfc_offset_; 144 NGLogicalOffset bfc_offset_;
151 NGLogicalOffset curr_bfc_offset_; 145 NGLogicalOffset curr_bfc_offset_;
152 NGBoxStrut curr_child_margins_; 146 NGBoxStrut curr_child_margins_;
153 }; 147 };
154 148
155 } // namespace blink 149 } // namespace blink
156 150
157 #endif // NGBlockLayoutAlgorithm_h 151 #endif // NGBlockLayoutAlgorithm_h
OLDNEW
« no previous file with comments | « no previous file | 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