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

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

Issue 2954953002: [LayoutNG] Abort a layout once the BFC offset is resolved. (Closed)
Patch Set: ./ Created 3 years, 5 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 NGLayoutResult_h 5 #ifndef NGLayoutResult_h
6 #define NGLayoutResult_h 6 #define NGLayoutResult_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/geometry/ng_static_position.h" 9 #include "core/layout/ng/geometry/ng_static_position.h"
10 #include "core/layout/ng/ng_block_node.h" 10 #include "core/layout/ng/ng_block_node.h"
11 #include "core/layout/ng/ng_out_of_flow_positioned_descendant.h" 11 #include "core/layout/ng/ng_out_of_flow_positioned_descendant.h"
12 #include "core/layout/ng/ng_physical_fragment.h" 12 #include "core/layout/ng/ng_physical_fragment.h"
13 #include "core/layout/ng/ng_unpositioned_float.h" 13 #include "core/layout/ng/ng_unpositioned_float.h"
14 #include "platform/LayoutUnit.h" 14 #include "platform/LayoutUnit.h"
15 #include "platform/heap/Handle.h" 15 #include "platform/heap/Handle.h"
16 #include "platform/wtf/RefPtr.h" 16 #include "platform/wtf/RefPtr.h"
17 #include "platform/wtf/Vector.h" 17 #include "platform/wtf/Vector.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 // The NGLayoutResult stores the resulting data from layout. This includes 21 // The NGLayoutResult stores the resulting data from layout. This includes
22 // geometry information in form of a NGPhysicalFragment, which is kept around 22 // geometry information in form of a NGPhysicalFragment, which is kept around
23 // for painting, hit testing, etc., as well as additional data which is only 23 // for painting, hit testing, etc., as well as additional data which is only
24 // necessary during layout and stored on this object. 24 // necessary during layout and stored on this object.
25 // Layout code should access the NGPhysicalFragment through the wrappers in 25 // Layout code should access the NGPhysicalFragment through the wrappers in
26 // NGFragment et al. 26 // NGFragment et al.
27 class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> { 27 class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
28 public: 28 public:
29 enum NGLayoutResultStatus {
30 kSuccess = 0,
31 kBfcOffsetResolved = 1,
32 // When adding new values, make sure the bit size of |status_| is large
33 // enough to store.
34 };
35
29 RefPtr<NGPhysicalFragment> PhysicalFragment() const { 36 RefPtr<NGPhysicalFragment> PhysicalFragment() const {
30 return physical_fragment_; 37 return physical_fragment_;
31 } 38 }
39
32 RefPtr<NGPhysicalFragment>& MutablePhysicalFragment() { 40 RefPtr<NGPhysicalFragment>& MutablePhysicalFragment() {
33 return physical_fragment_; 41 return physical_fragment_;
34 } 42 }
35 43
36 const Vector<NGOutOfFlowPositionedDescendant> OutOfFlowPositionedDescendants() 44 const Vector<NGOutOfFlowPositionedDescendant> OutOfFlowPositionedDescendants()
37 const { 45 const {
38 return oof_positioned_descendants_; 46 return oof_positioned_descendants_;
39 } 47 }
40 48
41 // List of floats that need to be positioned by the next in-flow child that 49 // List of floats that need to be positioned by the next in-flow child that
42 // can determine its position in space. 50 // can determine its position in space.
43 // Use case example where it may be needed: 51 // Use case example where it may be needed:
44 // <div><float></div> 52 // <div><float></div>
45 // <div style="margin-top: 10px; height: 20px"></div> 53 // <div style="margin-top: 10px; height: 20px"></div>
46 // The float cannot be positioned right away inside of the 1st div because 54 // The float cannot be positioned right away inside of the 1st div because
47 // the vertical position is not known at that moment. It will be known only 55 // the vertical position is not known at that moment. It will be known only
48 // after the 2nd div collapses its margin with its parent. 56 // after the 2nd div collapses its margin with its parent.
49 const Vector<RefPtr<NGUnpositionedFloat>>& UnpositionedFloats() const { 57 const Vector<RefPtr<NGUnpositionedFloat>>& UnpositionedFloats() const {
50 return unpositioned_floats_; 58 return unpositioned_floats_;
51 } 59 }
52 60
61 // If...
eae 2017/07/10 23:27:49 Could you expand on this a little bit or remove th
ikilpatrick 2017/07/11 17:20:41 Done.
62 NGLayoutResultStatus Status() const {
63 return static_cast<NGLayoutResultStatus>(status_);
64 }
65
53 const WTF::Optional<NGLogicalOffset>& BfcOffset() const { 66 const WTF::Optional<NGLogicalOffset>& BfcOffset() const {
54 return bfc_offset_; 67 return bfc_offset_;
55 } 68 }
56 69
57 const NGMarginStrut EndMarginStrut() const { return end_margin_strut_; } 70 const NGMarginStrut EndMarginStrut() const { return end_margin_strut_; }
58 71
59 private: 72 private:
60 friend class NGFragmentBuilder; 73 friend class NGFragmentBuilder;
61 74
62 NGLayoutResult(PassRefPtr<NGPhysicalFragment> physical_fragment, 75 NGLayoutResult(PassRefPtr<NGPhysicalFragment> physical_fragment,
63 Vector<NGOutOfFlowPositionedDescendant> 76 Vector<NGOutOfFlowPositionedDescendant>
64 out_of_flow_positioned_descendants, 77 out_of_flow_positioned_descendants,
65 Vector<RefPtr<NGUnpositionedFloat>>& unpositioned_floats, 78 Vector<RefPtr<NGUnpositionedFloat>>& unpositioned_floats,
66 const WTF::Optional<NGLogicalOffset> bfc_offset, 79 const WTF::Optional<NGLogicalOffset> bfc_offset,
67 const NGMarginStrut end_margin_strut); 80 const NGMarginStrut end_margin_strut,
81 NGLayoutResultStatus status);
68 82
69 RefPtr<NGPhysicalFragment> physical_fragment_; 83 RefPtr<NGPhysicalFragment> physical_fragment_;
70 Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_; 84 Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_;
71 85
72 Vector<NGOutOfFlowPositionedDescendant> oof_positioned_descendants_; 86 Vector<NGOutOfFlowPositionedDescendant> oof_positioned_descendants_;
73 const WTF::Optional<NGLogicalOffset> bfc_offset_; 87 const WTF::Optional<NGLogicalOffset> bfc_offset_;
74 const NGMarginStrut end_margin_strut_; 88 const NGMarginStrut end_margin_strut_;
89
90 unsigned status_ : 1;
75 }; 91 };
76 92
77 } // namespace blink 93 } // namespace blink
78 94
79 #endif // NGLayoutResult_h 95 #endif // NGLayoutResult_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698