Commit 9db27f1e authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Opaque region should be clippped with the local coords but not the parent coords,

Bug: 1947193
Test: covered by unit tests
Change-Id: I56603f8a4664aa6941f9e1e8bcd56a7464392a2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947193
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721154}
parent cb0780c6
......@@ -137,8 +137,11 @@ SkIRect GetOpaqueBoundsInRootWindow(
DCHECK_EQ(1u, window->opaque_regions_for_occlusion().size());
// Don't let clients mark regions outside their window bounds as opaque.
// Note: opaque_regions_for_occlusion() are relative to the window, i.e. the
// top-left corner of the window is considered to be the point (0, 0).
gfx::Rect opaque_region = window->opaque_regions_for_occlusion()[0];
opaque_region.Intersect(window->bounds());
opaque_region.Intersect(gfx::Rect(window->bounds().size()));
return ComputeClippedAndTransformedBounds(
opaque_region, transform_relative_to_root, clipped_bounds);
}
......
......@@ -2653,11 +2653,11 @@ TEST_F(WindowOcclusionTrackerTest,
SetOpaqueRegionsForOcclusionAffectsOcclusionOfOtherWindows) {
MockWindowDelegate* delegate_a = new MockWindowDelegate();
delegate_a->set_expectation(Window::OcclusionState::VISIBLE, SkRegion());
CreateTrackedWindow(delegate_a, gfx::Rect(0, 0, 10, 10));
CreateTrackedWindow(delegate_a, gfx::Rect(10, 10, 10, 10));
EXPECT_FALSE(delegate_a->is_expecting_call());
delegate_a->set_expectation(Window::OcclusionState::OCCLUDED, SkRegion());
Window* window_b = CreateUntrackedWindow(gfx::Rect(0, 0, 10, 10));
Window* window_b = CreateUntrackedWindow(gfx::Rect(10, 10, 10, 10));
EXPECT_FALSE(delegate_a->is_expecting_call());
// Make |window_b| transparent, which should make it no longer affect
......
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