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 NGBlockChildIterator_h |
| 6 #define NGBlockChildIterator_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class NGLayoutInputNode; |
| 14 class NGBreakToken; |
| 15 class NGBlockBreakToken; |
| 16 |
| 17 // A utility class for block-flow layout which given the first child and a |
| 18 // break token will iterate through unfinished children. |
| 19 // |
| 20 // This class does not handle modifications to its arguments after it has been |
| 21 // constructed. |
| 22 class CORE_EXPORT NGBlockChildIterator { |
| 23 public: |
| 24 NGBlockChildIterator(NGLayoutInputNode* first_child, |
| 25 NGBlockBreakToken* break_token); |
| 26 |
| 27 // Returns the next input node which should be laid out, along with its |
| 28 // respective break token. |
| 29 struct Entry; |
| 30 Entry NextChild(); |
| 31 |
| 32 private: |
| 33 Persistent<NGLayoutInputNode> child_; |
| 34 Persistent<NGBlockBreakToken> break_token_; |
| 35 |
| 36 // An index into break_token_'s ChildBreakTokens() vector. Used for keeping |
| 37 // track of the next child break token to inspect. |
| 38 size_t child_token_idx_; |
| 39 }; |
| 40 |
| 41 struct NGBlockChildIterator::Entry { |
| 42 Entry(NGLayoutInputNode* node, NGBreakToken* token) |
| 43 : node(node), token(token) {} |
| 44 |
| 45 Persistent<NGLayoutInputNode> node; |
| 46 Persistent<NGBreakToken> token; |
| 47 |
| 48 bool operator==(const NGBlockChildIterator::Entry& other) const { |
| 49 return node == other.node && token == other.token; |
| 50 } |
| 51 }; |
| 52 |
| 53 } // namespace blink |
| 54 |
| 55 #endif // NGBlockChildIterator_h |
OLD | NEW |