| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 NGInlineBreakToken_h | 5 #ifndef NGInlineBreakToken_h |
| 6 #define NGInlineBreakToken_h | 6 #define NGInlineBreakToken_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/inline/ng_inline_node.h" |
| 9 #include "core/layout/ng/ng_break_token.h" | 10 #include "core/layout/ng/ng_break_token.h" |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 class NGInlineNode; | 14 class NGInlineNode; |
| 14 | 15 |
| 15 // Represents a break token for an inline node. | 16 // Represents a break token for an inline node. |
| 16 class CORE_EXPORT NGInlineBreakToken : public NGBreakToken { | 17 class CORE_EXPORT NGInlineBreakToken : public NGBreakToken { |
| 17 public: | 18 public: |
| 18 // Creates a break token for a node which did fragment, and can potentially | 19 // Creates a break token for a node which did fragment, and can potentially |
| 19 // produce more fragments. | 20 // produce more fragments. |
| 20 static RefPtr<NGInlineBreakToken> Create(NGInlineNode* node, | 21 static RefPtr<NGInlineBreakToken> Create(NGInlineNode node, |
| 21 unsigned item_index, | 22 unsigned item_index, |
| 22 unsigned text_offset) { | 23 unsigned text_offset) { |
| 23 return AdoptRef(new NGInlineBreakToken(node, item_index, text_offset)); | 24 return AdoptRef(new NGInlineBreakToken(node, item_index, text_offset)); |
| 24 } | 25 } |
| 25 | 26 |
| 26 // Creates a break token for a node which cannot produce any more fragments. | 27 // Creates a break token for a node which cannot produce any more fragments. |
| 27 static RefPtr<NGInlineBreakToken> Create(NGLayoutInputNode* node) { | 28 static RefPtr<NGInlineBreakToken> Create(NGLayoutInputNode node) { |
| 28 return AdoptRef(new NGInlineBreakToken(node)); | 29 return AdoptRef(new NGInlineBreakToken(node)); |
| 29 } | 30 } |
| 30 | 31 |
| 31 unsigned ItemIndex() const { return item_index_; } | 32 unsigned ItemIndex() const { return item_index_; } |
| 32 unsigned TextOffset() const { return text_offset_; } | 33 unsigned TextOffset() const { return text_offset_; } |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 NGInlineBreakToken(NGInlineNode* node, | 36 NGInlineBreakToken(NGInlineNode node, |
| 36 unsigned item_index, | 37 unsigned item_index, |
| 37 unsigned text_offset); | 38 unsigned text_offset); |
| 38 | 39 |
| 39 explicit NGInlineBreakToken(NGLayoutInputNode* node); | 40 explicit NGInlineBreakToken(NGLayoutInputNode node); |
| 40 | 41 |
| 41 unsigned item_index_; | 42 unsigned item_index_; |
| 42 unsigned text_offset_; | 43 unsigned text_offset_; |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 DEFINE_TYPE_CASTS(NGInlineBreakToken, | 46 DEFINE_TYPE_CASTS(NGInlineBreakToken, |
| 46 NGBreakToken, | 47 NGBreakToken, |
| 47 token, | 48 token, |
| 48 token->IsInlineType(), | 49 token->IsInlineType(), |
| 49 token.IsInlineType()); | 50 token.IsInlineType()); |
| 50 | 51 |
| 51 } // namespace blink | 52 } // namespace blink |
| 52 | 53 |
| 53 #endif // NGInlineBreakToken_h | 54 #endif // NGInlineBreakToken_h |
| OLD | NEW |