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

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

Issue 2702403003: [layoutng] Split NGLayoutResult out of NGPhysicalFragment (Closed)
Patch Set: rebased Created 3 years, 9 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_break_token.h" 10 #include "core/layout/ng/ng_break_token.h"
11 #include "core/layout/ng/ng_column_mapper.h" 11 #include "core/layout/ng/ng_column_mapper.h"
12 #include "core/layout/ng/ng_fragment_builder.h" 12 #include "core/layout/ng/ng_fragment_builder.h"
13 #include "core/layout/ng/ng_layout_algorithm.h" 13 #include "core/layout/ng/ng_layout_algorithm.h"
14 #include "core/layout/ng/ng_units.h" 14 #include "core/layout/ng/ng_units.h"
15 #include "wtf/RefPtr.h" 15 #include "wtf/RefPtr.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class ComputedStyle; 19 class ComputedStyle;
20 class NGBlockBreakToken; 20 class NGBlockBreakToken;
21 class NGConstraintSpace; 21 class NGConstraintSpace;
22 class NGConstraintSpaceBuilder; 22 class NGConstraintSpaceBuilder;
23 class NGInlineNode; 23 class NGInlineNode;
24 class NGLayoutResult;
24 class NGPhysicalFragment; 25 class NGPhysicalFragment;
25 26
26 // 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).
27 // Lays out the children in sequence. 28 // Lays out the children in sequence.
28 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { 29 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm {
29 public: 30 public:
30 // Default constructor. 31 // Default constructor.
31 // @param node The input node to perform layout upon. 32 // @param node The input node to perform layout upon.
32 // @param space The constraint space which the algorithm should generate a 33 // @param space The constraint space which the algorithm should generate a
33 // fragment within. 34 // fragment within.
34 // @param break_token The break token from which the layout should start. 35 // @param break_token The break token from which the layout should start.
35 NGBlockLayoutAlgorithm(NGBlockNode* node, 36 NGBlockLayoutAlgorithm(NGBlockNode* node,
36 NGConstraintSpace* space, 37 NGConstraintSpace* space,
37 NGBreakToken* break_token = nullptr); 38 NGBreakToken* break_token = nullptr);
38 39
39 Optional<MinAndMaxContentSizes> ComputeMinAndMaxContentSizes() const override; 40 Optional<MinAndMaxContentSizes> ComputeMinAndMaxContentSizes() const override;
40 RefPtr<NGPhysicalFragment> Layout() override; 41 RefPtr<NGLayoutResult> Layout() override;
41 42
42 private: 43 private:
43 NGBoxStrut CalculateMargins(const NGConstraintSpace& space, 44 NGBoxStrut CalculateMargins(const NGConstraintSpace& space,
44 const ComputedStyle& style); 45 const ComputedStyle& style);
45 46
46 // Creates a new constraint space for the current child. 47 // Creates a new constraint space for the current child.
47 NGConstraintSpace* CreateConstraintSpaceForCurrentChild(); 48 NGConstraintSpace* CreateConstraintSpaceForCurrentChild();
48 void FinishCurrentChildLayout(RefPtr<NGPhysicalBoxFragment>); 49 void FinishCurrentChildLayout(RefPtr<NGLayoutResult>);
49 50
50 // Layout inline children. 51 // Layout inline children.
51 void LayoutInlineChildren(NGInlineNode*); 52 void LayoutInlineChildren(NGInlineNode*);
52 53
53 // Proceed to the next sibling that still needs layout. 54 // Proceed to the next sibling that still needs layout.
54 // 55 //
55 // @param child_fragment The newly created fragment for the current child. 56 // @param child_fragment The newly created fragment for the current child.
56 // @return true if we can continue to lay out, or false if we need to abort 57 // @return true if we can continue to lay out, or false if we need to abort
57 // due to a fragmentainer break. 58 // due to a fragmentainer break.
58 bool ProceedToNextUnfinishedSibling(NGPhysicalFragment* child_fragment); 59 bool ProceedToNextUnfinishedSibling(NGPhysicalFragment* child_fragment);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // MarginStrut for the previous child. 143 // MarginStrut for the previous child.
143 NGMarginStrut curr_margin_strut_; 144 NGMarginStrut curr_margin_strut_;
144 NGLogicalOffset bfc_offset_; 145 NGLogicalOffset bfc_offset_;
145 NGLogicalOffset curr_bfc_offset_; 146 NGLogicalOffset curr_bfc_offset_;
146 NGBoxStrut curr_child_margins_; 147 NGBoxStrut curr_child_margins_;
147 }; 148 };
148 149
149 } // namespace blink 150 } // namespace blink
150 151
151 #endif // NGBlockLayoutAlgorithm_h 152 #endif // NGBlockLayoutAlgorithm_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698