Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp

Issue 2828323003: Stop clipping to visual rect bounds in PLC::CalculateBackgroundClipRect (Closed)
Patch Set: none Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
index da24d7aaabd5bd373b245de256182977fb82bc7a..902295373b5c159d49ff7b391906e4bbabcceffa 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -205,7 +205,8 @@ LayoutRect PaintLayerClipper::LocalClipRect(
ClipRectsContext context(&clipping_root_layer, kPaintingClipRects);
if (use_geometry_mapper_) {
ClipRect clip_rect;
- CalculateBackgroundClipRectWithGeometryMapper(context, clip_rect);
+ CalculateBackgroundClipRectWithGeometryMapper(context, clip_rect,
+ ShouldClipOverflow(context));
LayoutRect premapped_rect = clip_rect.Rect();
// The rect now needs to be transformed to the local space of this
@@ -279,7 +280,8 @@ void PaintLayerClipper::CalculateRectsWithGeometryMapper(
background_rect = ClipRect(LayoutRect(LayoutRect::InfiniteIntRect()));
foreground_rect = ClipRect(LayoutRect(LayoutRect::InfiniteIntRect()));
} else {
- CalculateBackgroundClipRectWithGeometryMapper(context, background_rect);
+ CalculateBackgroundClipRectWithGeometryMapper(context, background_rect,
+ ShouldClipOverflow(context));
background_rect.Move(context.sub_pixel_accumulation);
background_rect.Intersect(paint_dirty_rect);
@@ -426,7 +428,8 @@ static ClipRect BackgroundClipRectForPosition(const ClipRects& parent_rects,
void PaintLayerClipper::CalculateBackgroundClipRectWithGeometryMapper(
const ClipRectsContext& context,
- ClipRect& output) const {
+ ClipRect& output,
+ bool should_clip_to_visual_overflow) const {
DCHECK(use_geometry_mapper_);
PropertyTreeState source_property_tree_state(nullptr, nullptr, nullptr);
PropertyTreeState destination_property_tree_state(nullptr, nullptr, nullptr);
@@ -457,7 +460,7 @@ void PaintLayerClipper::CalculateBackgroundClipRectWithGeometryMapper(
// of transforms. Tight results are required for most use cases of these
// rects, so we should add methods to GeometryMapper that guarantee there
// are tight results, or else signal an error.
- if (ShouldClipOverflow(context)) {
+ if (should_clip_to_visual_overflow) {
FloatClipRect clip_rect((FloatRect(LocalVisualRect())));
clip_rect.MoveBy(FloatPoint(layer_.GetLayoutObject().PaintOffset()));
GeometryMapper::SourceToDestinationVisualRect(
@@ -468,6 +471,8 @@ void PaintLayerClipper::CalculateBackgroundClipRectWithGeometryMapper(
GeometryMapper::SourceToDestinationClipRect(
source_property_tree_state, destination_property_tree_state);
output.SetRect(clipped_rect_in_root_layer_space);
+ if (clipped_rect_in_root_layer_space.IsInfinite())
+ return;
}
output.MoveBy(-context.root_layer->GetLayoutObject().PaintOffset());
@@ -529,7 +534,7 @@ void PaintLayerClipper::CalculateBackgroundClipRect(
return;
}
- CalculateBackgroundClipRectWithGeometryMapper(context, output);
+ CalculateBackgroundClipRectWithGeometryMapper(context, output, false);
#ifdef CHECK_CLIP_RECTS
ClipRect testBackgroundClipRect =
PaintLayerClipper(m_layer, nullptr).backgroundClipRect(context);

Powered by Google App Engine
This is Rietveld 408576698