| Index: third_party/WebKit/Source/core/layout/ng/ng_block_break_token.h
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_break_token.h b/third_party/WebKit/Source/core/layout/ng/ng_block_break_token.h
|
| index 14e50e420e69bd8f0962acad138585c2f6bfdef5..39e9f48b8789f14b0845a150edf281e8ea068fe3 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_block_break_token.h
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_break_token.h
|
| @@ -12,24 +12,57 @@ namespace blink {
|
|
|
| class NGBlockNode;
|
|
|
| +// Represents a break token for a block node.
|
| class NGBlockBreakToken : public NGBreakToken {
|
| public:
|
| + // Creates a break token for a node which did fragment, and can potentially
|
| + // produce more fragments.
|
| + NGBlockBreakToken(NGBlockNode* node,
|
| + LayoutUnit used_block_size,
|
| + HeapVector<Member<NGBreakToken>>& child_break_tokens)
|
| + : NGBreakToken(kBlockBreakToken, /* is_finished */ false, node),
|
| + used_block_size_(used_block_size) {
|
| + child_break_tokens_.swap(child_break_tokens);
|
| + }
|
| +
|
| + // Creates a break token for a node which cannot produce any more fragments.
|
| + explicit NGBlockBreakToken(NGBlockNode* node)
|
| + : NGBreakToken(kBlockBreakToken, /* is_finished */ true, node) {}
|
| +
|
| + // TODO(ikilpatrick): Remove this constructor and break_offset once we've
|
| + // switched to new multi-col approach.
|
| NGBlockBreakToken(NGBlockNode* node, LayoutUnit break_offset)
|
| - : NGBreakToken(kBlockBreakToken),
|
| - node_(node),
|
| + : NGBreakToken(kBlockBreakToken, false, node),
|
| break_offset_(break_offset) {}
|
|
|
| - NGBlockNode& InputNode() const { return *node_.get(); }
|
| + // Represents the amount of block size used in previous fragments.
|
| + //
|
| + // E.g. if the layout block specifies a block size of 200px, and the previous
|
| + // fragments of this block used 150px (used block size), the next fragment
|
| + // should have a size of 50px (assuming no additional fragmentation).
|
| + LayoutUnit UsedBlockSize() const { return used_block_size_; }
|
| +
|
| + // The break tokens for children of the layout node.
|
| + //
|
| + // This is used to resume layout of any children which fragmented, it may
|
| + // contain "finished" break tokens so we know which children to skip for the
|
| + // next fragment.
|
| + const HeapVector<Member<NGBreakToken>>& ChildBreakTokens() const {
|
| + return child_break_tokens_;
|
| + }
|
| +
|
| + // TODO(ikilpatrick): Remove this accessor.
|
| LayoutUnit BreakOffset() const { return break_offset_; }
|
|
|
| DEFINE_INLINE_VIRTUAL_TRACE() {
|
| NGBreakToken::trace(visitor);
|
| - visitor->trace(node_);
|
| + visitor->trace(child_break_tokens_);
|
| }
|
|
|
| private:
|
| - Member<NGBlockNode> node_;
|
| LayoutUnit break_offset_;
|
| + LayoutUnit used_block_size_;
|
| + HeapVector<Member<NGBreakToken>> child_break_tokens_;
|
| };
|
|
|
| DEFINE_TYPE_CASTS(NGBlockBreakToken,
|
|
|