| Index: cc/trees/layer_tree_host_common_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
|
| index 60dd2e5949df38742ed69b551e04d6021798a5c7..46962bf1b2237bfe0f7d61e319f89085b93f1558 100644
|
| --- a/cc/trees/layer_tree_host_common_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_common_unittest.cc
|
| @@ -51,9 +51,7 @@
|
| #include "cc/trees/task_runner_provider.h"
|
| #include "cc/trees/transform_node.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| -#include "third_party/skia/include/core/SkImageFilter.h"
|
| #include "third_party/skia/include/effects/SkOffsetImageFilter.h"
|
| -#include "third_party/skia/include/effects/SkXfermodeImageFilter.h"
|
| #include "ui/gfx/geometry/quad_f.h"
|
| #include "ui/gfx/geometry/vector2d_conversions.h"
|
| #include "ui/gfx/transform.h"
|
| @@ -3103,180 +3101,6 @@
|
|
|
| // The visible rect is expanded to integer coordinates.
|
| EXPECT_EQ(gfx::Rect(41, 41), grand_child->visible_layer_rect());
|
| -}
|
| -
|
| -TEST_F(LayerTreeHostCommonTest, VisibleRectWithClippingAndFilters) {
|
| - LayerImpl* root = root_layer_for_testing();
|
| - LayerImpl* clip = AddChild<LayerImpl>(root);
|
| - LayerImpl* filter = AddChild<LayerImpl>(clip);
|
| - LayerImpl* filter_child = AddChild<LayerImpl>(filter);
|
| -
|
| - root->SetBounds(gfx::Size(100, 100));
|
| - clip->SetBounds(gfx::Size(10, 10));
|
| - filter->test_properties()->force_render_surface = true;
|
| - filter_child->SetBounds(gfx::Size(2000, 2000));
|
| - filter_child->SetPosition(gfx::PointF(-50, -50));
|
| - filter_child->SetDrawsContent(true);
|
| -
|
| - clip->SetMasksToBounds(true);
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| - EXPECT_EQ(gfx::Rect(50, 50, 10, 10), filter_child->visible_layer_rect());
|
| - EXPECT_EQ(gfx::Rect(10, 10), filter->render_surface()->content_rect());
|
| -
|
| - FilterOperations blur_filter;
|
| - blur_filter.Append(FilterOperation::CreateBlurFilter(4.0f));
|
| - filter->test_properties()->filters = blur_filter;
|
| - host_impl()->active_tree()->property_trees()->needs_rebuild = true;
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| -
|
| - EXPECT_EQ(gfx::Rect(38, 38, 34, 34), filter_child->visible_layer_rect());
|
| - EXPECT_EQ(gfx::Rect(-12, -12, 34, 34),
|
| - filter->render_surface()->content_rect());
|
| -
|
| - gfx::Transform vertical_flip;
|
| - vertical_flip.Scale(1, -1);
|
| - sk_sp<SkImageFilter> flip_filter = SkImageFilter::MakeMatrixFilter(
|
| - vertical_flip.matrix(), kLow_SkFilterQuality, nullptr);
|
| - FilterOperations reflection_filter;
|
| - reflection_filter.Append(
|
| - FilterOperation::CreateReferenceFilter(SkXfermodeImageFilter::Make(
|
| - SkBlendMode::kSrcOver, std::move(flip_filter))));
|
| - filter->test_properties()->filters = reflection_filter;
|
| - host_impl()->active_tree()->property_trees()->needs_rebuild = true;
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| -
|
| - EXPECT_EQ(gfx::Rect(50, 40, 10, 20), filter_child->visible_layer_rect());
|
| - EXPECT_EQ(gfx::Rect(0, -10, 10, 20),
|
| - filter->render_surface()->content_rect());
|
| -}
|
| -
|
| -TEST_F(LayerTreeHostCommonTest, VisibleRectWithScalingClippingAndFilters) {
|
| - LayerImpl* root = root_layer_for_testing();
|
| - LayerImpl* scale = AddChild<LayerImpl>(root);
|
| - LayerImpl* clip = AddChild<LayerImpl>(scale);
|
| - LayerImpl* filter = AddChild<LayerImpl>(clip);
|
| - LayerImpl* filter_child = AddChild<LayerImpl>(filter);
|
| -
|
| - root->SetBounds(gfx::Size(100, 100));
|
| - clip->SetBounds(gfx::Size(10, 10));
|
| - filter->test_properties()->force_render_surface = true;
|
| - filter_child->SetBounds(gfx::Size(2000, 2000));
|
| - filter_child->SetPosition(gfx::PointF(-50, -50));
|
| - filter_child->SetDrawsContent(true);
|
| -
|
| - clip->SetMasksToBounds(true);
|
| -
|
| - gfx::Transform scale_transform;
|
| - scale_transform.Scale(3, 3);
|
| - scale->test_properties()->transform = scale_transform;
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| - EXPECT_EQ(gfx::Rect(50, 50, 10, 10), filter_child->visible_layer_rect());
|
| - EXPECT_EQ(gfx::Rect(30, 30), filter->render_surface()->content_rect());
|
| -
|
| - FilterOperations blur_filter;
|
| - blur_filter.Append(FilterOperation::CreateBlurFilter(4.0f));
|
| - filter->test_properties()->filters = blur_filter;
|
| - host_impl()->active_tree()->property_trees()->needs_rebuild = true;
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| -
|
| - EXPECT_EQ(gfx::Rect(38, 38, 34, 34), filter_child->visible_layer_rect());
|
| - EXPECT_EQ(gfx::Rect(-36, -36, 102, 102),
|
| - filter->render_surface()->content_rect());
|
| -
|
| - gfx::Transform vertical_flip;
|
| - vertical_flip.Scale(1, -1);
|
| - sk_sp<SkImageFilter> flip_filter = SkImageFilter::MakeMatrixFilter(
|
| - vertical_flip.matrix(), kLow_SkFilterQuality, nullptr);
|
| - FilterOperations reflection_filter;
|
| - reflection_filter.Append(
|
| - FilterOperation::CreateReferenceFilter(SkXfermodeImageFilter::Make(
|
| - SkBlendMode::kSrcOver, std::move(flip_filter))));
|
| - filter->test_properties()->filters = reflection_filter;
|
| - host_impl()->active_tree()->property_trees()->needs_rebuild = true;
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| -
|
| - EXPECT_EQ(gfx::Rect(50, 40, 10, 20), filter_child->visible_layer_rect());
|
| - EXPECT_EQ(gfx::Rect(0, -30, 30, 60),
|
| - filter->render_surface()->content_rect());
|
| -}
|
| -
|
| -TEST_F(LayerTreeHostCommonTest, ClipRectWithClipParentAndFilters) {
|
| - LayerImpl* root = root_layer_for_testing();
|
| - LayerImpl* clip = AddChild<LayerImpl>(root);
|
| - LayerImpl* filter = AddChild<LayerImpl>(clip);
|
| - LayerImpl* filter_child_1 = AddChild<LayerImpl>(filter);
|
| - LayerImpl* filter_child_2 = AddChild<LayerImpl>(filter);
|
| -
|
| - root->SetBounds(gfx::Size(100, 100));
|
| - clip->SetBounds(gfx::Size(10, 10));
|
| - filter->test_properties()->force_render_surface = true;
|
| -
|
| - filter_child_1->SetBounds(gfx::Size(20, 20));
|
| - filter_child_1->SetDrawsContent(true);
|
| - filter_child_2->SetBounds(gfx::Size(20, 20));
|
| - filter_child_2->SetDrawsContent(true);
|
| -
|
| - root->SetMasksToBounds(true);
|
| - clip->SetMasksToBounds(true);
|
| -
|
| - root->test_properties()->clip_children =
|
| - base::MakeUnique<std::set<LayerImpl*>>();
|
| - root->test_properties()->clip_children->insert(filter_child_1);
|
| - filter_child_1->test_properties()->clip_parent = root;
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| - EXPECT_TRUE(filter_child_1->is_clipped());
|
| - EXPECT_TRUE(filter_child_2->is_clipped());
|
| - EXPECT_EQ(gfx::Rect(100, 100), filter_child_1->clip_rect());
|
| - EXPECT_EQ(gfx::Rect(10, 10), filter_child_2->clip_rect());
|
| -
|
| - FilterOperations blur_filter;
|
| - blur_filter.Append(FilterOperation::CreateBlurFilter(4.0f));
|
| - filter->test_properties()->filters = blur_filter;
|
| - host_impl()->active_tree()->property_trees()->needs_rebuild = true;
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| -
|
| - EXPECT_TRUE(filter_child_1->is_clipped());
|
| - EXPECT_TRUE(filter_child_2->is_clipped());
|
| - EXPECT_EQ(gfx::Rect(100, 100), filter_child_1->clip_rect());
|
| - EXPECT_EQ(gfx::Rect(10, 10), filter_child_2->clip_rect());
|
| -}
|
| -
|
| -TEST_F(LayerTreeHostCommonTest, ClipRectWithClippedDescendantOfFilter) {
|
| - LayerImpl* root = root_layer_for_testing();
|
| - LayerImpl* filter = AddChild<LayerImpl>(root);
|
| - LayerImpl* clip = AddChild<LayerImpl>(filter);
|
| - LayerImpl* filter_grand_child = AddChild<LayerImpl>(clip);
|
| -
|
| - root->SetBounds(gfx::Size(100, 100));
|
| - filter->test_properties()->force_render_surface = true;
|
| -
|
| - clip->SetBounds(gfx::Size(10, 10));
|
| - clip->SetMasksToBounds(true);
|
| -
|
| - filter_grand_child->SetBounds(gfx::Size(20, 20));
|
| - filter_grand_child->SetDrawsContent(true);
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| - EXPECT_TRUE(filter_grand_child->is_clipped());
|
| - EXPECT_EQ(gfx::Rect(10, 10), filter_grand_child->clip_rect());
|
| -
|
| - FilterOperations blur_filter;
|
| - blur_filter.Append(FilterOperation::CreateBlurFilter(4.0f));
|
| - filter->test_properties()->filters = blur_filter;
|
| - host_impl()->active_tree()->property_trees()->needs_rebuild = true;
|
| -
|
| - ExecuteCalculateDrawProperties(root);
|
| -
|
| - EXPECT_TRUE(filter_grand_child->is_clipped());
|
| - EXPECT_EQ(gfx::Rect(10, 10), filter_grand_child->clip_rect());
|
| }
|
|
|
| TEST_F(LayerTreeHostCommonTest,
|
|
|