Commit 8520c033 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[rm-for-spv175] Remove PaintPhase::kClippingMask

For SPv175, we use a display item type instead of the paint phase.

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I1dfaf54f832e5179b96601bf9654b59a90d7df34
Reviewed-on: https://chromium-review.googlesource.com/1111686
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarTien-Ren Chen <trchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569919}
parent 5ec019bb
...@@ -244,14 +244,6 @@ void BlockPainter::PaintObject(const PaintInfo& paint_info, ...@@ -244,14 +244,6 @@ void BlockPainter::PaintObject(const PaintInfo& paint_info,
return; return;
} }
if (paint_phase == PaintPhase::kClippingMask &&
layout_block_.Style()->Visibility() == EVisibility::kVisible) {
// SPv175 always paints clipping mask in PaintLayerPainter.
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
BoxPainter(layout_block_).PaintClippingMask(paint_info, paint_offset);
return;
}
if (paint_phase == PaintPhase::kForeground && paint_info.IsPrinting()) if (paint_phase == PaintPhase::kForeground && paint_info.IsPrinting())
ObjectPainter(layout_block_) ObjectPainter(layout_block_)
.AddPDFURLRectIfNeeded(paint_info, paint_offset); .AddPDFURLRectIfNeeded(paint_info, paint_offset);
......
...@@ -260,27 +260,4 @@ void BoxPainter::PaintMaskImages(const PaintInfo& paint_info, ...@@ -260,27 +260,4 @@ void BoxPainter::PaintMaskImages(const PaintInfo& paint_info,
include_logical_right_edge); include_logical_right_edge);
} }
void BoxPainter::PaintClippingMask(const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
// SPv175 always paints clipping mask in PaintLayerPainter.
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV175Enabled());
DCHECK(paint_info.phase == PaintPhase::kClippingMask);
if (layout_box_.Style()->Visibility() != EVisibility::kVisible)
return;
if (!layout_box_.Layer() ||
layout_box_.Layer()->GetCompositingState() != kPaintsIntoOwnBacking)
return;
if (DrawingRecorder::UseCachedDrawingIfPossible(
paint_info.context, layout_box_, paint_info.phase))
return;
IntRect paint_rect =
PixelSnappedIntRect(LayoutRect(paint_offset, layout_box_.Size()));
DrawingRecorder recorder(paint_info.context, layout_box_, paint_info.phase);
paint_info.context.FillRect(paint_rect, Color::kBlack);
}
} // namespace blink } // namespace blink
...@@ -29,7 +29,6 @@ class BoxPainter { ...@@ -29,7 +29,6 @@ class BoxPainter {
void PaintChildren(const PaintInfo&, const LayoutPoint&); void PaintChildren(const PaintInfo&, const LayoutPoint&);
void PaintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&); void PaintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&);
void PaintMask(const PaintInfo&, const LayoutPoint&); void PaintMask(const PaintInfo&, const LayoutPoint&);
void PaintClippingMask(const PaintInfo&, const LayoutPoint&);
void PaintMaskImages(const PaintInfo&, const LayoutRect&); void PaintMaskImages(const PaintInfo&, const LayoutRect&);
void PaintBoxDecorationBackgroundWithRect(const PaintInfo&, void PaintBoxDecorationBackgroundWithRect(const PaintInfo&,
......
...@@ -198,9 +198,6 @@ void NGBoxFragmentPainter::PaintObject( ...@@ -198,9 +198,6 @@ void NGBoxFragmentPainter::PaintObject(
if (paint_phase == PaintPhase::kMask && is_visible) if (paint_phase == PaintPhase::kMask && is_visible)
return PaintMask(paint_info, paint_offset); return PaintMask(paint_info, paint_offset);
if (paint_phase == PaintPhase::kClippingMask && is_visible)
return PaintClippingMask(paint_info, paint_offset);
if (paint_phase == PaintPhase::kForeground && paint_info.IsPrinting()) { if (paint_phase == PaintPhase::kForeground && paint_info.IsPrinting()) {
NGFragmentPainter(box_fragment_) NGFragmentPainter(box_fragment_)
.AddPDFURLRectIfNeeded(paint_info, paint_offset); .AddPDFURLRectIfNeeded(paint_info, paint_offset);
...@@ -415,11 +412,6 @@ void NGBoxFragmentPainter::PaintMask(const PaintInfo& paint_info, ...@@ -415,11 +412,6 @@ void NGBoxFragmentPainter::PaintMask(const PaintInfo& paint_info,
border_edges_.line_left, border_edges_.line_right); border_edges_.line_left, border_edges_.line_right);
} }
void NGBoxFragmentPainter::PaintClippingMask(const PaintInfo&,
const LayoutPoint&) {
// TODO(eae): Implement.
}
void NGBoxFragmentPainter::PaintBoxDecorationBackground( void NGBoxFragmentPainter::PaintBoxDecorationBackground(
const PaintInfo& paint_info, const PaintInfo& paint_info,
const LayoutPoint& paint_offset) { const LayoutPoint& paint_offset) {
......
...@@ -100,7 +100,6 @@ class NGBoxFragmentPainter : public BoxPainterBase { ...@@ -100,7 +100,6 @@ class NGBoxFragmentPainter : public BoxPainterBase {
const LayoutPoint& paint_offset); const LayoutPoint& paint_offset);
void PaintFloats(const PaintInfo&, const LayoutPoint&); void PaintFloats(const PaintInfo&, const LayoutPoint&);
void PaintMask(const PaintInfo&, const LayoutPoint&); void PaintMask(const PaintInfo&, const LayoutPoint&);
void PaintClippingMask(const PaintInfo&, const LayoutPoint&);
void PaintOverflowControlsIfNeeded(const PaintInfo&, const LayoutPoint&); void PaintOverflowControlsIfNeeded(const PaintInfo&, const LayoutPoint&);
void PaintAtomicInline(const PaintInfo&, const LayoutPoint& paint_offset); void PaintAtomicInline(const PaintInfo&, const LayoutPoint& paint_offset);
void PaintBackground(const PaintInfo&, void PaintBackground(const PaintInfo&,
......
...@@ -2782,11 +2782,6 @@ bool PaintLayer::MaskBlendingAppliedByCompositor( ...@@ -2782,11 +2782,6 @@ bool PaintLayer::MaskBlendingAppliedByCompositor(
rare_data_->composited_layer_mapping->HasMaskLayer(); rare_data_->composited_layer_mapping->HasMaskLayer();
} }
bool PaintLayer::HasCompositedClippingMask() const {
return rare_data_ && rare_data_->composited_layer_mapping &&
rare_data_->composited_layer_mapping->HasChildClippingMaskLayer();
}
bool PaintLayer::NeedsCompositedScrolling() const { bool PaintLayer::NeedsCompositedScrolling() const {
return scrollable_area_ && scrollable_area_->NeedsCompositedScrolling(); return scrollable_area_ && scrollable_area_->NeedsCompositedScrolling();
} }
......
...@@ -555,7 +555,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -555,7 +555,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
void SetGroupedMapping(CompositedLayerMapping*, SetGroupMappingOptions); void SetGroupedMapping(CompositedLayerMapping*, SetGroupMappingOptions);
bool MaskBlendingAppliedByCompositor(const PaintInfo&) const; bool MaskBlendingAppliedByCompositor(const PaintInfo&) const;
bool HasCompositedClippingMask() const;
bool NeedsCompositedScrolling() const; bool NeedsCompositedScrolling() const;
// Paint invalidation containers can be self-composited or squashed. // Paint invalidation containers can be self-composited or squashed.
......
...@@ -652,24 +652,20 @@ PaintResult PaintLayerPainter::PaintLayerContents( ...@@ -652,24 +652,20 @@ PaintResult PaintLayerPainter::PaintLayerContents(
// for just CSS clip-path but without a CSS mask. In that case we need to // for just CSS clip-path but without a CSS mask. In that case we need to
// paint a fully filled mask (which will subsequently clipped by the // paint a fully filled mask (which will subsequently clipped by the
// clip-path), otherwise the mask layer will be empty. // clip-path), otherwise the mask layer will be empty.
const auto& fragment_data = paint_layer_.GetLayoutObject().FirstFragment();
base::Optional<ScopedPaintChunkProperties> path_based_clip_path_scope; auto state = fragment_data.LocalBorderBoxProperties();
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) { const auto* properties = fragment_data.PaintProperties();
const auto& fragment_data = DCHECK(properties && properties->Mask());
paint_layer_.GetLayoutObject().FirstFragment(); state.SetEffect(properties->Mask());
auto state = fragment_data.LocalBorderBoxProperties(); if (properties && properties->ClipPathClip()) {
const auto* properties = fragment_data.PaintProperties(); DCHECK_EQ(properties->ClipPathClip()->Parent(), properties->MaskClip());
DCHECK(properties && properties->Mask()); state.SetClip(properties->ClipPathClip());
state.SetEffect(properties->Mask());
if (properties && properties->ClipPathClip()) {
DCHECK_EQ(properties->ClipPathClip()->Parent(), properties->MaskClip());
state.SetClip(properties->ClipPathClip());
}
path_based_clip_path_scope.emplace(
context.GetPaintController(), state,
*paint_layer_.GetCompositedLayerMapping()->MaskLayer(),
DisplayItem::PaintPhaseToDrawingType(PaintPhase::kClippingMask));
} }
ScopedPaintChunkProperties path_based_clip_path_scope(
context.GetPaintController(), state,
*paint_layer_.GetCompositedLayerMapping()->MaskLayer(),
DisplayItem::kClippingMask);
const GraphicsLayer* mask_layer = const GraphicsLayer* mask_layer =
paint_layer_.GetCompositedLayerMapping()->MaskLayer(); paint_layer_.GetCompositedLayerMapping()->MaskLayer();
ClipRect layer_rect = LayoutRect( ClipRect layer_rect = LayoutRect(
...@@ -1017,26 +1013,22 @@ void PaintLayerPainter::PaintFragmentWithPhase( ...@@ -1017,26 +1013,22 @@ void PaintLayerPainter::PaintFragmentWithPhase(
PaintLayerFlags paint_flags) { PaintLayerFlags paint_flags) {
DCHECK(paint_layer_.IsSelfPaintingLayer()); DCHECK(paint_layer_.IsSelfPaintingLayer());
base::Optional<ScopedPaintChunkProperties> fragment_paint_chunk_properties; auto chunk_properties = fragment.fragment_data->LocalBorderBoxProperties();
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) { if (phase == PaintPhase::kMask) {
DCHECK(phase != PaintPhase::kClippingMask); const auto* properties = fragment.fragment_data->PaintProperties();
auto chunk_properties = fragment.fragment_data->LocalBorderBoxProperties(); DCHECK(properties && properties->Mask());
if (phase == PaintPhase::kMask) { chunk_properties.SetEffect(properties->Mask());
const auto* properties = fragment.fragment_data->PaintProperties(); // Special case for SPv1 composited mask layer. Path-based clip-path
DCHECK(properties && properties->Mask()); // is only applies to the mask chunk, but not to the layer property
chunk_properties.SetEffect(properties->Mask()); // or local box box property.
// Special case for SPv1 composited mask layer. Path-based clip-path if (properties->ClipPathClip() &&
// is only applies to the mask chunk, but not to the layer property properties->ClipPathClip()->Parent() == properties->MaskClip()) {
// or local box box property. chunk_properties.SetClip(properties->ClipPathClip());
if (properties->ClipPathClip() &&
properties->ClipPathClip()->Parent() == properties->MaskClip()) {
chunk_properties.SetClip(properties->ClipPathClip());
}
} }
fragment_paint_chunk_properties.emplace(
context.GetPaintController(), chunk_properties, paint_layer_,
DisplayItem::PaintPhaseToDrawingType(phase));
} }
ScopedPaintChunkProperties fragment_paint_chunk_properties(
context.GetPaintController(), chunk_properties, paint_layer_,
DisplayItem::PaintPhaseToDrawingType(phase));
LayoutRect new_cull_rect(clip_rect.Rect()); LayoutRect new_cull_rect(clip_rect.Rect());
LayoutPoint paint_offset = -paint_layer_.LayoutBoxLocation(); LayoutPoint paint_offset = -paint_layer_.LayoutBoxLocation();
...@@ -1212,9 +1204,8 @@ void PaintLayerPainter::PaintAncestorClippingMask( ...@@ -1212,9 +1204,8 @@ void PaintLayerPainter::PaintAncestorClippingMask(
// This is a hack to incorporate mask-based clip-path. // This is a hack to incorporate mask-based clip-path.
// See CompositingLayerPropertyUpdater.cpp about AncestorClippingMaskLayer. // See CompositingLayerPropertyUpdater.cpp about AncestorClippingMaskLayer.
state.SetEffect(layer_fragment.PreFilter()); state.SetEffect(layer_fragment.PreFilter());
ScopedPaintChunkProperties properties( ScopedPaintChunkProperties properties(context.GetPaintController(), state,
context.GetPaintController(), state, client, client, DisplayItem::kClippingMask);
DisplayItem::PaintPhaseToDrawingType(PaintPhase::kClippingMask));
ClipRect mask_rect = fragment.background_rect; ClipRect mask_rect = fragment.background_rect;
mask_rect.MoveBy(layer_fragment.PaintOffset()); mask_rect.MoveBy(layer_fragment.PaintOffset());
FillMaskingFragment(context, mask_rect, client); FillMaskingFragment(context, mask_rect, client);
...@@ -1241,7 +1232,7 @@ void PaintLayerPainter::PaintChildClippingMaskForFragments( ...@@ -1241,7 +1232,7 @@ void PaintLayerPainter::PaintChildClippingMaskForFragments(
state.SetClip(fragment.fragment_data->ContentsProperties().Clip()); state.SetClip(fragment.fragment_data->ContentsProperties().Clip());
ScopedPaintChunkProperties fragment_paint_chunk_properties( ScopedPaintChunkProperties fragment_paint_chunk_properties(
context.GetPaintController(), state, client, context.GetPaintController(), state, client,
DisplayItem::PaintPhaseToDrawingType(PaintPhase::kClippingMask)); DisplayItem::kClippingMask);
ClipRect mask_rect = fragment.background_rect; ClipRect mask_rect = fragment.background_rect;
FillMaskingFragment(context, mask_rect, client); FillMaskingFragment(context, mask_rect, client);
}); });
...@@ -1265,12 +1256,11 @@ void PaintLayerPainter::PaintOverlayScrollbars( ...@@ -1265,12 +1256,11 @@ void PaintLayerPainter::PaintOverlayScrollbars(
void PaintLayerPainter::FillMaskingFragment(GraphicsContext& context, void PaintLayerPainter::FillMaskingFragment(GraphicsContext& context,
const ClipRect& clip_rect, const ClipRect& clip_rect,
const DisplayItemClient& client) { const DisplayItemClient& client) {
DisplayItem::Type type = if (DrawingRecorder::UseCachedDrawingIfPossible(context, client,
DisplayItem::PaintPhaseToDrawingType(PaintPhase::kClippingMask); DisplayItem::kClippingMask))
if (DrawingRecorder::UseCachedDrawingIfPossible(context, client, type))
return; return;
DrawingRecorder recorder(context, client, type); DrawingRecorder recorder(context, client, DisplayItem::kClippingMask);
IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect());
context.FillRect(snapped_clip_rect, Color::kBlack); context.FillRect(snapped_clip_rect, Color::kBlack);
} }
......
...@@ -87,11 +87,8 @@ enum class PaintPhase { ...@@ -87,11 +87,8 @@ enum class PaintPhase {
kSelection = 8, kSelection = 8,
kTextClip = 9, kTextClip = 9,
kMask = 10, kMask = 10,
// TODO(wangxianzhu): Remove this phase for SPv175+. Use a dedicated display
// item type for the drawings.
kClippingMask = 11,
kMax = kClippingMask, kMax = kMask,
// These values must be kept in sync with DisplayItem::Type and // These values must be kept in sync with DisplayItem::Type and
// DisplayItem::typeAsDebugString(). // DisplayItem::typeAsDebugString().
}; };
......
...@@ -61,11 +61,6 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info, ...@@ -61,11 +61,6 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info,
return; return;
} }
if (local_paint_info.phase == PaintPhase::kClippingMask &&
(!layout_replaced_.HasLayer() ||
!layout_replaced_.Layer()->HasCompositedClippingMask()))
return;
if (ShouldPaintSelfOutline(local_paint_info.phase)) { if (ShouldPaintSelfOutline(local_paint_info.phase)) {
ObjectPainter(layout_replaced_) ObjectPainter(layout_replaced_)
.PaintOutline(local_paint_info, adjusted_paint_offset); .PaintOutline(local_paint_info, adjusted_paint_offset);
...@@ -74,8 +69,7 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info, ...@@ -74,8 +69,7 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info,
if (local_paint_info.phase != PaintPhase::kForeground && if (local_paint_info.phase != PaintPhase::kForeground &&
local_paint_info.phase != PaintPhase::kSelection && local_paint_info.phase != PaintPhase::kSelection &&
!layout_replaced_.CanHaveChildren() && !layout_replaced_.CanHaveChildren())
local_paint_info.phase != PaintPhase::kClippingMask)
return; return;
if (local_paint_info.phase == PaintPhase::kSelection && if (local_paint_info.phase == PaintPhase::kSelection &&
...@@ -138,14 +132,8 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info, ...@@ -138,14 +132,8 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info,
rounded_inner_rect, kApplyToDisplayList); rounded_inner_rect, kApplyToDisplayList);
} }
if (!completely_clipped_out) { if (!completely_clipped_out)
if (local_paint_info.phase == PaintPhase::kClippingMask) { layout_replaced_.PaintReplaced(local_paint_info, adjusted_paint_offset);
BoxPainter(layout_replaced_)
.PaintClippingMask(local_paint_info, adjusted_paint_offset);
} else {
layout_replaced_.PaintReplaced(local_paint_info, adjusted_paint_offset);
}
}
} }
// The selection tint never gets clipped by border-radius rounding, since we // The selection tint never gets clipped by border-radius rounding, since we
...@@ -179,7 +167,6 @@ bool ReplacedPainter::ShouldPaint( ...@@ -179,7 +167,6 @@ bool ReplacedPainter::ShouldPaint(
!ShouldPaintSelfOutline(paint_info.phase) && !ShouldPaintSelfOutline(paint_info.phase) &&
paint_info.phase != PaintPhase::kSelection && paint_info.phase != PaintPhase::kSelection &&
paint_info.phase != PaintPhase::kMask && paint_info.phase != PaintPhase::kMask &&
paint_info.phase != PaintPhase::kClippingMask &&
!ShouldPaintSelfBlockBackground(paint_info.phase)) !ShouldPaintSelfBlockBackground(paint_info.phase))
return false; return false;
......
...@@ -43,10 +43,8 @@ static WTF::String PaintPhaseAsDebugString(int paint_phase) { ...@@ -43,10 +43,8 @@ static WTF::String PaintPhaseAsDebugString(int paint_phase) {
return "PaintPhaseSelection"; return "PaintPhaseSelection";
case 9: case 9:
return "PaintPhaseTextClip"; return "PaintPhaseTextClip";
case 10:
return "PaintPhaseMask";
case DisplayItem::kPaintPhaseMax: case DisplayItem::kPaintPhaseMax:
return "PaintPhaseClippingMask"; return "PaintPhaseMask";
default: default:
NOTREACHED(); NOTREACHED();
return "Unknown"; return "Unknown";
...@@ -72,6 +70,7 @@ static WTF::String SpecialDrawingTypeAsDebugString(DisplayItem::Type type) { ...@@ -72,6 +70,7 @@ static WTF::String SpecialDrawingTypeAsDebugString(DisplayItem::Type type) {
switch (type) { switch (type) {
DEBUG_STRING_CASE(BoxDecorationBackground); DEBUG_STRING_CASE(BoxDecorationBackground);
DEBUG_STRING_CASE(Caret); DEBUG_STRING_CASE(Caret);
DEBUG_STRING_CASE(ClippingMask);
DEBUG_STRING_CASE(ColumnRules); DEBUG_STRING_CASE(ColumnRules);
DEBUG_STRING_CASE(DebugDrawing); DEBUG_STRING_CASE(DebugDrawing);
DEBUG_STRING_CASE(DocumentBackground); DEBUG_STRING_CASE(DocumentBackground);
......
...@@ -34,7 +34,7 @@ class PLATFORM_EXPORT DisplayItem { ...@@ -34,7 +34,7 @@ class PLATFORM_EXPORT DisplayItem {
public: public:
enum { enum {
// Must be kept in sync with core/paint/PaintPhase.h. // Must be kept in sync with core/paint/PaintPhase.h.
kPaintPhaseMax = 11, kPaintPhaseMax = 10,
}; };
// A display item type uniquely identifies a display item of a client. // A display item type uniquely identifies a display item of a client.
...@@ -75,6 +75,7 @@ class PLATFORM_EXPORT DisplayItem { ...@@ -75,6 +75,7 @@ class PLATFORM_EXPORT DisplayItem {
kDrawingPaintPhaseLast = kDrawingFirst + kPaintPhaseMax, kDrawingPaintPhaseLast = kDrawingFirst + kPaintPhaseMax,
kBoxDecorationBackground, kBoxDecorationBackground,
kCaret, kCaret,
kClippingMask,
kColumnRules, kColumnRules,
kDebugDrawing, kDebugDrawing,
kDocumentBackground, kDocumentBackground,
......
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