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

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

Issue 2282213002: [LayoutNG] Introduce NGPhysicalFragment and make NGFragment a 'view' (Closed)
Patch Set: address comments. Created 4 years, 3 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_box.h" 9 #include "core/layout/ng/ng_box.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_layout_algorithm.h" 11 #include "core/layout/ng/ng_layout_algorithm.h"
12 #include "wtf/RefPtr.h" 12 #include "wtf/RefPtr.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class ComputedStyle; 16 class ComputedStyle;
17 class NGConstraintSpace; 17 class NGConstraintSpace;
18 class NGFragment; 18 class NGPhysicalFragment;
19 19
20 // A class for general block layout (e.g. a <div> with no special style). 20 // A class for general block layout (e.g. a <div> with no special style).
21 // Lays out the children in sequence. 21 // Lays out the children in sequence.
22 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { 22 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm {
23 public: 23 public:
24 // Default constructor. 24 // Default constructor.
25 // @param style Style reference of the block that is being laid out. 25 // @param style Style reference of the block that is being laid out.
26 // @param first_child Our first child; the algorithm will use its NextSibling 26 // @param first_child Our first child; the algorithm will use its NextSibling
27 // method to access all the children. 27 // method to access all the children.
28 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, NGBox* first_child); 28 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, NGBox* first_child);
29 29
30 // Actual layout implementation. Lays out the children in sequence within the 30 // Actual layout implementation. Lays out the children in sequence within the
31 // constraints given by the NGConstraintSpace. Returns a fragment with the 31 // constraints given by the NGConstraintSpace. Returns a fragment with the
32 // resulting layout information. 32 // resulting layout information.
33 // This function can not be const because for interruptible layout, we have 33 // This function can not be const because for interruptible layout, we have
34 // to be able to store state information. 34 // to be able to store state information.
35 // Returns true when done; when this function returns false, it has to be 35 // Returns true when done; when this function returns false, it has to be
36 // called again. The out parameter will only be set when this function 36 // called again. The out parameter will only be set when this function
37 // returns true. The same constraint space has to be passed each time. 37 // returns true. The same constraint space has to be passed each time.
38 bool Layout(const NGConstraintSpace*, NGFragment**) override; 38 bool Layout(const NGConstraintSpace*, NGPhysicalFragment**) override;
39 39
40 DEFINE_INLINE_VIRTUAL_TRACE() { 40 DEFINE_INLINE_VIRTUAL_TRACE() {
41 NGLayoutAlgorithm::trace(visitor); 41 NGLayoutAlgorithm::trace(visitor);
42 visitor->trace(first_child_); 42 visitor->trace(first_child_);
43 visitor->trace(builder_); 43 visitor->trace(builder_);
44 visitor->trace(constraint_space_for_children_); 44 visitor->trace(constraint_space_for_children_);
45 visitor->trace(current_child_); 45 visitor->trace(current_child_);
46 } 46 }
47 47
48 private: 48 private:
49 RefPtr<const ComputedStyle> style_; 49 RefPtr<const ComputedStyle> style_;
50 Member<NGBox> first_child_; 50 Member<NGBox> first_child_;
51 51
52 enum State { kStateInit, kStateChildLayout, kStateFinalize }; 52 enum State { kStateInit, kStateChildLayout, kStateFinalize };
53 State state_; 53 State state_;
54 Member<NGFragmentBuilder> builder_; 54 Member<NGFragmentBuilder> builder_;
55 Member<NGConstraintSpace> constraint_space_for_children_; 55 Member<NGConstraintSpace> constraint_space_for_children_;
56 Member<NGBox> current_child_; 56 Member<NGBox> current_child_;
57 LayoutUnit content_size_; 57 LayoutUnit content_size_;
58 LayoutUnit max_inline_size_; 58 LayoutUnit max_inline_size_;
59 }; 59 };
60 60
61 } // namespace blink 61 } // namespace blink
62 62
63 #endif // NGBlockLayoutAlgorithm_h 63 #endif // NGBlockLayoutAlgorithm_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('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