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 NGBreakToken_h | 5 #ifndef NGBreakToken_h |
6 #define NGBreakToken_h | 6 #define NGBreakToken_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // | 32 // |
33 // The break token should encapsulate enough information to "resume" the layout. | 33 // The break token should encapsulate enough information to "resume" the layout. |
34 class CORE_EXPORT NGBreakToken | 34 class CORE_EXPORT NGBreakToken |
35 : public GarbageCollectedFinalized<NGBreakToken> { | 35 : public GarbageCollectedFinalized<NGBreakToken> { |
36 public: | 36 public: |
37 virtual ~NGBreakToken() {} | 37 virtual ~NGBreakToken() {} |
38 | 38 |
39 enum NGBreakTokenType { kBlockBreakToken, kTextBreakToken }; | 39 enum NGBreakTokenType { kBlockBreakToken, kTextBreakToken }; |
40 NGBreakTokenType Type() const { return static_cast<NGBreakTokenType>(type_); } | 40 NGBreakTokenType Type() const { return static_cast<NGBreakTokenType>(type_); } |
41 | 41 |
| 42 enum NGBreakTokenStatus { kUnfinished, kFinished }; |
| 43 |
42 // Whether the layout node cannot produce any more fragments. | 44 // Whether the layout node cannot produce any more fragments. |
43 bool IsFinished() const { return is_finished_; } | 45 bool IsFinished() const { return status_ == kFinished; } |
44 | 46 |
45 // Returns the node associated with this break token. A break token cannot be | 47 // Returns the node associated with this break token. A break token cannot be |
46 // used with any other node. | 48 // used with any other node. |
47 NGLayoutInputNode* InputNode() const { return node_; } | 49 NGLayoutInputNode* InputNode() const { return node_; } |
48 | 50 |
49 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(node_); } | 51 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(node_); } |
50 | 52 |
51 protected: | 53 protected: |
52 NGBreakToken(NGBreakTokenType type, bool is_finished, NGLayoutInputNode* node) | 54 NGBreakToken(NGBreakTokenType type, |
53 : type_(type), is_finished_(is_finished), node_(node) {} | 55 NGBreakTokenStatus status, |
| 56 NGLayoutInputNode* node) |
| 57 : type_(type), status_(status), node_(node) {} |
54 | 58 |
55 private: | 59 private: |
56 unsigned type_ : 1; | 60 unsigned type_ : 1; |
57 unsigned is_finished_ : 1; | 61 unsigned status_ : 1; |
58 | 62 |
59 Member<NGLayoutInputNode> node_; | 63 Member<NGLayoutInputNode> node_; |
60 }; | 64 }; |
61 | 65 |
62 } // namespace blink | 66 } // namespace blink |
63 | 67 |
64 #endif // NGBreakToken_h | 68 #endif // NGBreakToken_h |
OLD | NEW |