Commit f1595a9d authored by Koji Ishii's avatar Koji Ishii Committed by Chromium LUCI CQ

Remove NGPaintFragment from NGBlockNode

Bug: 1154531
Change-Id: I68dbd92b6d4066d4add555be602ece24c714c283
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2590145
Commit-Queue: Kent Tamura <tkent@chromium.org>
Auto-Submit: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836862}
parent 1b1fe001
...@@ -691,20 +691,12 @@ void NGBlockNode::FinishLayout( ...@@ -691,20 +691,12 @@ void NGBlockNode::FinishLayout(
} }
if (has_inline_children) { if (has_inline_children) {
if (!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) { if (items)
CopyFragmentDataToLayoutBoxForInlineChildren(
physical_fragment, physical_fragment.Size().width,
Style().IsFlippedBlocksWritingMode());
block_flow->SetPaintFragment(break_token, &physical_fragment);
} else if (items) {
CopyFragmentItemsToLayoutBox(physical_fragment, *items, break_token); CopyFragmentItemsToLayoutBox(physical_fragment, *items, break_token);
}
} else { } else {
// We still need to clear paint fragments in case it had inline children, // We still need to clear |NGInlineNodeData| in case it had inline
// and thus had NGPaintFragment. // children.
block_flow->ClearNGInlineNodeData(); block_flow->ClearNGInlineNodeData();
if (!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled())
block_flow->SetPaintFragment(break_token, nullptr);
} }
} else { } else {
DCHECK(!physical_fragment.HasItems()); DCHECK(!physical_fragment.HasItems());
...@@ -1353,56 +1345,6 @@ void NGBlockNode::CopyChildFragmentPosition( ...@@ -1353,56 +1345,6 @@ void NGBlockNode::CopyChildFragmentPosition(
layout_box->SetLocationAndUpdateOverflowControlsIfNeeded(point); layout_box->SetLocationAndUpdateOverflowControlsIfNeeded(point);
} }
// For inline children, NG painters handles fragments directly, but there are
// some cases where we need to copy data to the LayoutObject tree. This function
// handles such cases.
void NGBlockNode::CopyFragmentDataToLayoutBoxForInlineChildren(
const NGPhysicalContainerFragment& container,
LayoutUnit initial_container_width,
bool initial_container_is_flipped,
PhysicalOffset offset) const {
DCHECK(!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled());
for (const auto& child : container.Children()) {
if (child->IsContainer()) {
PhysicalOffset child_offset = offset + child.Offset();
// Replaced elements and inline blocks need Location() set relative to
// their block container.
LayoutObject* layout_object = child->GetMutableLayoutObject();
if (layout_object && layout_object->IsBox()) {
auto& layout_box = To<LayoutBox>(*layout_object);
PhysicalOffset maybe_flipped_offset = child_offset;
if (initial_container_is_flipped) {
maybe_flipped_offset.left = initial_container_width -
child->Size().width -
maybe_flipped_offset.left;
}
layout_box.SetLocationAndUpdateOverflowControlsIfNeeded(
maybe_flipped_offset.ToLayoutPoint());
}
// Legacy compatibility. This flag is used in paint layer for
// invalidation.
if (layout_object && layout_object->IsLayoutInline() &&
layout_object->StyleRef().HasOutline() &&
!layout_object->IsElementContinuation() &&
To<LayoutInline>(layout_object)->Continuation()) {
box_->SetContainsInlineWithOutlineAndContinuation(true);
}
// The Location() of inline LayoutObject is relative to the
// LayoutBlockFlow. If |child| establishes a new block formatting context,
// it also creates another inline formatting context. Do not copy to its
// descendants in this case.
if (!child->IsFormattingContextRoot()) {
CopyFragmentDataToLayoutBoxForInlineChildren(
To<NGPhysicalContainerFragment>(*child), initial_container_width,
initial_container_is_flipped, child_offset);
}
}
}
}
void NGBlockNode::CopyFragmentItemsToLayoutBox( void NGBlockNode::CopyFragmentItemsToLayoutBox(
const NGPhysicalBoxFragment& container, const NGPhysicalBoxFragment& container,
const NGFragmentItems& items, const NGFragmentItems& items,
......
...@@ -21,7 +21,6 @@ class NGEarlyBreak; ...@@ -21,7 +21,6 @@ class NGEarlyBreak;
class NGFragmentItems; class NGFragmentItems;
class NGLayoutResult; class NGLayoutResult;
class NGPhysicalBoxFragment; class NGPhysicalBoxFragment;
class NGPhysicalContainerFragment;
struct NGBoxStrut; struct NGBoxStrut;
struct NGLayoutAlgorithmParams; struct NGLayoutAlgorithmParams;
...@@ -220,11 +219,6 @@ class CORE_EXPORT NGBlockNode : public NGLayoutInputNode { ...@@ -220,11 +219,6 @@ class CORE_EXPORT NGBlockNode : public NGLayoutInputNode {
const NGPhysicalBoxFragment& container, const NGPhysicalBoxFragment& container,
const NGFragmentItems& items, const NGFragmentItems& items,
const NGBlockBreakToken* previous_break_token) const; const NGBlockBreakToken* previous_break_token) const;
void CopyFragmentDataToLayoutBoxForInlineChildren(
const NGPhysicalContainerFragment& container,
LayoutUnit initial_container_width,
bool initial_container_is_flipped,
PhysicalOffset offset = {}) const;
void PlaceChildrenInLayoutBox( void PlaceChildrenInLayoutBox(
const NGPhysicalBoxFragment&, const NGPhysicalBoxFragment&,
const NGBlockBreakToken* previous_break_token) const; const NGBlockBreakToken* previous_break_token) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment