Skip to content

Commit 6771ba5

Browse files
committed
[IO] Return correct non-empty value in slow path with effects.
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 [email protected] (cherry picked from commit 5aeac68) Change-Id: I41935060706b887f58ed14a179d8975bee02c39f Reviewed-on: https://chromium-review.googlesource.com/c/1359692 Reviewed-by: Xianzhu Wang <[email protected]> Reviewed-by: Chris Harrelson <[email protected]> Commit-Queue: Chris Harrelson <[email protected]> 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}
1 parent dc6efc1 commit 6771ba5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

third_party/blink/renderer/platform/graphics/paint/geometry_mapper.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ bool GeometryMapper::SlowLocalToAncestorVisualRectWithEffects(
287287

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

293293
FloatClipRect GeometryMapper::LocalToAncestorClipRect(

third_party/blink/renderer/platform/graphics/paint/geometry_mapper_test.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,21 @@ TEST_P(GeometryMapperTest, SimpleClipInclusiveIntersect) {
394394
EXPECT_CLIP_RECT_EQ(FloatClipRect(FloatRect()), actual_clip_rect);
395395
}
396396

397+
TEST_P(GeometryMapperTest, SimpleClipPlusOpacity) {
398+
auto clip = CreateClip(c0(), &t0(), FloatRoundedRect(10, 10, 50, 50));
399+
local_state.SetClip(clip.get());
400+
401+
auto opacity = CreateOpacityEffect(e0(), 0.99);
402+
local_state.SetEffect(opacity.get());
403+
404+
FloatClipRect actual_clip_rect(FloatRect(60, 10, 10, 10));
405+
auto intersects = GeometryMapper::LocalToAncestorVisualRect(
406+
local_state, ancestor_state, actual_clip_rect);
407+
408+
EXPECT_TRUE(actual_clip_rect.Rect().IsEmpty());
409+
EXPECT_FALSE(intersects);
410+
}
411+
397412
TEST_P(GeometryMapperTest, RoundedClip) {
398413
FloatRoundedRect rect(FloatRect(10, 10, 50, 50),
399414
FloatRoundedRect::Radii(FloatSize(1, 1), FloatSize(),

0 commit comments

Comments
 (0)