Commit 8dd910a4 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Remove GeometryMapper::PointVisibleInAncestorSpace

It's only called in unittests.

Bug: 992765

Change-Id: I1e5ef83618d089e4ff2d3571a7d26482d8e69974
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1775807
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691783}
parent 6f38e27b
......@@ -156,29 +156,6 @@ bool GeometryMapper::LocalToAncestorVisualRect(
return result;
}
bool GeometryMapper::PointVisibleInAncestorSpace(
const PropertyTreeState& local_state,
const PropertyTreeState& ancestor_state,
const FloatPoint& local_point) {
const auto& ancestor_clip = ancestor_state.Clip().Unalias();
for (const auto* clip = &local_state.Clip().Unalias();
clip && clip != &ancestor_clip; clip = SafeUnalias(clip->Parent())) {
FloatPoint mapped_point =
SourceToDestinationProjection(local_state.Transform(),
clip->LocalTransformSpace())
.MapPoint(local_point);
if (!clip->ClipRect().IntersectsQuad(
FloatRect(mapped_point, FloatSize(1, 1))))
return false;
if (clip->ClipPath() && !clip->ClipPath()->Contains(mapped_point))
return false;
}
return true;
}
bool GeometryMapper::LocalToAncestorVisualRectInternal(
const PropertyTreeState& local_state,
const PropertyTreeState& ancestor_state,
......
......@@ -217,17 +217,6 @@ class PLATFORM_EXPORT GeometryMapper {
OverlayScrollbarClipBehavior = kIgnorePlatformOverlayScrollbarSize,
InclusiveIntersectOrNot = kNonInclusiveIntersect);
// Returns true if |local_rect| is *not* clipped out by any clips
// between |local_state| and |ancestor_state|. This includes not just
// rectangular clips but rounded clips, and any clip paths stored on the
// ClipPaintPropertyNodes. It does *not* include any "complex" clips (see
// LayoutSVGResourceClipper::AsPath for the implementation of the heuristic
// which differentiates "simple" from "complex".
static bool PointVisibleInAncestorSpace(
const PropertyTreeState& local_state,
const PropertyTreeState& ancestor_state,
const FloatPoint& local_point);
static void ClearCache();
private:
......
......@@ -809,117 +809,6 @@ TEST_P(GeometryMapperTest, InvertedClip) {
EXPECT_FALSE(visual_rect.IsTight());
}
TEST_P(GeometryMapperTest, PointVisibleInAncestorSpaceSimpleClip) {
auto clip = CreateClip(c0(), t0(), FloatRoundedRect(10, 10, 50, 50));
PropertyTreeState local_state(t0(), *clip, e0());
PropertyTreeState ancestor_state = PropertyTreeState::Root();
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(30, 30)));
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(11, 11)));
EXPECT_FALSE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(5, 5)));
}
TEST_P(GeometryMapperTest, PointVisibleInAncestorSpaceRoundedClip) {
FloatRoundedRect clip_rect(FloatRoundedRect(10, 10, 50, 50));
FloatRoundedRect::Radii radii;
radii.SetTopLeft(FloatSize(8, 8));
clip_rect.SetRadii(radii);
auto clip = CreateClip(c0(), t0(), clip_rect);
PropertyTreeState local_state(t0(), *clip, e0());
PropertyTreeState ancestor_state = PropertyTreeState::Root();
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(30, 30)));
// Clipped out by radius.
EXPECT_FALSE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(11, 11)));
EXPECT_FALSE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(5, 5)));
}
TEST_P(GeometryMapperTest, PointVisibleInAncestorSpaceClipPath) {
RefCountedPath* path = new RefCountedPath;
path->MoveTo(FloatPoint(10, 10));
path->AddLineTo(FloatPoint(10, 60));
path->AddLineTo(FloatPoint(60, 60));
path->AddLineTo(FloatPoint(60, 10));
path->AddLineTo(FloatPoint(10, 10));
ClipPaintPropertyNode::State state;
state.local_transform_space = &t0();
state.clip_rect = FloatRoundedRect(FloatRect(0, 0, 500, 500));
state.clip_path = base::AdoptRef(path);
auto clip = ClipPaintPropertyNode::Create(c0(), std::move(state));
PropertyTreeState local_state(t0(), *clip, e0());
PropertyTreeState ancestor_state = PropertyTreeState::Root();
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(30, 30)));
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(11, 11)));
EXPECT_FALSE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(5, 5)));
}
TEST_P(GeometryMapperTest, PointVisibleInAncestorSpaceSimpleClipWithTransform) {
auto transform = Create2DTranslation(t0(), 10, 10);
auto clip =
CreateClip(c0(), t0(), FloatRoundedRect(FloatRect(20, 20, 50, 50)));
PropertyTreeState local_state(*transform, *clip, e0());
PropertyTreeState ancestor_state = PropertyTreeState::Root();
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(30, 30)));
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(11, 11)));
EXPECT_FALSE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(5, 5)));
}
TEST_P(GeometryMapperTest, PointVisibleInAncestorSpaceClipPathWithTransform) {
auto transform = Create2DTranslation(t0(), 10, 10);
RefCountedPath* path = new RefCountedPath;
path->MoveTo(FloatPoint(20, 20));
path->AddLineTo(FloatPoint(20, 60));
path->AddLineTo(FloatPoint(60, 60));
path->AddLineTo(FloatPoint(60, 20));
path->AddLineTo(FloatPoint(20, 20));
ClipPaintPropertyNode::State state;
state.local_transform_space = &t0();
state.clip_rect = FloatRoundedRect(FloatRect(0, 0, 500, 500));
state.clip_path = base::AdoptRef(path);
auto clip = ClipPaintPropertyNode::Create(c0(), std::move(state));
PropertyTreeState local_state(*transform, *clip, e0());
PropertyTreeState ancestor_state = PropertyTreeState::Root();
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(30, 30)));
EXPECT_TRUE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(11, 11)));
EXPECT_FALSE(GeometryMapper::PointVisibleInAncestorSpace(
local_state, ancestor_state, FloatPoint(5, 5)));
}
TEST_P(GeometryMapperTest, Precision) {
auto t1 = CreateTransform(t0(), TransformationMatrix().Scale(32767));
auto t2 = CreateTransform(*t1, TransformationMatrix().Rotate(1));
......
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