Skip to content

Commit

Permalink
[IO] Return correct non-empty value in slow path with effects.
Browse files Browse the repository at this point in the history
Previously, we always returned true for "is mapped rect non-
empty?" from LocalToAncestorVisualRect in the presence of
effect nodes which may move pixels.

Now return true only if the actual computed rect is non-empty.

Bug:910741

TBR=chrishtr@chromium.org

(cherry picked from commit 5aeac68)

Change-Id: I41935060706b887f58ed14a179d8975bee02c39f
Reviewed-on: https://chromium-review.googlesource.com/c/1359692
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#613625}
Reviewed-on: https://chromium-review.googlesource.com/c/1363954
Cr-Commit-Position: refs/branch-heads/3626@{#85}
Cr-Branched-From: d897fb1-refs/heads/master@{#612437}
  • Loading branch information
chrishtr committed Dec 5, 2018
1 parent dc6efc1 commit 6771ba5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ bool GeometryMapper::SlowLocalToAncestorVisualRectWithEffects(

// Many effects (e.g. filters, clip-paths) can make a clip rect not tight.
mapping_rect.ClearIsTight();
return true;
return !mapping_rect.Rect().IsEmpty();
}

FloatClipRect GeometryMapper::LocalToAncestorClipRect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,21 @@ TEST_P(GeometryMapperTest, SimpleClipInclusiveIntersect) {
EXPECT_CLIP_RECT_EQ(FloatClipRect(FloatRect()), actual_clip_rect);
}

TEST_P(GeometryMapperTest, SimpleClipPlusOpacity) {
auto clip = CreateClip(c0(), &t0(), FloatRoundedRect(10, 10, 50, 50));
local_state.SetClip(clip.get());

auto opacity = CreateOpacityEffect(e0(), 0.99);
local_state.SetEffect(opacity.get());

FloatClipRect actual_clip_rect(FloatRect(60, 10, 10, 10));
auto intersects = GeometryMapper::LocalToAncestorVisualRect(
local_state, ancestor_state, actual_clip_rect);

EXPECT_TRUE(actual_clip_rect.Rect().IsEmpty());
EXPECT_FALSE(intersects);
}

TEST_P(GeometryMapperTest, RoundedClip) {
FloatRoundedRect rect(FloatRect(10, 10, 50, 50),
FloatRoundedRect::Radii(FloatSize(1, 1), FloatSize(),
Expand Down

0 comments on commit 6771ba5

Please sign in to comment.