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 NGPhysicalBoxFragment_h | 5 #ifndef NGPhysicalBoxFragment_h |
6 #define NGPhysicalBoxFragment_h | 6 #define NGPhysicalBoxFragment_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/geometry/ng_logical_offset.h" | 9 #include "core/layout/ng/geometry/ng_logical_offset.h" |
10 #include "core/layout/ng/geometry/ng_margin_strut.h" | 10 #include "core/layout/ng/geometry/ng_margin_strut.h" |
11 #include "core/layout/ng/ng_floating_object.h" | 11 #include "core/layout/ng/ng_floating_object.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_positioned_float.h" |
13 #include "platform/wtf/Optional.h" | 14 #include "platform/wtf/Optional.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 struct NGFloatingObject; | |
18 | |
19 class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment { | 18 class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment { |
20 public: | 19 public: |
21 // This modifies the passed-in children vector. | 20 // This modifies the passed-in children vector. |
22 NGPhysicalBoxFragment(LayoutObject* layout_object, | 21 NGPhysicalBoxFragment(LayoutObject* layout_object, |
23 NGPhysicalSize size, | 22 NGPhysicalSize size, |
24 NGPhysicalSize overflow, | 23 NGPhysicalSize overflow, |
25 Vector<RefPtr<NGPhysicalFragment>>& children, | 24 Vector<RefPtr<NGPhysicalFragment>>& children, |
26 Vector<RefPtr<NGFloatingObject>>& positioned_floats, | 25 Vector<NGPositionedFloat>& positioned_floats, |
27 const WTF::Optional<NGLogicalOffset>& bfc_offset, | 26 const WTF::Optional<NGLogicalOffset>& bfc_offset, |
28 const NGMarginStrut& end_margin_strut, | 27 const NGMarginStrut& end_margin_strut, |
29 RefPtr<NGBreakToken> break_token = nullptr); | 28 RefPtr<NGBreakToken> break_token = nullptr); |
30 | 29 |
31 // Returns the total size, including the contents outside of the border-box. | 30 // Returns the total size, including the contents outside of the border-box. |
32 NGPhysicalSize OverflowSize() const { return overflow_; } | 31 NGPhysicalSize OverflowSize() const { return overflow_; } |
33 | 32 |
34 const Vector<RefPtr<NGPhysicalFragment>>& Children() const { | 33 const Vector<RefPtr<NGPhysicalFragment>>& Children() const { |
35 return children_; | 34 return children_; |
36 } | 35 } |
37 | 36 |
38 // List of positioned floats that need to be copied to the old layout tree. | 37 // List of positioned floats that need to be copied to the old layout tree. |
39 // TODO(layout-ng): remove this once we change painting code to handle floats | 38 // TODO(layout-ng): remove this once we change painting code to handle floats |
40 // differently. | 39 // differently. |
41 const Vector<RefPtr<NGFloatingObject>>& PositionedFloats() const { | 40 const Vector<NGPositionedFloat>& PositionedFloats() const { |
42 return positioned_floats_; | 41 return positioned_floats_; |
43 } | 42 } |
44 | 43 |
45 const WTF::Optional<NGLogicalOffset>& BfcOffset() const { | 44 const WTF::Optional<NGLogicalOffset>& BfcOffset() const { |
46 return bfc_offset_; | 45 return bfc_offset_; |
47 } | 46 } |
48 | 47 |
49 const NGMarginStrut& EndMarginStrut() const { return end_margin_strut_; } | 48 const NGMarginStrut& EndMarginStrut() const { return end_margin_strut_; } |
50 | 49 |
51 private: | 50 private: |
52 NGPhysicalSize overflow_; | 51 NGPhysicalSize overflow_; |
53 Vector<RefPtr<NGPhysicalFragment>> children_; | 52 Vector<RefPtr<NGPhysicalFragment>> children_; |
54 Vector<RefPtr<NGFloatingObject>> positioned_floats_; | 53 Vector<NGPositionedFloat> positioned_floats_; |
55 const WTF::Optional<NGLogicalOffset> bfc_offset_; | 54 const WTF::Optional<NGLogicalOffset> bfc_offset_; |
56 const NGMarginStrut end_margin_strut_; | 55 const NGMarginStrut end_margin_strut_; |
57 }; | 56 }; |
58 | 57 |
59 DEFINE_TYPE_CASTS(NGPhysicalBoxFragment, | 58 DEFINE_TYPE_CASTS(NGPhysicalBoxFragment, |
60 NGPhysicalFragment, | 59 NGPhysicalFragment, |
61 fragment, | 60 fragment, |
62 fragment->Type() == NGPhysicalFragment::kFragmentBox, | 61 fragment->Type() == NGPhysicalFragment::kFragmentBox, |
63 fragment.Type() == NGPhysicalFragment::kFragmentBox); | 62 fragment.Type() == NGPhysicalFragment::kFragmentBox); |
64 | 63 |
65 } // namespace blink | 64 } // namespace blink |
66 | 65 |
67 #endif // NGPhysicalBoxFragment_h | 66 #endif // NGPhysicalBoxFragment_h |
OLD | NEW |