Chromium Code Reviews| 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 NGPhysicalFragment_h | 5 #ifndef NGPhysicalFragment_h |
| 6 #define NGPhysicalFragment_h | 6 #define NGPhysicalFragment_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/ng_physical_fragment_base.h" | 9 #include "core/layout/ng/ng_physical_fragment_base.h" |
| 10 #include "core/layout/ng/ng_units.h" | 10 #include "core/layout/ng/ng_units.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class CORE_EXPORT NGPhysicalFragment final : public NGPhysicalFragmentBase { | 16 class CORE_EXPORT NGPhysicalFragment final : public NGPhysicalFragmentBase { |
| 17 public: | 17 public: |
| 18 // This modifies the passed-in children vector. | 18 // This modifies the passed-in children vector. |
| 19 NGPhysicalFragment(NGPhysicalSize size, | 19 NGPhysicalFragment(NGPhysicalSize size, |
| 20 NGPhysicalSize overflow, | 20 NGPhysicalSize overflow, |
| 21 HeapVector<Member<const NGPhysicalFragmentBase>>& children, | 21 HeapVector<Member<const NGPhysicalFragmentBase>>& children, |
| 22 NGMarginStrut margin_strut) | 22 NGMarginStrut margin_strut, |
| 23 : NGPhysicalFragmentBase(size, overflow, FragmentBox, margin_strut) { | 23 NGWritingMode margin_strut_writing_mode) |
| 24 : NGPhysicalFragmentBase(size, overflow, FragmentBox), | |
| 25 margin_strut_(margin_strut), | |
| 26 margin_strut_writing_mode_(margin_strut_writing_mode) { | |
| 24 children_.swap(children); | 27 children_.swap(children); |
| 25 } | 28 } |
| 26 | 29 |
| 27 const HeapVector<Member<const NGPhysicalFragmentBase>>& Children() const { | 30 const HeapVector<Member<const NGPhysicalFragmentBase>>& Children() const { |
| 28 return children_; | 31 return children_; |
| 29 } | 32 } |
| 30 | 33 |
| 34 NGMarginStrut MarginStrut() const { return margin_strut_; } | |
| 35 NGWritingMode MarginStrutWritingMode() const { | |
| 36 return static_cast<NGWritingMode>(margin_strut_writing_mode_); | |
| 37 } | |
| 38 | |
| 31 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { | 39 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { |
| 32 visitor->trace(children_); | 40 visitor->trace(children_); |
| 33 NGPhysicalFragmentBase::traceAfterDispatch(visitor); | 41 NGPhysicalFragmentBase::traceAfterDispatch(visitor); |
| 34 } | 42 } |
| 35 | 43 |
| 36 private: | 44 private: |
| 37 HeapVector<Member<const NGPhysicalFragmentBase>> children_; | 45 HeapVector<Member<const NGPhysicalFragmentBase>> children_; |
| 46 | |
| 47 NGMarginStrut margin_strut_; | |
| 48 unsigned margin_strut_writing_mode_ : 2; | |
|
Gleb Lanbin
2016/10/13 23:59:51
move writing_mode to NGMarginStrut ?
| |
| 38 }; | 49 }; |
| 39 | 50 |
| 40 WILL_NOT_BE_EAGERLY_TRACED_CLASS(NGPhysicalFragment); | 51 WILL_NOT_BE_EAGERLY_TRACED_CLASS(NGPhysicalFragment); |
| 41 | 52 |
| 53 DEFINE_TYPE_CASTS(NGPhysicalFragment, | |
| 54 NGPhysicalFragmentBase, | |
| 55 fragment, | |
| 56 fragment->Type() == NGPhysicalFragmentBase::FragmentBox, | |
| 57 fragment.Type() == NGPhysicalFragmentBase::FragmentBox); | |
| 58 | |
| 42 } // namespace blink | 59 } // namespace blink |
| 43 | 60 |
| 44 #endif // NGPhysicalFragment_h | 61 #endif // NGPhysicalFragment_h |
| OLD | NEW |