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

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

Issue 2921463004: [LayoutNG] PODify NGLayoutInputNode and sub-classes. (Closed)
Patch Set: new ng-bot expectations Created 3 years, 6 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 NGLayoutAlgorithm_h 5 #ifndef NGLayoutAlgorithm_h
6 #define NGLayoutAlgorithm_h 6 #define NGLayoutAlgorithm_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_floats_utils.h" 9 #include "core/layout/ng/ng_floats_utils.h"
10 #include "core/layout/ng/ng_fragment_builder.h" 10 #include "core/layout/ng/ng_fragment_builder.h"
11 #include "core/layout/ng/ng_min_max_content_size.h" 11 #include "core/layout/ng/ng_min_max_content_size.h"
12 #include "platform/wtf/Allocator.h" 12 #include "platform/wtf/Allocator.h"
13 #include "platform/wtf/Optional.h" 13 #include "platform/wtf/Optional.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class ComputedStyle; 17 class ComputedStyle;
18 class NGConstraintSpace; 18 class NGConstraintSpace;
19 class NGLayoutResult; 19 class NGLayoutResult;
20 20
21 // Base class for all LayoutNG algorithms. 21 // Base class for all LayoutNG algorithms.
22 template <typename NGInputNodeType, typename NGBreakTokenType> 22 template <typename NGInputNodeType, typename NGBreakTokenType>
23 class CORE_EXPORT NGLayoutAlgorithm { 23 class CORE_EXPORT NGLayoutAlgorithm {
24 STACK_ALLOCATED(); 24 STACK_ALLOCATED();
25 public: 25 public:
26 NGLayoutAlgorithm(NGInputNodeType* node, 26 NGLayoutAlgorithm(NGInputNodeType node,
27 NGConstraintSpace* space, 27 NGConstraintSpace* space,
28 NGBreakTokenType* break_token) 28 NGBreakTokenType* break_token)
29 : node_(node), 29 : node_(node),
30 constraint_space_(space), 30 constraint_space_(space),
31 break_token_(break_token), 31 break_token_(break_token),
32 container_builder_(NGPhysicalFragment::kFragmentBox, node) {} 32 container_builder_(NGPhysicalFragment::kFragmentBox, node) {}
33 33
34 virtual ~NGLayoutAlgorithm() {} 34 virtual ~NGLayoutAlgorithm() {}
35 35
36 // Actual layout function. Lays out the children and descendants within the 36 // Actual layout function. Lays out the children and descendants within the
(...skipping 11 matching lines...) Expand all
48 return WTF::nullopt; 48 return WTF::nullopt;
49 } 49 }
50 50
51 protected: 51 protected:
52 const NGConstraintSpace& ConstraintSpace() const { 52 const NGConstraintSpace& ConstraintSpace() const {
53 DCHECK(constraint_space_); 53 DCHECK(constraint_space_);
54 return *constraint_space_; 54 return *constraint_space_;
55 } 55 }
56 NGConstraintSpace* MutableConstraintSpace() { return constraint_space_; } 56 NGConstraintSpace* MutableConstraintSpace() { return constraint_space_; }
57 57
58 const ComputedStyle& Style() const { 58 const ComputedStyle& Style() const { return node_.Style(); }
59 DCHECK(node_);
60 return node_->Style();
61 }
62 59
63 NGLogicalOffset ContainerBfcOffset() const { 60 NGLogicalOffset ContainerBfcOffset() const {
64 DCHECK(container_builder_.BfcOffset().has_value()); 61 DCHECK(container_builder_.BfcOffset().has_value());
65 return container_builder_.BfcOffset().value(); 62 return container_builder_.BfcOffset().value();
66 } 63 }
67 64
68 virtual NGInputNodeType* Node() const { return node_; } 65 virtual NGInputNodeType Node() const { return node_; }
69 66
70 NGBreakTokenType* BreakToken() const { return break_token_; } 67 NGBreakTokenType* BreakToken() const { return break_token_; }
71 68
72 Persistent<NGInputNodeType> node_; 69 NGInputNodeType node_;
73 NGConstraintSpace* constraint_space_; 70 NGConstraintSpace* constraint_space_;
74 71
75 // The break token from which we are currently resuming layout. 72 // The break token from which we are currently resuming layout.
76 NGBreakTokenType* break_token_; 73 NGBreakTokenType* break_token_;
77 74
78 NGFragmentBuilder container_builder_; 75 NGFragmentBuilder container_builder_;
79 }; 76 };
80 77
81 } // namespace blink 78 } // namespace blink
82 79
83 #endif // NGLayoutAlgorithm_h 80 #endif // NGLayoutAlgorithm_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698