| 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 b8739da255de2b2cd3743f47ebb26e120611dd16..baed4d6e70b4aed0a855943f61c291982db1628c 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
|
| @@ -22,8 +22,16 @@ NGFragmentBuilder::NGFragmentBuilder(NGPhysicalFragment::NGFragmentType type,
|
| writing_mode_(kHorizontalTopBottom),
|
| direction_(TextDirection::kLtr),
|
| node_(node),
|
| - did_break_(false) {
|
| -}
|
| + layout_object_(node->GetLayoutObject()),
|
| + did_break_(false) {}
|
| +
|
| +NGFragmentBuilder::NGFragmentBuilder(NGPhysicalFragment::NGFragmentType type,
|
| + LayoutObject* layout_object)
|
| + : type_(type),
|
| + writing_mode_(kHorizontalTopBottom),
|
| + direction_(TextDirection::kLtr),
|
| + layout_object_(layout_object),
|
| + did_break_(false) {}
|
|
|
| NGFragmentBuilder& NGFragmentBuilder::SetWritingMode(
|
| NGWritingMode writing_mode) {
|
| @@ -85,8 +93,10 @@ NGFragmentBuilder& NGFragmentBuilder::AddChild(
|
| 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());
|
| + if (child->BreakToken()) {
|
| + 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
|
| @@ -193,16 +203,18 @@ RefPtr<NGLayoutResult> NGFragmentBuilder::ToBoxFragment() {
|
| }
|
|
|
| RefPtr<NGBreakToken> break_token;
|
| - if (last_inline_break_token_) {
|
| - DCHECK(!last_inline_break_token_->IsFinished());
|
| - child_break_tokens_.push_back(std::move(last_inline_break_token_));
|
| - did_break_ = true;
|
| - }
|
| - if (did_break_) {
|
| - break_token = NGBlockBreakToken::Create(node_.Get(), used_block_size_,
|
| - child_break_tokens_);
|
| - } else {
|
| - break_token = NGBlockBreakToken::Create(node_.Get());
|
| + if (node_) {
|
| + if (last_inline_break_token_) {
|
| + DCHECK(!last_inline_break_token_->IsFinished());
|
| + child_break_tokens_.push_back(std::move(last_inline_break_token_));
|
| + did_break_ = true;
|
| + }
|
| + if (did_break_) {
|
| + break_token = NGBlockBreakToken::Create(node_.Get(), used_block_size_,
|
| + child_break_tokens_);
|
| + } else {
|
| + break_token = NGBlockBreakToken::Create(node_.Get());
|
| + }
|
| }
|
|
|
| for (auto& positioned_float : positioned_floats_) {
|
| @@ -214,9 +226,9 @@ RefPtr<NGLayoutResult> NGFragmentBuilder::ToBoxFragment() {
|
| }
|
|
|
| RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment(
|
| - node_->GetLayoutObject(), physical_size,
|
| - overflow_.ConvertToPhysical(writing_mode_), children_, positioned_floats_,
|
| - bfc_offset_, end_margin_strut_, std::move(break_token)));
|
| + layout_object_, physical_size, overflow_.ConvertToPhysical(writing_mode_),
|
| + children_, positioned_floats_, bfc_offset_, end_margin_strut_,
|
| + std::move(break_token)));
|
|
|
| return AdoptRef(
|
| new NGLayoutResult(std::move(fragment), out_of_flow_descendants_,
|
|
|