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