OLD | NEW |
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 NGOutOfFlowLayoutPart_h | 5 #ifndef NGOutOfFlowLayoutPart_h |
6 #define NGOutOfFlowLayoutPart_h | 6 #define NGOutOfFlowLayoutPart_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 | 9 |
10 #include "core/layout/ng/ng_units.h" | 10 #include "core/layout/ng/ng_units.h" |
11 #include "core/layout/ng/ng_constraint_space.h" | 11 #include "core/layout/ng/ng_constraint_space.h" |
12 #include "core/layout/ng/ng_absolute_utils.h" | 12 #include "core/layout/ng/ng_absolute_utils.h" |
13 #include "core/layout/ng/ng_layout_algorithm.h" | 13 #include "core/layout/ng/ng_layout_algorithm.h" |
14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
15 #include "wtf/Optional.h" | 15 #include "wtf/Optional.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class ComputedStyle; | 19 class ComputedStyle; |
20 class NGBlockNode; | 20 class NGBlockNode; |
21 class NGFragmentBase; | 21 class NGFragment; |
22 class NGConstraintSpace; | 22 class NGConstraintSpace; |
23 | 23 |
24 // Helper class for positioning of out-of-flow blocks. | 24 // Helper class for positioning of out-of-flow blocks. |
25 // It should be used together with NGFragmentBuilder. | 25 // It should be used together with NGFragmentBuilder. |
26 // See NGFragmentBuilder::AddOutOfFlowChildCandidate documentation | 26 // See NGFragmentBuilder::AddOutOfFlowChildCandidate documentation |
27 // for example of using these classes together. | 27 // for example of using these classes together. |
28 class CORE_EXPORT NGOutOfFlowLayoutPart | 28 class CORE_EXPORT NGOutOfFlowLayoutPart |
29 : public GarbageCollectedFinalized<NGOutOfFlowLayoutPart> { | 29 : public GarbageCollectedFinalized<NGOutOfFlowLayoutPart> { |
30 public: | 30 public: |
31 NGOutOfFlowLayoutPart(PassRefPtr<const ComputedStyle>, NGLogicalSize); | 31 NGOutOfFlowLayoutPart(PassRefPtr<const ComputedStyle>, NGLogicalSize); |
32 | 32 |
33 // If false, this fragment should be passed up the tree for layout by | 33 // If false, this fragment should be passed up the tree for layout by |
34 // an ancestor. | 34 // an ancestor. |
35 bool StartLayout(NGBlockNode*, const NGStaticPosition&); | 35 bool StartLayout(NGBlockNode*, const NGStaticPosition&); |
36 NGLayoutStatus Layout(NGFragmentBase**, NGLogicalOffset*); | 36 NGLayoutStatus Layout(NGFragment**, NGLogicalOffset*); |
37 | 37 |
38 DECLARE_TRACE(); | 38 DECLARE_TRACE(); |
39 | 39 |
40 private: | 40 private: |
41 bool ComputeInlineSizeEstimate(); | 41 bool ComputeInlineSizeEstimate(); |
42 bool ComputeBlockSizeEstimate(); | 42 bool ComputeBlockSizeEstimate(); |
43 bool ComputeNodeFragment(); | 43 bool ComputeNodeFragment(); |
44 | 44 |
45 bool contains_fixed_; | 45 bool contains_fixed_; |
46 bool contains_absolute_; | 46 bool contains_absolute_; |
47 | 47 |
48 enum State { | 48 enum State { |
49 kComputeInlineEstimate, | 49 kComputeInlineEstimate, |
50 kPartialPosition, | 50 kPartialPosition, |
51 kComputeBlockEstimate, | 51 kComputeBlockEstimate, |
52 kFullPosition, | 52 kFullPosition, |
53 kGenerateFragment, | 53 kGenerateFragment, |
54 kDone | 54 kDone |
55 }; | 55 }; |
56 State state_; | 56 State state_; |
57 | 57 |
58 NGStaticPosition static_position_; | 58 NGStaticPosition static_position_; |
59 NGLogicalOffset parent_offset_; | 59 NGLogicalOffset parent_offset_; |
60 NGPhysicalOffset parent_physical_offset_; | 60 NGPhysicalOffset parent_physical_offset_; |
61 Member<NGConstraintSpace> parent_space_; | 61 Member<NGConstraintSpace> parent_space_; |
62 Member<NGBlockNode> node_; | 62 Member<NGBlockNode> node_; |
63 Member<NGConstraintSpace> node_space_; | 63 Member<NGConstraintSpace> node_space_; |
64 Member<NGFragmentBase> node_fragment_; | 64 Member<NGFragment> node_fragment_; |
65 NGAbsolutePhysicalPosition node_position_; | 65 NGAbsolutePhysicalPosition node_position_; |
66 Optional<LayoutUnit> inline_estimate_; | 66 Optional<LayoutUnit> inline_estimate_; |
67 Optional<LayoutUnit> block_estimate_; | 67 Optional<LayoutUnit> block_estimate_; |
68 }; | 68 }; |
69 | 69 |
70 } // namespace blink | 70 } // namespace blink |
71 | 71 |
72 #endif | 72 #endif |
OLD | NEW |