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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 explicit NGBox(LayoutObject* layoutObject) | 23 explicit NGBox(LayoutObject* layoutObject) |
24 : m_layoutBox(toLayoutBox(layoutObject)) {} | 24 : m_layoutBox(toLayoutBox(layoutObject)) {} |
25 | 25 |
26 NGBox() : m_layoutBox(nullptr) {} | 26 NGBox() : m_layoutBox(nullptr) {} |
27 | 27 |
28 // Returns an iterator that will iterate over this box's children, if any. | 28 // Returns an iterator that will iterate over this box's children, if any. |
29 NGBoxIterator childIterator(); | 29 NGBoxIterator childIterator(); |
30 operator bool() const { return m_layoutBox; } | 30 operator bool() const { return m_layoutBox; } |
31 | 31 |
32 NGFragment* layout(const NGConstraintSpace*); | 32 // Returns true when done; when this function returns false, it has to be |
| 33 // called again. The out parameter will only be set when this function |
| 34 // returns true. The same constraint space has to be passed each time. |
| 35 // TODO(layout-ng): Should we have a StartLayout function to avoid passing |
| 36 // the same space for each Layout iteration? |
| 37 bool Layout(const NGConstraintSpace*, NGFragment**); |
33 const ComputedStyle* style() const; | 38 const ComputedStyle* style() const; |
34 | 39 |
35 NGBox nextSibling() const; | 40 NGBox nextSibling() const; |
36 | 41 |
37 NGBox firstChild() const; | 42 NGBox firstChild() const; |
38 | 43 |
39 // 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 |
40 // 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 |
41 // underlying LayoutBox. | 46 // underlying LayoutBox. |
42 void positionUpdated(const NGFragment&); | 47 void positionUpdated(const NGFragment&); |
43 | 48 |
44 private: | 49 private: |
45 bool canUseNewLayout(); | 50 bool canUseNewLayout(); |
46 | 51 |
47 LayoutBox* m_layoutBox; | 52 LayoutBox* m_layoutBox; |
48 }; | 53 }; |
49 | 54 |
50 } // namespace blink | 55 } // namespace blink |
51 | 56 |
52 #endif // NGBox_h | 57 #endif // NGBox_h |
OLD | NEW |