| 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 NGPhysicalTextFragment_h | 5 #ifndef NGPhysicalTextFragment_h |
| 6 #define NGPhysicalTextFragment_h | 6 #define NGPhysicalTextFragment_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/ng_block_node.h" | 9 #include "core/layout/ng/ng_block_node.h" |
| 10 #include "core/layout/ng/ng_inline_node.h" | 10 #include "core/layout/ng/ng_inline_node.h" |
| 11 #include "core/layout/ng/ng_physical_fragment_base.h" | 11 #include "core/layout/ng/ng_physical_fragment.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragmentBase { | 16 class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragment { |
| 17 public: | 17 public: |
| 18 NGPhysicalTextFragment( | 18 NGPhysicalTextFragment( |
| 19 const NGInlineNode* node, | 19 const NGInlineNode* node, |
| 20 unsigned start_index, | 20 unsigned start_index, |
| 21 unsigned end_index, | 21 unsigned end_index, |
| 22 NGPhysicalSize size, | 22 NGPhysicalSize size, |
| 23 NGPhysicalSize overflow, | 23 NGPhysicalSize overflow, |
| 24 HeapLinkedHashSet<WeakMember<NGBlockNode>>& out_of_flow_descendants, | 24 HeapLinkedHashSet<WeakMember<NGBlockNode>>& out_of_flow_descendants, |
| 25 Vector<NGStaticPosition> out_of_flow_positions) | 25 Vector<NGStaticPosition> out_of_flow_positions) |
| 26 : NGPhysicalFragmentBase(size, | 26 : NGPhysicalFragment(size, |
| 27 overflow, | 27 overflow, |
| 28 kFragmentText, | 28 kFragmentText, |
| 29 out_of_flow_descendants, | 29 out_of_flow_descendants, |
| 30 out_of_flow_positions), | 30 out_of_flow_positions), |
| 31 node_(node), | 31 node_(node), |
| 32 start_index_(start_index), | 32 start_index_(start_index), |
| 33 end_index_(end_index) {} | 33 end_index_(end_index) {} |
| 34 | 34 |
| 35 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { | 35 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { |
| 36 visitor->trace(node_); | 36 visitor->trace(node_); |
| 37 NGPhysicalFragmentBase::traceAfterDispatch(visitor); | 37 NGPhysicalFragment::traceAfterDispatch(visitor); |
| 38 } | 38 } |
| 39 | 39 |
| 40 const NGInlineNode* Node() const { return node_; } | 40 const NGInlineNode* Node() const { return node_; } |
| 41 | 41 |
| 42 // The range of NGLayoutInlineItem. | 42 // The range of NGLayoutInlineItem. |
| 43 // |StartIndex| shows the lower logical index, so the visual order iteration | 43 // |StartIndex| shows the lower logical index, so the visual order iteration |
| 44 // for RTL should be done from |EndIndex - 1| to |StartIndex|. | 44 // for RTL should be done from |EndIndex - 1| to |StartIndex|. |
| 45 unsigned StartIndex() const { return start_index_; } | 45 unsigned StartIndex() const { return start_index_; } |
| 46 unsigned EndIndex() const { return end_index_; } | 46 unsigned EndIndex() const { return end_index_; } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 // TODO(kojii): NGInlineNode is to access text content and NGLayoutInlineItem. | 49 // TODO(kojii): NGInlineNode is to access text content and NGLayoutInlineItem. |
| 50 // Review if it's better to point them. | 50 // Review if it's better to point them. |
| 51 Member<const NGInlineNode> node_; | 51 Member<const NGInlineNode> node_; |
| 52 unsigned start_index_; | 52 unsigned start_index_; |
| 53 unsigned end_index_; | 53 unsigned end_index_; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 DEFINE_TYPE_CASTS(NGPhysicalTextFragment, | 56 DEFINE_TYPE_CASTS(NGPhysicalTextFragment, |
| 57 NGPhysicalFragmentBase, | 57 NGPhysicalFragment, |
| 58 text, | 58 text, |
| 59 text->Type() == NGPhysicalFragmentBase::kFragmentText, | 59 text->Type() == NGPhysicalFragment::kFragmentText, |
| 60 text.Type() == NGPhysicalFragmentBase::kFragmentText); | 60 text.Type() == NGPhysicalFragment::kFragmentText); |
| 61 | 61 |
| 62 } // namespace blink | 62 } // namespace blink |
| 63 | 63 |
| 64 #endif // NGPhysicalTextFragment_h | 64 #endif // NGPhysicalTextFragment_h |
| OLD | NEW |