Commit ae1fc684 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Remove PaintLayer::TransparencyClipBox()

It's dead code. It had been there before the blink reformat.

Change-Id: Ibddd1f4994a5ec38a61e69fc19d9598b6dc2c01e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131527Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755399}
parent f79c51b6
...@@ -1184,106 +1184,6 @@ bool PaintLayer::HasAncestorWithFilterThatMovesPixels() const { ...@@ -1184,106 +1184,6 @@ bool PaintLayer::HasAncestorWithFilterThatMovesPixels() const {
return false; return false;
} }
static void ExpandClipRectForDescendants(
PhysicalRect& clip_rect,
const PaintLayer* layer,
const PaintLayer* root_layer,
PaintLayer::TransparencyClipBoxBehavior transparency_behavior,
const PhysicalOffset& sub_pixel_accumulation,
GlobalPaintFlags global_paint_flags) {
// If we have a mask, then the clip is limited to the border box area (and
// there is no need to examine child layers).
if (!layer->GetLayoutObject().HasMask()) {
// Note: we don't have to walk z-order lists since transparent elements
// always establish a stacking container. This means we can just walk the
// layer tree directly.
for (PaintLayer* curr = layer->FirstChild(); curr;
curr = curr->NextSibling())
clip_rect.Unite(PaintLayer::TransparencyClipBox(
curr, root_layer, transparency_behavior,
PaintLayer::kDescendantsOfTransparencyClipBox, sub_pixel_accumulation,
global_paint_flags));
}
}
PhysicalRect PaintLayer::TransparencyClipBox(
const PaintLayer* layer,
const PaintLayer* root_layer,
TransparencyClipBoxBehavior transparency_behavior,
TransparencyClipBoxMode transparency_mode,
const PhysicalOffset& sub_pixel_accumulation,
GlobalPaintFlags global_paint_flags) {
// FIXME: Although this function completely ignores CSS-imposed clipping, we
// did already intersect with the paintDirtyRect, and that should cut down on
// the amount we have to paint. Still it would be better to respect clips.
if (root_layer != layer &&
((transparency_behavior == kPaintingTransparencyClipBox &&
layer->PaintsWithTransform(global_paint_flags)) ||
(transparency_behavior == kHitTestingTransparencyClipBox &&
layer->HasTransformRelatedProperty()))) {
// The best we can do here is to use enclosed bounding boxes to establish a
// "fuzzy" enough clip to encompass the transformed layer and all of its
// children.
const PaintLayer* pagination_layer =
transparency_mode == kDescendantsOfTransparencyClipBox
? layer->EnclosingPaginationLayer()
: nullptr;
const PaintLayer* root_layer_for_transform =
pagination_layer ? pagination_layer : root_layer;
PhysicalOffset delta;
layer->ConvertToLayerCoords(root_layer_for_transform, delta);
delta += sub_pixel_accumulation;
IntPoint pixel_snapped_delta = RoundedIntPoint(delta);
TransformationMatrix transform;
transform.Translate(pixel_snapped_delta.X(), pixel_snapped_delta.Y());
if (layer->Transform())
transform = transform * *layer->Transform();
// We don't use fragment boxes when collecting a transformed layer's
// bounding box, since it always paints unfragmented.
PhysicalRect clip_rect = layer->LocalBoundingBox();
ExpandClipRectForDescendants(clip_rect, layer, layer, transparency_behavior,
sub_pixel_accumulation, global_paint_flags);
PhysicalRect result = PhysicalRect::EnclosingRect(
transform.MapRect(layer->MapRectForFilter(FloatRect(clip_rect))));
if (!pagination_layer)
return result;
// We have to break up the transformed extent across our columns.
// Split our box up into the actual fragment boxes that layout in the
// columns/pages and unite those together to get our true bounding box.
LayoutFlowThread& enclosing_flow_thread =
ToLayoutFlowThread(pagination_layer->GetLayoutObject());
result = PhysicalRectToBeNoop(
enclosing_flow_thread.FragmentsBoundingBox(result.ToLayoutRect()));
PhysicalOffset root_layer_delta;
pagination_layer->ConvertToLayerCoords(root_layer, root_layer_delta);
result.Move(root_layer_delta);
return result;
}
PhysicalRect clip_rect = layer->ShouldFragmentCompositedBounds(root_layer)
? layer->FragmentsBoundingBox(root_layer)
: layer->PhysicalBoundingBox(root_layer);
ExpandClipRectForDescendants(clip_rect, layer, root_layer,
transparency_behavior, sub_pixel_accumulation,
global_paint_flags);
// Convert clipRect into local coordinates for mapLayerRectForFilter(), and
// convert back after.
PhysicalOffset delta;
layer->ConvertToLayerCoords(root_layer, delta);
clip_rect.Move(-delta);
clip_rect = layer->MapRectForFilter(clip_rect);
clip_rect.Move(delta);
clip_rect.Move(sub_pixel_accumulation);
return clip_rect;
}
void* PaintLayer::operator new(size_t sz) { void* PaintLayer::operator new(size_t sz) {
return WTF::Partitions::LayoutPartition()->Alloc( return WTF::Partitions::LayoutPartition()->Alloc(
sz, WTF_HEAP_PROFILER_TYPE_NAME(PaintLayer)); sz, WTF_HEAP_PROFILER_TYPE_NAME(PaintLayer));
......
...@@ -981,24 +981,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -981,24 +981,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
const PhysicalOffset* offset_from_root = nullptr, const PhysicalOffset* offset_from_root = nullptr,
const PhysicalOffset& sub_pixel_accumulation = PhysicalOffset()) const; const PhysicalOffset& sub_pixel_accumulation = PhysicalOffset()) const;
enum TransparencyClipBoxBehavior {
kPaintingTransparencyClipBox,
kHitTestingTransparencyClipBox
};
enum TransparencyClipBoxMode {
kDescendantsOfTransparencyClipBox,
kRootOfTransparencyClipBox
};
static PhysicalRect TransparencyClipBox(
const PaintLayer*,
const PaintLayer* root_layer,
TransparencyClipBoxBehavior transparency_behavior,
TransparencyClipBoxMode transparency_mode,
const PhysicalOffset& sub_pixel_accumulation,
GlobalPaintFlags = kGlobalPaintNormalPhase);
bool SelfNeedsRepaint() const { return self_needs_repaint_; } bool SelfNeedsRepaint() const { return self_needs_repaint_; }
bool DescendantNeedsRepaint() const { return descendant_needs_repaint_; } bool DescendantNeedsRepaint() const { return descendant_needs_repaint_; }
bool SelfOrDescendantNeedsRepaint() const { bool SelfOrDescendantNeedsRepaint() 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