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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc

Issue 2772503004: [LayoutNG] Add NGInlineBreakToken and back of NGInlineLayoutAlgorithm (Closed)
Patch Set: Rename Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
index 51d4b5fae1581d13d8b4c4b3589d20f5b24b278c..d5c2fa81ae5c0371463bcdc2a2a4e58ca7cf616b 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
@@ -80,10 +80,24 @@ NGFragmentBuilder& NGFragmentBuilder::AddChild(
DCHECK_EQ(type_, NGPhysicalFragment::kFragmentBox)
<< "Only box fragments can have children";
- // Update if we have fragmented in this flow.
- did_break_ |= child->IsBox() && !child->BreakToken()->IsFinished();
+ switch (child->Type()) {
+ case NGPhysicalBoxFragment::kFragmentBox:
+ // Update if we have fragmented in this flow.
+ did_break_ |= !child->BreakToken()->IsFinished();
+ child_break_tokens_.push_back(child->BreakToken());
+ break;
+ case NGPhysicalBoxFragment::kFragmentLineBox:
+ // NGInlineNode produces multiple line boxes in an anonymous box. Only
+ // the last break token is needed to be taken to parent.
ikilpatrick 2017/03/24 20:58:05 .nit ... is needed to be reported to the parent. ?
+ DCHECK(child->BreakToken() && child->BreakToken()->InputNode() == node_);
+ last_inline_break_token_ =
+ child->BreakToken()->IsFinished() ? nullptr : child->BreakToken();
+ break;
+ case NGPhysicalBoxFragment::kFragmentText:
+ DCHECK(!child->BreakToken());
+ break;
ikilpatrick 2017/03/24 20:58:05 default: NOTREACHED()?
+ }
- child_break_tokens_.push_back(child->BreakToken());
children_.push_back(std::move(child));
offsets_.push_back(child_offset);
@@ -173,9 +187,13 @@ RefPtr<NGLayoutResult> NGFragmentBuilder::ToBoxFragment() {
}
RefPtr<NGBreakToken> break_token;
+ if (last_inline_break_token_) {
+ child_break_tokens_.push_back(std::move(last_inline_break_token_));
+ did_break_ = true;
ikilpatrick 2017/03/24 20:58:05 does this need to check if last_inline_break_token
+ }
if (did_break_) {
- break_token = NGBlockBreakToken::create(
- toNGBlockNode(node_.get()), used_block_size_, child_break_tokens_);
+ break_token = NGBlockBreakToken::create(node_.get(), used_block_size_,
+ child_break_tokens_);
} else {
break_token = NGBlockBreakToken::create(node_.get());
}

Powered by Google App Engine
This is Rietveld 408576698