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 NGBox_h | 5 #ifndef NGBox_h |
6 #define NGBox_h | 6 #define NGBox_h |
7 | 7 |
8 #include "core/layout/LayoutBox.h" | 8 #include "core/layout/LayoutBox.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class ComputedStyle; | 14 class ComputedStyle; |
15 class LayoutBox; | 15 class LayoutBox; |
16 class NGBlockLayoutAlgorithm; | 16 class NGBlockLayoutAlgorithm; |
17 class NGConstraintSpace; | 17 class NGConstraintSpace; |
18 class NGFragment; | 18 class NGFragment; |
| 19 class NGPhysicalFragment; |
19 | 20 |
20 // Represents a node to be laid out. | 21 // Represents a node to be laid out. |
21 class CORE_EXPORT NGBox final : public GarbageCollected<NGBox> { | 22 class CORE_EXPORT NGBox final : public GarbageCollected<NGBox> { |
22 public: | 23 public: |
23 explicit NGBox(LayoutObject*); | 24 explicit NGBox(LayoutObject*); |
24 | 25 |
25 // Returns true when done; when this function returns false, it has to be | 26 // Returns true when done; when this function returns false, it has to be |
26 // called again. The out parameter will only be set when this function | 27 // called again. The out parameter will only be set when this function |
27 // returns true. The same constraint space has to be passed each time. | 28 // returns true. The same constraint space has to be passed each time. |
28 // TODO(layout-ng): Should we have a StartLayout function to avoid passing | 29 // TODO(layout-ng): Should we have a StartLayout function to avoid passing |
29 // the same space for each Layout iteration? | 30 // the same space for each Layout iteration? |
30 bool Layout(const NGConstraintSpace*, NGFragment**); | 31 bool Layout(const NGConstraintSpace*, NGFragment**); |
31 const ComputedStyle* Style() const; | 32 const ComputedStyle* Style() const; |
32 | 33 |
33 NGBox* NextSibling() const; | 34 NGBox* NextSibling() const; |
34 | 35 |
35 NGBox* FirstChild() const; | 36 NGBox* FirstChild() const; |
36 | 37 |
| 38 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 39 visitor->trace(algorithm_); |
| 40 visitor->trace(fragment_); |
| 41 } |
| 42 |
| 43 private: |
37 // This is necessary for interop between old and new trees -- after our parent | 44 // This is necessary for interop between old and new trees -- after our parent |
38 // positions us, it calls this function so we can store the position on the | 45 // positions us, it calls this function so we can store the position on the |
39 // underlying LayoutBox. | 46 // underlying LayoutBox. |
40 void PositionUpdated(const NGFragment&); | 47 void PositionUpdated(); |
41 | |
42 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(algorithm_); } | |
43 | |
44 private: | |
45 bool CanUseNewLayout(); | 48 bool CanUseNewLayout(); |
46 | 49 |
47 LayoutBox* layout_box_; | 50 LayoutBox* layout_box_; |
48 Member<NGBlockLayoutAlgorithm> algorithm_; | 51 Member<NGBlockLayoutAlgorithm> algorithm_; |
| 52 Member<NGPhysicalFragment> fragment_; |
49 }; | 53 }; |
50 | 54 |
51 } // namespace blink | 55 } // namespace blink |
52 | 56 |
53 #endif // NGBox_h | 57 #endif // NGBox_h |
OLD | NEW |