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,
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())
ObjectPainter(layout_block_)
.AddPDFURLRectIfNeeded(paint_info, paint_offset);
......
......@@ -260,27 +260,4 @@ void BoxPainter::PaintMaskImages(const PaintInfo& paint_info,
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
......@@ -29,7 +29,6 @@ class BoxPainter {
void PaintChildren(const PaintInfo&, const LayoutPoint&);
void PaintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&);
void PaintMask(const PaintInfo&, const LayoutPoint&);
void PaintClippingMask(const PaintInfo&, const LayoutPoint&);
void PaintMaskImages(const PaintInfo&, const LayoutRect&);
void PaintBoxDecorationBackgroundWithRect(const PaintInfo&,
......
......@@ -198,9 +198,6 @@ void NGBoxFragmentPainter::PaintObject(
if (paint_phase == PaintPhase::kMask && is_visible)
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()) {
NGFragmentPainter(box_fragment_)
.AddPDFURLRectIfNeeded(paint_info, paint_offset);
......@@ -415,11 +412,6 @@ void NGBoxFragmentPainter::PaintMask(const PaintInfo& paint_info,
border_edges_.line_left, border_edges_.line_right);
}
void NGBoxFragmentPainter::PaintClippingMask(const PaintInfo&,
const LayoutPoint&) {
// TODO(eae): Implement.
}
void NGBoxFragmentPainter::PaintBoxDecorationBackground(
const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
......
......@@ -100,7 +100,6 @@ class NGBoxFragmentPainter : public BoxPainterBase {
const LayoutPoint& paint_offset);
void PaintFloats(const PaintInfo&, const LayoutPoint&);
void PaintMask(const PaintInfo&, const LayoutPoint&);
void PaintClippingMask(const PaintInfo&, const LayoutPoint&);
void PaintOverflowControlsIfNeeded(const PaintInfo&, const LayoutPoint&);
void PaintAtomicInline(const PaintInfo&, const LayoutPoint& paint_offset);
void PaintBackground(const PaintInfo&,
......
......@@ -2782,11 +2782,6 @@ bool PaintLayer::MaskBlendingAppliedByCompositor(
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 {
return scrollable_area_ && scrollable_area_->NeedsCompositedScrolling();
}
......
......@@ -555,7 +555,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
void SetGroupedMapping(CompositedLayerMapping*, SetGroupMappingOptions);
bool MaskBlendingAppliedByCompositor(const PaintInfo&) const;
bool HasCompositedClippingMask() const;
bool NeedsCompositedScrolling() const;
// Paint invalidation containers can be self-composited or squashed.
......
......@@ -652,24 +652,20 @@ PaintResult PaintLayerPainter::PaintLayerContents(
// 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
// clip-path), otherwise the mask layer will be empty.
base::Optional<ScopedPaintChunkProperties> path_based_clip_path_scope;
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
const auto& fragment_data =
paint_layer_.GetLayoutObject().FirstFragment();
auto state = fragment_data.LocalBorderBoxProperties();
const auto* properties = fragment_data.PaintProperties();
DCHECK(properties && properties->Mask());
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));
const auto& fragment_data = paint_layer_.GetLayoutObject().FirstFragment();
auto state = fragment_data.LocalBorderBoxProperties();
const auto* properties = fragment_data.PaintProperties();
DCHECK(properties && properties->Mask());
state.SetEffect(properties->Mask());
if (properties && properties->ClipPathClip()) {
DCHECK_EQ(properties->ClipPathClip()->Parent(), properties->MaskClip());
state.SetClip(properties->ClipPathClip());
}
ScopedPaintChunkProperties path_based_clip_path_scope(
context.GetPaintController(), state,
*paint_layer_.GetCompositedLayerMapping()->MaskLayer(),
DisplayItem::kClippingMask);
const GraphicsLayer* mask_layer =
paint_layer_.GetCompositedLayerMapping()->MaskLayer();
ClipRect layer_rect = LayoutRect(
......@@ -1017,26 +1013,22 @@ void PaintLayerPainter::PaintFragmentWithPhase(
PaintLayerFlags paint_flags) {
DCHECK(paint_layer_.IsSelfPaintingLayer());
base::Optional<ScopedPaintChunkProperties> fragment_paint_chunk_properties;
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
DCHECK(phase != PaintPhase::kClippingMask);
auto chunk_properties = fragment.fragment_data->LocalBorderBoxProperties();
if (phase == PaintPhase::kMask) {
const auto* properties = fragment.fragment_data->PaintProperties();
DCHECK(properties && properties->Mask());
chunk_properties.SetEffect(properties->Mask());
// Special case for SPv1 composited mask layer. Path-based clip-path
// is only applies to the mask chunk, but not to the layer property
// or local box box property.
if (properties->ClipPathClip() &&
properties->ClipPathClip()->Parent() == properties->MaskClip()) {
chunk_properties.SetClip(properties->ClipPathClip());
}
auto chunk_properties = fragment.fragment_data->LocalBorderBoxProperties();
if (phase == PaintPhase::kMask) {
const auto* properties = fragment.fragment_data->PaintProperties();
DCHECK(properties && properties->Mask());
chunk_properties.SetEffect(properties->Mask());
// Special case for SPv1 composited mask layer. Path-based clip-path
// is only applies to the mask chunk, but not to the layer property
// or local box box property.
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());
LayoutPoint paint_offset = -paint_layer_.LayoutBoxLocation();
......@@ -1212,9 +1204,8 @@ void PaintLayerPainter::PaintAncestorClippingMask(
// This is a hack to incorporate mask-based clip-path.
// See CompositingLayerPropertyUpdater.cpp about AncestorClippingMaskLayer.
state.SetEffect(layer_fragment.PreFilter());
ScopedPaintChunkProperties properties(
context.GetPaintController(), state, client,
DisplayItem::PaintPhaseToDrawingType(PaintPhase::kClippingMask));
ScopedPaintChunkProperties properties(context.GetPaintController(), state,
client, DisplayItem::kClippingMask);
ClipRect mask_rect = fragment.background_rect;
mask_rect.MoveBy(layer_fragment.PaintOffset());
FillMaskingFragment(context, mask_rect, client);
......@@ -1241,7 +1232,7 @@ void PaintLayerPainter::PaintChildClippingMaskForFragments(
state.SetClip(fragment.fragment_data->ContentsProperties().Clip());
ScopedPaintChunkProperties fragment_paint_chunk_properties(
context.GetPaintController(), state, client,
DisplayItem::PaintPhaseToDrawingType(PaintPhase::kClippingMask));
DisplayItem::kClippingMask);
ClipRect mask_rect = fragment.background_rect;
FillMaskingFragment(context, mask_rect, client);
});
......@@ -1265,12 +1256,11 @@ void PaintLayerPainter::PaintOverlayScrollbars(
void PaintLayerPainter::FillMaskingFragment(GraphicsContext& context,
const ClipRect& clip_rect,
const DisplayItemClient& client) {
DisplayItem::Type type =
DisplayItem::PaintPhaseToDrawingType(PaintPhase::kClippingMask);
if (DrawingRecorder::UseCachedDrawingIfPossible(context, client, type))
if (DrawingRecorder::UseCachedDrawingIfPossible(context, client,
DisplayItem::kClippingMask))
return;
DrawingRecorder recorder(context, client, type);
DrawingRecorder recorder(context, client, DisplayItem::kClippingMask);
IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect());
context.FillRect(snapped_clip_rect, Color::kBlack);
}
......
......@@ -87,11 +87,8 @@ enum class PaintPhase {
kSelection = 8,
kTextClip = 9,
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
// DisplayItem::typeAsDebugString().
};
......
......@@ -61,11 +61,6 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info,
return;
}
if (local_paint_info.phase == PaintPhase::kClippingMask &&
(!layout_replaced_.HasLayer() ||
!layout_replaced_.Layer()->HasCompositedClippingMask()))
return;
if (ShouldPaintSelfOutline(local_paint_info.phase)) {
ObjectPainter(layout_replaced_)
.PaintOutline(local_paint_info, adjusted_paint_offset);
......@@ -74,8 +69,7 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info,
if (local_paint_info.phase != PaintPhase::kForeground &&
local_paint_info.phase != PaintPhase::kSelection &&
!layout_replaced_.CanHaveChildren() &&
local_paint_info.phase != PaintPhase::kClippingMask)
!layout_replaced_.CanHaveChildren())
return;
if (local_paint_info.phase == PaintPhase::kSelection &&
......@@ -138,14 +132,8 @@ void ReplacedPainter::Paint(const PaintInfo& paint_info,
rounded_inner_rect, kApplyToDisplayList);
}
if (!completely_clipped_out) {
if (local_paint_info.phase == PaintPhase::kClippingMask) {
BoxPainter(layout_replaced_)
.PaintClippingMask(local_paint_info, adjusted_paint_offset);
} else {
layout_replaced_.PaintReplaced(local_paint_info, adjusted_paint_offset);
}
}
if (!completely_clipped_out)
layout_replaced_.PaintReplaced(local_paint_info, adjusted_paint_offset);
}
// The selection tint never gets clipped by border-radius rounding, since we
......@@ -179,7 +167,6 @@ bool ReplacedPainter::ShouldPaint(
!ShouldPaintSelfOutline(paint_info.phase) &&
paint_info.phase != PaintPhase::kSelection &&
paint_info.phase != PaintPhase::kMask &&
paint_info.phase != PaintPhase::kClippingMask &&
!ShouldPaintSelfBlockBackground(paint_info.phase))
return false;
......
......@@ -43,10 +43,8 @@ static WTF::String PaintPhaseAsDebugString(int paint_phase) {
return "PaintPhaseSelection";
case 9:
return "PaintPhaseTextClip";
case 10:
return "PaintPhaseMask";
case DisplayItem::kPaintPhaseMax:
return "PaintPhaseClippingMask";
return "PaintPhaseMask";
default:
NOTREACHED();
return "Unknown";
......@@ -72,6 +70,7 @@ static WTF::String SpecialDrawingTypeAsDebugString(DisplayItem::Type type) {
switch (type) {
DEBUG_STRING_CASE(BoxDecorationBackground);
DEBUG_STRING_CASE(Caret);
DEBUG_STRING_CASE(ClippingMask);
DEBUG_STRING_CASE(ColumnRules);
DEBUG_STRING_CASE(DebugDrawing);
DEBUG_STRING_CASE(DocumentBackground);
......
......@@ -34,7 +34,7 @@ class PLATFORM_EXPORT DisplayItem {
public:
enum {
// 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.
......@@ -75,6 +75,7 @@ class PLATFORM_EXPORT DisplayItem {
kDrawingPaintPhaseLast = kDrawingFirst + kPaintPhaseMax,
kBoxDecorationBackground,
kCaret,
kClippingMask,
kColumnRules,
kDebugDrawing,
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