Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_block_break_token.h

Issue 2921463004: [LayoutNG] PODify NGLayoutInputNode and sub-classes. (Closed)
Patch Set: new ng-bot expectations Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/CoreExport.h"
9 #include "core/layout/ng/ng_break_token.h" 9 #include "core/layout/ng/ng_break_token.h"
10 #include "platform/LayoutUnit.h" 10 #include "platform/LayoutUnit.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class NGBlockNode; 14 class NGBlockNode;
15 15
16 // Represents a break token for a block node. 16 // Represents a break token for a block node.
17 class CORE_EXPORT NGBlockBreakToken : public NGBreakToken { 17 class CORE_EXPORT NGBlockBreakToken : public NGBreakToken {
18 public: 18 public:
19 // 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
20 // produce more fragments. 20 // produce more fragments.
21 // 21 //
22 // The NGBlockBreakToken takes ownership of child_break_tokens, leaving it 22 // The NGBlockBreakToken takes ownership of child_break_tokens, leaving it
23 // empty for the caller. 23 // empty for the caller.
24 // 24 //
25 // The node is NGBlockNode, or any other NGLayoutInputNode that produces 25 // The node is NGBlockNode, or any other NGLayoutInputNode that produces
26 // anonymous box. 26 // anonymous box.
27 static RefPtr<NGBlockBreakToken> Create( 27 static RefPtr<NGBlockBreakToken> Create(
28 NGLayoutInputNode* node, 28 NGLayoutInputNode node,
29 LayoutUnit used_block_size, 29 LayoutUnit used_block_size,
30 Vector<RefPtr<NGBreakToken>>& child_break_tokens) { 30 Vector<RefPtr<NGBreakToken>>& child_break_tokens) {
31 return AdoptRef( 31 return AdoptRef(
32 new NGBlockBreakToken(node, used_block_size, child_break_tokens)); 32 new NGBlockBreakToken(node, used_block_size, child_break_tokens));
33 } 33 }
34 34
35 // Creates a break token for a node which cannot produce any more fragments. 35 // Creates a break token for a node which cannot produce any more fragments.
36 static RefPtr<NGBlockBreakToken> Create(NGLayoutInputNode* node) { 36 static RefPtr<NGBlockBreakToken> Create(NGLayoutInputNode node) {
37 return AdoptRef(new NGBlockBreakToken(node)); 37 return AdoptRef(new NGBlockBreakToken(node));
38 } 38 }
39 39
40 // Represents the amount of block size used in previous fragments. 40 // Represents the amount of block size used in previous fragments.
41 // 41 //
42 // E.g. if the layout block specifies a block size of 200px, and the previous 42 // E.g. if the layout block specifies a block size of 200px, and the previous
43 // fragments of this block used 150px (used block size), the next fragment 43 // fragments of this block used 150px (used block size), the next fragment
44 // should have a size of 50px (assuming no additional fragmentation). 44 // should have a size of 50px (assuming no additional fragmentation).
45 LayoutUnit UsedBlockSize() const { return used_block_size_; } 45 LayoutUnit UsedBlockSize() const { return used_block_size_; }
46 46
47 // The break tokens for children of the layout node. 47 // The break tokens for children of the layout node.
48 // 48 //
49 // Each child we have visited previously in the block-flow layout algorithm 49 // Each child we have visited previously in the block-flow layout algorithm
50 // has an associated break token. This may be either finished (we should skip 50 // has an associated break token. This may be either finished (we should skip
51 // this child) or unfinished (we should try and produce the next fragment for 51 // this child) or unfinished (we should try and produce the next fragment for
52 // this child). 52 // this child).
53 // 53 //
54 // A child which we haven't visited yet doesn't have a break token here. 54 // A child which we haven't visited yet doesn't have a break token here.
55 const Vector<RefPtr<NGBreakToken>>& ChildBreakTokens() const { 55 const Vector<RefPtr<NGBreakToken>>& ChildBreakTokens() const {
56 return child_break_tokens_; 56 return child_break_tokens_;
57 } 57 }
58 58
59 private: 59 private:
60 NGBlockBreakToken(NGLayoutInputNode* node, 60 NGBlockBreakToken(NGLayoutInputNode node,
61 LayoutUnit used_block_size, 61 LayoutUnit used_block_size,
62 Vector<RefPtr<NGBreakToken>>& child_break_tokens); 62 Vector<RefPtr<NGBreakToken>>& child_break_tokens);
63 63
64 explicit NGBlockBreakToken(NGLayoutInputNode* node); 64 explicit NGBlockBreakToken(NGLayoutInputNode node);
65 65
66 LayoutUnit used_block_size_; 66 LayoutUnit used_block_size_;
67 Vector<RefPtr<NGBreakToken>> child_break_tokens_; 67 Vector<RefPtr<NGBreakToken>> child_break_tokens_;
68 }; 68 };
69 69
70 DEFINE_TYPE_CASTS(NGBlockBreakToken, 70 DEFINE_TYPE_CASTS(NGBlockBreakToken,
71 NGBreakToken, 71 NGBreakToken,
72 token, 72 token,
73 token->IsBlockType(), 73 token->IsBlockType(),
74 token.IsBlockType()); 74 token.IsBlockType());
75 75
76 } // namespace blink 76 } // namespace blink
77 77
78 #endif // NGBlockBreakToken_h 78 #endif // NGBlockBreakToken_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698