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 NGBlockBreakToken_h | 5 #ifndef NGBlockBreakToken_h |
6 #define NGBlockBreakToken_h | 6 #define NGBlockBreakToken_h |
7 | 7 |
8 #include "core/CoreExport.h" | |
8 #include "core/layout/ng/ng_break_token.h" | 9 #include "core/layout/ng/ng_break_token.h" |
9 #include "platform/LayoutUnit.h" | 10 #include "platform/LayoutUnit.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 class NGBlockNode; | 14 class NGBlockNode; |
14 | 15 |
15 // Represents a break token for a block node. | 16 // Represents a break token for a block node. |
16 class NGBlockBreakToken : public NGBreakToken { | 17 class CORE_EXPORT NGBlockBreakToken : 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 NGBlockBreakToken(NGBlockNode* node, | 21 NGBlockBreakToken(NGBlockNode* node, |
21 LayoutUnit used_block_size, | 22 LayoutUnit used_block_size, |
22 HeapVector<Member<NGBreakToken>>& child_break_tokens) | 23 HeapVector<Member<NGBreakToken>>& child_break_tokens); |
mstensho (USE GERRIT)
2017/02/22 13:11:30
Since the implementation has now been moved to a s
ikilpatrick
2017/02/22 18:47:19
Done.
| |
23 : NGBreakToken(kBlockBreakToken, /* is_finished */ false, node), | |
24 used_block_size_(used_block_size) { | |
25 child_break_tokens_.swap(child_break_tokens); | |
26 } | |
27 | 24 |
28 // Creates a break token for a node which cannot produce any more fragments. | 25 // Creates a break token for a node which cannot produce any more fragments. |
29 explicit NGBlockBreakToken(NGBlockNode* node) | 26 explicit NGBlockBreakToken(NGBlockNode* node); |
30 : NGBreakToken(kBlockBreakToken, /* is_finished */ true, node) {} | |
31 | 27 |
32 // TODO(ikilpatrick): Remove this constructor and break_offset once we've | 28 // TODO(ikilpatrick): Remove this constructor and break_offset once we've |
33 // switched to new multi-col approach. | 29 // switched to new multi-col approach. |
34 NGBlockBreakToken(NGBlockNode* node, LayoutUnit break_offset) | 30 NGBlockBreakToken(NGBlockNode* node, LayoutUnit break_offset); |
35 : NGBreakToken(kBlockBreakToken, false, node), | |
36 break_offset_(break_offset) {} | |
37 | 31 |
38 // Represents the amount of block size used in previous fragments. | 32 // Represents the amount of block size used in previous fragments. |
39 // | 33 // |
40 // E.g. if the layout block specifies a block size of 200px, and the previous | 34 // E.g. if the layout block specifies a block size of 200px, and the previous |
41 // fragments of this block used 150px (used block size), the next fragment | 35 // fragments of this block used 150px (used block size), the next fragment |
42 // should have a size of 50px (assuming no additional fragmentation). | 36 // should have a size of 50px (assuming no additional fragmentation). |
43 LayoutUnit UsedBlockSize() const { return used_block_size_; } | 37 LayoutUnit UsedBlockSize() const { return used_block_size_; } |
44 | 38 |
45 // The break tokens for children of the layout node. | 39 // The break tokens for children of the layout node. |
46 // | 40 // |
(...skipping 20 matching lines...) Expand all Loading... | |
67 | 61 |
68 DEFINE_TYPE_CASTS(NGBlockBreakToken, | 62 DEFINE_TYPE_CASTS(NGBlockBreakToken, |
69 NGBreakToken, | 63 NGBreakToken, |
70 token, | 64 token, |
71 token->Type() == NGBreakToken::kBlockBreakToken, | 65 token->Type() == NGBreakToken::kBlockBreakToken, |
72 token.Type() == NGBreakToken::kBlockBreakToken); | 66 token.Type() == NGBreakToken::kBlockBreakToken); |
73 | 67 |
74 } // namespace blink | 68 } // namespace blink |
75 | 69 |
76 #endif // NGBlockBreakToken_h | 70 #endif // NGBlockBreakToken_h |
OLD | NEW |