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 #include "core/layout/ng/ng_block_child_iterator.h" | 5 #include "core/layout/ng/ng_block_child_iterator.h" |
6 | 6 |
7 #include "core/layout/ng/ng_block_break_token.h" | 7 #include "core/layout/ng/ng_block_break_token.h" |
8 #include "core/layout/ng/ng_layout_input_node.h" | 8 #include "core/layout/ng/ng_layout_input_node.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 NGBlockChildIterator::NGBlockChildIterator(NGLayoutInputNode* first_child, | 12 NGBlockChildIterator::NGBlockChildIterator(NGLayoutInputNode first_child, |
13 NGBlockBreakToken* break_token) | 13 NGBlockBreakToken* break_token) |
14 : child_(first_child), break_token_(break_token), child_token_idx_(0) {} | 14 : child_(first_child), break_token_(break_token), child_token_idx_(0) {} |
15 | 15 |
16 NGBlockChildIterator::Entry NGBlockChildIterator::NextChild() { | 16 NGBlockChildIterator::Entry NGBlockChildIterator::NextChild() { |
17 NGBreakToken* child_break_token = nullptr; | 17 NGBreakToken* child_break_token = nullptr; |
18 | 18 |
19 if (break_token_) { | 19 if (break_token_) { |
20 // If we're resuming layout after a fragmentainer break, we need to skip | 20 // If we're resuming layout after a fragmentainer break, we need to skip |
21 // siblings that we're done with. We may have been able to fully lay out | 21 // siblings that we're done with. We may have been able to fully lay out |
22 // some node(s) preceding a node that we had to break inside (and therefore | 22 // some node(s) preceding a node that we had to break inside (and therefore |
(...skipping 15 matching lines...) Expand all Loading... |
38 if (child_break_token_candidate->InputNode() != child_) | 38 if (child_break_token_candidate->InputNode() != child_) |
39 break; | 39 break; |
40 | 40 |
41 ++child_token_idx_; | 41 ++child_token_idx_; |
42 | 42 |
43 // We have only found a node if its break token is unfinished. | 43 // We have only found a node if its break token is unfinished. |
44 if (!child_break_token_candidate->IsFinished()) { | 44 if (!child_break_token_candidate->IsFinished()) { |
45 child_break_token = child_break_token_candidate; | 45 child_break_token = child_break_token_candidate; |
46 break; | 46 break; |
47 } | 47 } |
48 } while ((child_ = child_->NextSibling())); | 48 } while ((child_ = child_.NextSibling())); |
49 } | 49 } |
50 | 50 |
51 NGLayoutInputNode* child = child_; | 51 NGLayoutInputNode child = child_; |
52 if (child_) | 52 if (child_) |
53 child_ = child_->NextSibling(); | 53 child_ = child_.NextSibling(); |
54 | 54 |
55 return Entry(child, child_break_token); | 55 return Entry(child, child_break_token); |
56 } | 56 } |
57 | 57 |
58 } // namespace blink | 58 } // namespace blink |
OLD | NEW |