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

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

Issue 2649583002: [LayoutNG] Remove the ng_layout_coordinator and temporary LayoutSync method. (Closed)
Patch Set: rebase v2 Created 3 years, 11 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 "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
11 #include "wtf/Noncopyable.h" 11 #include "wtf/Noncopyable.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 struct MinAndMaxContentSizes; 15 struct MinAndMaxContentSizes;
16 class NGBlockNode;
17 class NGConstraintSpace; 16 class NGConstraintSpace;
18 class NGPhysicalFragment; 17 class NGPhysicalFragment;
19 18
20 enum NGLayoutStatus { kNotFinished, kChildAlgorithmRequired, kNewFragment }; 19 enum NGLayoutStatus { kNotFinished, kChildAlgorithmRequired, kNewFragment };
21 20
22 enum NGLayoutAlgorithmType { 21 enum NGLayoutAlgorithmType {
23 kBlockLayoutAlgorithm, 22 kBlockLayoutAlgorithm,
24 kInlineLayoutAlgorithm, 23 kInlineLayoutAlgorithm,
25 kLegacyBlockLayoutAlgorithm, 24 kLegacyBlockLayoutAlgorithm,
26 kTextLayoutAlgorithm 25 kTextLayoutAlgorithm
27 }; 26 };
28 27
29 // Base class for all LayoutNG algorithms. 28 // Base class for all LayoutNG algorithms.
30 class CORE_EXPORT NGLayoutAlgorithm 29 class CORE_EXPORT NGLayoutAlgorithm
31 : public GarbageCollectedFinalized<NGLayoutAlgorithm> { 30 : public GarbageCollectedFinalized<NGLayoutAlgorithm> {
32 WTF_MAKE_NONCOPYABLE(NGLayoutAlgorithm); 31 WTF_MAKE_NONCOPYABLE(NGLayoutAlgorithm);
33 32
34 public: 33 public:
35 NGLayoutAlgorithm(NGLayoutAlgorithmType type) : type_(type) {} 34 NGLayoutAlgorithm(NGLayoutAlgorithmType type) : type_(type) {}
36 virtual ~NGLayoutAlgorithm() {} 35 virtual ~NGLayoutAlgorithm() {}
37 36
38 // Actual layout function. Lays out the children and descendents within the 37 // Actual layout function. Lays out the children and descendents within the
39 // constraints given by the NGConstraintSpace. Returns a fragment with the 38 // constraints given by the NGConstraintSpace. Returns a fragment with the
40 // resulting layout information. 39 // resulting layout information.
41 // This function can not be const because for interruptible layout, we have 40 // TODO(layout-dev): attempt to make this function const.
42 // to be able to store state information. 41 virtual NGPhysicalFragment* Layout() = 0;
43 // If this function returns NotFinished, it has to be called again.
44 // If it returns ChildAlgorithmRequired, the NGBlockNode out parameter will
45 // be set with the NGBlockNode that needs to be layed out next.
46 // If it returns NewFragment, the NGPhysicalFragmentBase out parameter
47 // will contain the new fragment.
48 virtual NGLayoutStatus Layout(NGPhysicalFragment*,
49 NGPhysicalFragment**,
50 NGLayoutAlgorithm**) = 0;
51 42
52 enum MinAndMaxState { kSuccess, kPending, kNotImplemented }; 43 enum MinAndMaxState { kSuccess, kPending, kNotImplemented };
53 44
54 // Computes the min-content and max-content intrinsic sizes for the given box. 45 // Computes the min-content and max-content intrinsic sizes for the given box.
55 // The result will not take any min-width, max-width or width properties into 46 // The result will not take any min-width, max-width or width properties into
56 // account. Implementations can return false, in which case the caller is 47 // account. Implementations can return false, in which case the caller is
57 // expected to synthesize this value from the overflow rect returned from 48 // expected to synthesize this value from the overflow rect returned from
58 // Layout called with a available width of 0 and LayoutUnit::max(), 49 // Layout called with a available width of 0 and LayoutUnit::max(),
59 // respectively. 50 // respectively.
60 virtual bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) { 51 virtual bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) {
61 return false; 52 return false;
62 } 53 }
63 54
64 DEFINE_INLINE_VIRTUAL_TRACE() {} 55 DEFINE_INLINE_VIRTUAL_TRACE() {}
65 56
66 NGLayoutAlgorithmType algorithmType() const { return type_; } 57 NGLayoutAlgorithmType algorithmType() const { return type_; }
67 58
68 private: 59 private:
69 NGLayoutAlgorithmType type_; 60 NGLayoutAlgorithmType type_;
70 }; 61 };
71 62
72 } // namespace blink 63 } // namespace blink
73 64
74 #endif // NGLayoutAlgorithm_h 65 #endif // NGLayoutAlgorithm_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698