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_physical_fragment_base.h" | 9 #include "core/layout/ng/ng_physical_fragment_base.h" |
10 #include "core/layout/ng/ng_layout_input_text.h" | 10 #include "core/layout/ng/ng_layout_input_text.h" |
11 #include "platform/LayoutUnit.h" | 11 #include "platform/LayoutUnit.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragmentBase { | 17 class CORE_EXPORT NGPhysicalTextFragment final : public NGPhysicalFragmentBase { |
18 public: | 18 public: |
19 NGPhysicalTextFragment(NGPhysicalSize size, NGPhysicalSize overflow) | 19 NGPhysicalTextFragment(NGPhysicalSize size, NGPhysicalSize overflow) |
20 : NGPhysicalFragmentBase(size, overflow, FragmentText, {}) {} | 20 : NGPhysicalFragmentBase(size, overflow, FragmentText) {} |
21 | 21 |
22 String Text() const { return text_list_->Text(start_offset_, end_offset_); } | 22 String Text() const { return text_list_->Text(start_offset_, end_offset_); } |
23 | 23 |
24 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { | 24 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { |
25 visitor->trace(text_list_); | 25 visitor->trace(text_list_); |
26 NGPhysicalFragmentBase::traceAfterDispatch(visitor); | 26 NGPhysicalFragmentBase::traceAfterDispatch(visitor); |
27 } | 27 } |
28 | 28 |
29 private: | 29 private: |
30 Member<NGLayoutInputText> text_list_; | 30 Member<NGLayoutInputText> text_list_; |
31 unsigned start_offset_; | 31 unsigned start_offset_; |
32 unsigned end_offset_; | 32 unsigned end_offset_; |
33 }; | 33 }; |
34 | 34 |
35 DEFINE_TYPE_CASTS(NGPhysicalTextFragment, | 35 DEFINE_TYPE_CASTS(NGPhysicalTextFragment, |
36 NGPhysicalFragmentBase, | 36 NGPhysicalFragmentBase, |
37 text, | 37 text, |
38 text->Type() == NGPhysicalFragmentBase::FragmentText, | 38 text->Type() == NGPhysicalFragmentBase::FragmentText, |
39 text.Type() == NGPhysicalFragmentBase::FragmentText); | 39 text.Type() == NGPhysicalFragmentBase::FragmentText); |
40 | 40 |
41 } // namespace blink | 41 } // namespace blink |
42 | 42 |
43 #endif // NGPhysicalTextFragment_h | 43 #endif // NGPhysicalTextFragment_h |
OLD | NEW |