| 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 NGFragment_h | 5 #ifndef NGFragment_h |
| 6 #define NGFragment_h | 6 #define NGFragment_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/ng_fragment_base.h" | 9 #include "core/layout/ng/ng_fragment_base.h" |
| 10 #include "core/layout/ng/ng_constraint_space.h" | 10 #include "core/layout/ng/ng_constraint_space.h" |
| 11 #include "core/layout/ng/ng_units.h" |
| 11 #include "platform/LayoutUnit.h" | 12 #include "platform/LayoutUnit.h" |
| 12 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 13 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class CORE_EXPORT NGFragment final : public NGFragmentBase { | 18 class CORE_EXPORT NGFragment final : public NGFragmentBase { |
| 18 public: | 19 public: |
| 19 NGFragment(LayoutUnit inlineSize, | 20 // This modified the passed-in children vector. |
| 20 LayoutUnit blockSize, | 21 NGFragment(NGLogicalSize size, |
| 21 LayoutUnit inlineOverflow, | 22 NGLogicalSize overflow, |
| 22 LayoutUnit blockOverflow, | |
| 23 NGWritingMode writingMode, | 23 NGWritingMode writingMode, |
| 24 NGDirection direction) | 24 NGDirection direction, |
| 25 : NGFragmentBase(inlineSize, | 25 HeapVector<Member<const NGFragmentBase>>& children) |
| 26 blockSize, | 26 : NGFragmentBase(size, overflow, writingMode, direction, FragmentBox) { |
| 27 inlineOverflow, | 27 children_.swap(children); |
| 28 blockOverflow, | 28 } |
| 29 writingMode, | |
| 30 direction, | |
| 31 FragmentBox) {} | |
| 32 | 29 |
| 33 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { | 30 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { |
| 34 visitor->trace(m_children); | 31 visitor->trace(children_); |
| 35 NGFragmentBase::traceAfterDispatch(visitor); | 32 NGFragmentBase::traceAfterDispatch(visitor); |
| 36 } | 33 } |
| 37 | 34 |
| 38 void swapChildren(HeapVector<Member<const NGFragmentBase>>& children) { | |
| 39 m_children.swap(children); | |
| 40 } | |
| 41 | |
| 42 private: | 35 private: |
| 43 HeapVector<Member<const NGFragmentBase>> m_children; | 36 HeapVector<Member<const NGFragmentBase>> children_; |
| 44 }; | 37 }; |
| 45 | 38 |
| 46 } // namespace blink | 39 } // namespace blink |
| 47 | 40 |
| 48 #endif // NGFragment_h | 41 #endif // NGFragment_h |
| OLD | NEW |