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_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 "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragment { | 17 class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragment { |
18 public: | 18 public: |
19 NGPhysicalTextFragment(LayoutObject* layout_object, | 19 NGPhysicalTextFragment(LayoutObject* layout_object, |
20 const NGInlineNode* node, | 20 const NGInlineNode* node, |
21 unsigned item_index, | 21 unsigned item_index, |
22 unsigned start_offset, | 22 unsigned start_offset, |
23 unsigned end_offset, | 23 unsigned end_offset, |
24 NGPhysicalSize size, | 24 NGPhysicalSize size) |
25 NGPhysicalSize overflow) | 25 : NGPhysicalFragment(layout_object, size, kFragmentText), |
26 : NGPhysicalFragment(layout_object, size, overflow, kFragmentText), | |
27 node_(node), | 26 node_(node), |
28 item_index_(item_index), | 27 item_index_(item_index), |
29 start_offset_(start_offset), | 28 start_offset_(start_offset), |
30 end_offset_(end_offset) {} | 29 end_offset_(end_offset) {} |
31 | 30 |
32 const NGInlineNode* Node() const { return node_; } | 31 const NGInlineNode* Node() const { return node_; } |
33 StringView Text() const { return node_->Text(start_offset_, end_offset_); } | 32 StringView Text() const { return node_->Text(start_offset_, end_offset_); } |
34 | 33 |
35 // The range of NGLayoutInlineItem. | 34 // The range of NGLayoutInlineItem. |
36 unsigned ItemIndex() const { return item_index_; } | 35 unsigned ItemIndex() const { return item_index_; } |
(...skipping 11 matching lines...) Expand all Loading... |
48 | 47 |
49 DEFINE_TYPE_CASTS(NGPhysicalTextFragment, | 48 DEFINE_TYPE_CASTS(NGPhysicalTextFragment, |
50 NGPhysicalFragment, | 49 NGPhysicalFragment, |
51 text, | 50 text, |
52 text->Type() == NGPhysicalFragment::kFragmentText, | 51 text->Type() == NGPhysicalFragment::kFragmentText, |
53 text.Type() == NGPhysicalFragment::kFragmentText); | 52 text.Type() == NGPhysicalFragment::kFragmentText); |
54 | 53 |
55 } // namespace blink | 54 } // namespace blink |
56 | 55 |
57 #endif // NGPhysicalTextFragment_h | 56 #endif // NGPhysicalTextFragment_h |
OLD | NEW |