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 NGInlineLayoutAlgorithm_h | 5 #ifndef NGInlineLayoutAlgorithm_h |
6 #define NGInlineLayoutAlgorithm_h | 6 #define NGInlineLayoutAlgorithm_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_layout_algorithm.h" | 9 #include "core/layout/ng/ng_layout_algorithm.h" |
10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // @param style Style reference of the block that is being laid out. | 30 // @param style Style reference of the block that is being laid out. |
31 // @param first_child Our first child; the algorithm will use its NextSibling | 31 // @param first_child Our first child; the algorithm will use its NextSibling |
32 // method to access all the children. | 32 // method to access all the children. |
33 // @param space The constraint space which the algorithm should generate a | 33 // @param space The constraint space which the algorithm should generate a |
34 // fragment within. | 34 // fragment within. |
35 NGInlineLayoutAlgorithm(PassRefPtr<const ComputedStyle>, | 35 NGInlineLayoutAlgorithm(PassRefPtr<const ComputedStyle>, |
36 NGInlineNode* first_child, | 36 NGInlineNode* first_child, |
37 NGConstraintSpace* space, | 37 NGConstraintSpace* space, |
38 NGBreakToken* break_token = nullptr); | 38 NGBreakToken* break_token = nullptr); |
39 | 39 |
40 NGLayoutStatus Layout(NGPhysicalFragment*, | 40 NGPhysicalFragment* Layout() override; |
41 NGPhysicalFragment**, | |
42 NGLayoutAlgorithm**) override; | |
43 | 41 |
44 DECLARE_VIRTUAL_TRACE(); | 42 DECLARE_VIRTUAL_TRACE(); |
45 | 43 |
46 private: | 44 private: |
47 // Read-only Getters. | 45 // Read-only Getters. |
48 const ComputedStyle& Style() const { return *style_; } | 46 const ComputedStyle& Style() const { return *style_; } |
49 | 47 |
50 bool LayoutCurrentChild(); | 48 bool LayoutCurrentChild(); |
51 NGConstraintSpace* CreateConstraintSpaceForCurrentChild() const; | 49 NGConstraintSpace* CreateConstraintSpaceForCurrentChild() const; |
52 | 50 |
53 enum State { kStateInit, kStateChildLayout, kStateFinalize }; | |
54 State state_ = kStateInit; | |
55 | |
56 RefPtr<const ComputedStyle> style_; | 51 RefPtr<const ComputedStyle> style_; |
57 Member<NGInlineNode> first_child_; | 52 Member<NGInlineNode> first_child_; |
58 Member<NGConstraintSpace> constraint_space_; | 53 Member<NGConstraintSpace> constraint_space_; |
59 Member<NGBreakToken> break_token_; | 54 Member<NGBreakToken> break_token_; |
60 Member<NGFragmentBuilder> builder_; | 55 Member<NGFragmentBuilder> builder_; |
61 Member<NGConstraintSpace> space_for_current_child_; | 56 Member<NGConstraintSpace> space_for_current_child_; |
62 Member<NGInlineNode> current_child_; | 57 Member<NGInlineNode> current_child_; |
63 Member<NGLineBuilder> line_builder_; | 58 Member<NGLineBuilder> line_builder_; |
64 }; | 59 }; |
65 | 60 |
66 } // namespace blink | 61 } // namespace blink |
67 | 62 |
68 #endif // NGInlineLayoutAlgorithm_h | 63 #endif // NGInlineLayoutAlgorithm_h |
OLD | NEW |