Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_box.h

Issue 2284983002: [layoutng] Implement state machine for async layout (Closed)
Patch Set: NOTREACHED, also fix the windows compile error Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 NGBoxIterator; 16 class NGBlockLayoutAlgorithm;
17 class NGConstraintSpace; 17 class NGConstraintSpace;
18 class NGFragment; 18 class NGFragment;
19 19
20 // Represents a node to be laid out. 20 // Represents a node to be laid out.
21 class CORE_EXPORT NGBox final { 21 class CORE_EXPORT NGBox final : public GarbageCollected<NGBox> {
22 public: 22 public:
23 explicit NGBox(LayoutObject* layoutObject) 23 explicit NGBox(LayoutObject*);
24 : m_layoutBox(toLayoutBox(layoutObject)) {}
25
26 NGBox() : m_layoutBox(nullptr) {}
27
28 // Returns an iterator that will iterate over this box's children, if any.
29 NGBoxIterator childIterator();
30 operator bool() const { return m_layoutBox; }
31 24
32 // Returns true when done; when this function returns false, it has to be 25 // 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 26 // 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. 27 // 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 28 // TODO(layout-ng): Should we have a StartLayout function to avoid passing
36 // the same space for each Layout iteration? 29 // the same space for each Layout iteration?
37 bool Layout(const NGConstraintSpace*, NGFragment**); 30 bool Layout(const NGConstraintSpace*, NGFragment**);
38 const ComputedStyle* style() const; 31 const ComputedStyle* Style() const;
39 32
40 NGBox nextSibling() const; 33 NGBox* NextSibling() const;
41 34
42 NGBox firstChild() const; 35 NGBox* FirstChild() const;
43 36
44 // This is necessary for interop between old and new trees -- after our parent 37 // This is necessary for interop between old and new trees -- after our parent
45 // positions us, it calls this function so we can store the position on the 38 // positions us, it calls this function so we can store the position on the
46 // underlying LayoutBox. 39 // underlying LayoutBox.
47 void positionUpdated(const NGFragment&); 40 void PositionUpdated(const NGFragment&);
41
42 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(algorithm_); }
48 43
49 private: 44 private:
50 bool canUseNewLayout(); 45 bool CanUseNewLayout();
51 46
52 LayoutBox* m_layoutBox; 47 LayoutBox* layout_box_;
48 Member<NGBlockLayoutAlgorithm> algorithm_;
53 }; 49 };
54 50
55 } // namespace blink 51 } // namespace blink
56 52
57 #endif // NGBox_h 53 #endif // NGBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698