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

Remove NGPaintFragment from LayoutNGMixin and LayoutNGBlockFlowMixin

Bug: 1154531
Change-Id: I2bf795a14dbedccbb066456ec4ab756808a6ecd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586636
Auto-Submit: Koji Ishii <kojii@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836142}
parent 259a9842
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/ng_relative_utils.h" #include "third_party/blink/renderer/core/layout/ng/ng_relative_utils.h"
#include "third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h" #include "third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h"
#include "third_party/blink/renderer/core/paint/ng/ng_paint_fragment.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer.h"
namespace blink { namespace blink {
...@@ -108,13 +107,6 @@ void LayoutNGBlockFlowMixin<Base>::AddOutlineRects( ...@@ -108,13 +107,6 @@ void LayoutNGBlockFlowMixin<Base>::AddOutlineRects(
Vector<PhysicalRect>& rects, Vector<PhysicalRect>& rects,
const PhysicalOffset& additional_offset, const PhysicalOffset& additional_offset,
NGOutlineType include_block_overflows) const { NGOutlineType include_block_overflows) const {
if (PaintFragment()) {
To<NGPhysicalBoxFragment>(PaintFragment()->PhysicalFragment())
.AddSelfOutlineRects(additional_offset, include_block_overflows,
&rects);
return;
}
// TODO(crbug.com/1145048): Currently |NGBoxPhysicalFragment| does not support // TODO(crbug.com/1145048): Currently |NGBoxPhysicalFragment| does not support
// NG block fragmentation. Fallback to the legacy code path. // NG block fragmentation. Fallback to the legacy code path.
if (Base::PhysicalFragmentCount() == 1) { if (Base::PhysicalFragmentCount() == 1) {
...@@ -190,32 +182,6 @@ LayoutUnit LayoutNGBlockFlowMixin<Base>::InlineBlockBaseline( ...@@ -190,32 +182,6 @@ LayoutUnit LayoutNGBlockFlowMixin<Base>::InlineBlockBaseline(
return Base::EmptyLineBaseline(line_direction); return Base::EmptyLineBaseline(line_direction);
} }
template <typename Base>
void LayoutNGBlockFlowMixin<Base>::SetPaintFragment(
const NGBlockBreakToken* break_token,
scoped_refptr<const NGPhysicalFragment> fragment) {
DCHECK(!break_token || break_token->InputNode().GetLayoutBox() == this);
if (UNLIKELY(RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()))
return;
scoped_refptr<NGPaintFragment>* current =
NGPaintFragment::Find(&paint_fragment_, break_token);
DCHECK(current);
if (fragment) {
*current = NGPaintFragment::Create(std::move(fragment), break_token,
std::move(*current));
// |NGPaintFragment::Create()| calls |SlowSetPaintingLayerNeedsRepaint()|.
} else if (*current) {
DCHECK_EQ(this, (*current)->GetLayoutObject());
// TODO(kojii): Pass break_token for LayoutObject that spans across block
// fragmentation boundaries.
(*current)->ClearAssociationWithLayoutObject();
*current = nullptr;
ObjectPaintInvalidator(*this).SlowSetPaintingLayerNeedsRepaint();
}
}
template <typename Base> template <typename Base>
bool LayoutNGBlockFlowMixin<Base>::NodeAtPoint( bool LayoutNGBlockFlowMixin<Base>::NodeAtPoint(
HitTestResult& result, HitTestResult& result,
...@@ -233,17 +199,6 @@ bool LayoutNGBlockFlowMixin<Base>::NodeAtPoint( ...@@ -233,17 +199,6 @@ bool LayoutNGBlockFlowMixin<Base>::NodeAtPoint(
if (!Base::MayIntersect(result, hit_test_location, accumulated_offset)) if (!Base::MayIntersect(result, hit_test_location, accumulated_offset))
return false; return false;
if (const NGPaintFragment* paint_fragment = PaintFragment()) {
if (Base::IsInSelfHitTestingPhase(action) && Base::IsScrollContainer() &&
Base::HitTestOverflowControl(result, hit_test_location,
accumulated_offset))
return true;
return NGBoxFragmentPainter(*paint_fragment)
.NodeAtPoint(result, hit_test_location, accumulated_offset, action);
}
if (UNLIKELY(RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled())) {
if (Base::PhysicalFragmentCount()) { if (Base::PhysicalFragmentCount()) {
const NGPhysicalBoxFragment* fragment = Base::GetPhysicalFragment(0); const NGPhysicalBoxFragment* fragment = Base::GetPhysicalFragment(0);
DCHECK(fragment); DCHECK(fragment);
...@@ -256,7 +211,6 @@ bool LayoutNGBlockFlowMixin<Base>::NodeAtPoint( ...@@ -256,7 +211,6 @@ bool LayoutNGBlockFlowMixin<Base>::NodeAtPoint(
result, hit_test_location, accumulated_offset, action); result, hit_test_location, accumulated_offset, action);
} }
} }
}
return LayoutBlockFlow::NodeAtPoint(result, hit_test_location, return LayoutBlockFlow::NodeAtPoint(result, hit_test_location,
accumulated_offset, action); accumulated_offset, action);
...@@ -274,18 +228,8 @@ PositionWithAffinity LayoutNGBlockFlowMixin<Base>::PositionForPoint( ...@@ -274,18 +228,8 @@ PositionWithAffinity LayoutNGBlockFlowMixin<Base>::PositionForPoint(
if (!Base::ChildrenInline()) if (!Base::ChildrenInline())
return LayoutBlock::PositionForPoint(point); return LayoutBlock::PositionForPoint(point);
if (const NGPhysicalBoxFragment* fragment = CurrentFragment())
if (const NGPaintFragment* paint_fragment = PaintFragment()) {
// The given offset is relative to this |LayoutBlockFlow|. Convert to the
// contents offset.
PhysicalOffset point_in_contents = point;
Base::OffsetForContents(point_in_contents);
if (const PositionWithAffinity position =
paint_fragment->PositionForPoint(point_in_contents))
return AdjustForEditingBoundary(position);
} else if (const NGPhysicalBoxFragment* fragment = CurrentFragment()) {
return fragment->PositionForPoint(point); return fragment->PositionForPoint(point);
}
return Base::CreatePositionWithAffinity(0); return Base::CreatePositionWithAffinity(0);
} }
...@@ -299,8 +243,7 @@ void LayoutNGBlockFlowMixin<Base>::DirtyLinesFromChangedChild( ...@@ -299,8 +243,7 @@ void LayoutNGBlockFlowMixin<Base>::DirtyLinesFromChangedChild(
// We need to dirty line box fragments only if the child is once laid out in // We need to dirty line box fragments only if the child is once laid out in
// LayoutNG inline formatting context. New objects are handled in // LayoutNG inline formatting context. New objects are handled in
// NGInlineNode::MarkLineBoxesDirty(). // NGInlineNode::MarkLineBoxesDirty().
if (child->IsInLayoutNGInlineFormattingContext() && if (child->IsInLayoutNGInlineFormattingContext())
RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled())
NGFragmentItems::DirtyLinesFromChangedChild(*child, *this); NGFragmentItems::DirtyLinesFromChangedChild(*child, *this);
} }
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
namespace blink { namespace blink {
enum class NGBaselineAlgorithmType; enum class NGBaselineAlgorithmType;
class NGPaintFragment;
class NGPhysicalFragment;
struct NGInlineNodeData; struct NGInlineNodeData;
// This mixin holds code shared between LayoutNG subclasses of LayoutBlockFlow. // This mixin holds code shared between LayoutNG subclasses of LayoutBlockFlow.
...@@ -48,18 +46,6 @@ class LayoutNGBlockFlowMixin : public LayoutNGMixin<Base> { ...@@ -48,18 +46,6 @@ class LayoutNGBlockFlowMixin : public LayoutNGMixin<Base> {
PositionWithAffinity PositionForPoint(const PhysicalOffset&) const override; PositionWithAffinity PositionForPoint(const PhysicalOffset&) const override;
const NGPaintFragment* PaintFragment() const final {
// TODO(layout-dev) crbug.com/963103
// Safer option here is to return nullptr only if
// Lifecycle > DocumentLifecycle::kAfterPerformLayout, but this breaks
// some layout tests.
if (Base::NeedsLayout())
return nullptr;
return paint_fragment_.get();
}
void SetPaintFragment(const NGBlockBreakToken*,
scoped_refptr<const NGPhysicalFragment>) final;
using LayoutNGMixin<Base>::CurrentFragment; using LayoutNGMixin<Base>::CurrentFragment;
protected: protected:
...@@ -79,7 +65,6 @@ class LayoutNGBlockFlowMixin : public LayoutNGMixin<Base> { ...@@ -79,7 +65,6 @@ class LayoutNGBlockFlowMixin : public LayoutNGMixin<Base> {
void UpdateNGBlockLayout(); void UpdateNGBlockLayout();
std::unique_ptr<NGInlineNodeData> ng_inline_node_data_; std::unique_ptr<NGInlineNodeData> ng_inline_node_data_;
scoped_refptr<NGPaintFragment> paint_fragment_;
friend class NGBaseLayoutAlgorithmTest; friend class NGBaseLayoutAlgorithmTest;
......
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