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