Commit 83186398 authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

Remove platform/graphics -> platform/animation dependency

The dependency was test-only. Extracted ViewportLayersSetup
helper class to platform/testing to be reused both in animation
and graphics.

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Icf6b0578ceb99c1f7630e6ef5db1f0c6082cb13a
Reviewed-on: https://chromium-review.googlesource.com/1155750
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579518}
parent 20bf1c3f
......@@ -1655,6 +1655,8 @@ jumbo_static_library("test_support") {
"testing/url_test_helpers.cc",
"testing/url_test_helpers.h",
"testing/use_mock_scrollbar_settings.h",
"testing/viewport_layers_setup.cc",
"testing/viewport_layers_setup.h",
"testing/weburl_loader_mock.cc",
"testing/weburl_loader_mock.h",
"testing/weburl_loader_mock_factory_impl.cc",
......@@ -2209,6 +2211,7 @@ jumbo_source_set("unit_tests") {
visibility = []
visibility = [ "//third_party/blink/renderer/*" ]
sources = [
"animation/animated_layers_test.cc",
"graphics/canvas_2d_layer_bridge_test.cc",
"graphics/canvas_color_params_test.cc",
"graphics/canvas_resource_test.cc",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "cc/layers/picture_layer.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/mutator_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_client.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_host.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_timeline.h"
#include "third_party/blink/renderer/platform/animation/compositor_float_animation_curve.h"
#include "third_party/blink/renderer/platform/animation/compositor_keyframe_model.h"
#include "third_party/blink/renderer/platform/animation/compositor_target_property.h"
#include "third_party/blink/renderer/platform/graphics/compositor_element_id.h"
#include "third_party/blink/renderer/platform/testing/fake_graphics_layer.h"
#include "third_party/blink/renderer/platform/testing/fake_graphics_layer_client.h"
#include "third_party/blink/renderer/platform/testing/paint_test_configurations.h"
#include "third_party/blink/renderer/platform/testing/viewport_layers_setup.h"
namespace blink {
class AnimatedLayersTest : public testing::Test,
public PaintTestConfigurations {
public:
AnimatedLayersTest() = default;
~AnimatedLayersTest() = default;
protected:
ViewportLayersSetup layers_;
};
INSTANTIATE_TEST_CASE_P(All,
AnimatedLayersTest,
testing::Values(0, kBlinkGenPropertyTrees));
class AnimationForTesting : public CompositorAnimationClient {
public:
AnimationForTesting() {
compositor_animation_ = CompositorAnimation::Create();
}
CompositorAnimation* GetCompositorAnimation() const override {
return compositor_animation_.get();
}
std::unique_ptr<CompositorAnimation> compositor_animation_;
};
TEST_P(AnimatedLayersTest, updateLayerShouldFlattenTransformWithAnimations) {
// TODO(bokan): This test doesn't yet work in blink-gen-property-trees
// because cc::Layers can't set an element id in that mode. We fail at
// AttachElement since the element id is invalid. https://crbug.com/836897.
if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled())
return;
cc::Layer* cc_layer = layers_.graphics_layer().CcLayer();
cc::MutatorHost* mutator = layers_.layer_tree_host()->mutator_host();
EXPECT_FALSE(
mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
std::unique_ptr<CompositorFloatAnimationCurve> curve =
CompositorFloatAnimationCurve::Create();
curve->AddKeyframe(
CompositorFloatKeyframe(0.0, 0.0,
*CubicBezierTimingFunction::Preset(
CubicBezierTimingFunction::EaseType::EASE)));
std::unique_ptr<CompositorKeyframeModel> float_keyframe_model(
CompositorKeyframeModel::Create(*curve, CompositorTargetProperty::OPACITY,
0, 0));
int keyframe_model_id = float_keyframe_model->Id();
std::unique_ptr<CompositorAnimationTimeline> compositor_timeline =
CompositorAnimationTimeline::Create();
AnimationForTesting animation;
CompositorAnimationHost host(layers_.animation_host());
host.AddTimeline(*compositor_timeline);
compositor_timeline->AnimationAttached(animation);
cc_layer->SetElementId(CompositorElementId(cc_layer->id()));
animation.GetCompositorAnimation()->AttachElement(cc_layer->element_id());
ASSERT_TRUE(animation.GetCompositorAnimation()->IsElementAttached());
animation.GetCompositorAnimation()->AddKeyframeModel(
std::move(float_keyframe_model));
EXPECT_TRUE(
mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
layers_.graphics_layer().SetShouldFlattenTransform(false);
cc_layer = layers_.graphics_layer().CcLayer();
ASSERT_TRUE(cc_layer);
EXPECT_TRUE(
mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
animation.GetCompositorAnimation()->RemoveKeyframeModel(keyframe_model_id);
EXPECT_FALSE(
mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
layers_.graphics_layer().SetShouldFlattenTransform(true);
cc_layer = layers_.graphics_layer().CcLayer();
ASSERT_TRUE(cc_layer);
EXPECT_FALSE(
mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
animation.GetCompositorAnimation()->DetachElement();
ASSERT_FALSE(animation.GetCompositorAnimation()->IsElementAttached());
compositor_timeline->AnimationDestroyed(animation);
host.RemoveTimeline(*compositor_timeline.get());
}
} // namespace blink
......@@ -23,7 +23,6 @@ include_rules = [
"+media/renderers/video_resource_updater.h",
"+services/ui/public/cpp/gpu/context_provider_command_buffer.h",
"+services/viz/public/interfaces",
"+third_party/blink/renderer/platform/animation",
"+third_party/blink/renderer/platform/cpu/mips/common_macros_msa.h",
"+third_party/blink/renderer/platform/cross_thread_functional.h",
"+third_party/blink/renderer/platform/drag_image.h",
......
......@@ -26,7 +26,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_COLOR_BLEND_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_COLOR_BLEND_H_
#include "third_party/blink/renderer/platform/animation/animation_utilities.h"
#include "third_party/blink/renderer/platform/geometry/blend.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
namespace blink {
......
......@@ -29,28 +29,14 @@
#include <utility>
#include "cc/layers/picture_layer.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/mutator_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_thread.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_client.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_host.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_timeline.h"
#include "third_party/blink/renderer/platform/animation/compositor_float_animation_curve.h"
#include "third_party/blink/renderer/platform/animation/compositor_keyframe_model.h"
#include "third_party/blink/renderer/platform/animation/compositor_target_property.h"
#include "third_party/blink/renderer/platform/graphics/compositor_element_id.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h"
#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h"
#include "third_party/blink/renderer/platform/graphics/paint/scoped_paint_chunk_properties.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/fake_graphics_layer.h"
#include "third_party/blink/renderer/platform/testing/fake_graphics_layer_client.h"
#include "third_party/blink/renderer/platform/testing/layer_tree_host_embedder.h"
#include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/paint_test_configurations.h"
#include "third_party/blink/renderer/platform/testing/viewport_layers_setup.h"
#include "third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.h"
#include "third_party/blink/renderer/platform/transforms/rotate_transform_operation.h"
#include "third_party/blink/renderer/platform/transforms/translate_transform_operation.h"
......@@ -59,39 +45,9 @@ namespace blink {
class GraphicsLayerTest : public testing::Test, public PaintTestConfigurations {
public:
GraphicsLayerTest() {
clip_layer_ = std::make_unique<FakeGraphicsLayer>(client_);
scroll_elasticity_layer_ = std::make_unique<FakeGraphicsLayer>(client_);
page_scale_layer_ = std::make_unique<FakeGraphicsLayer>(client_);
graphics_layer_ = std::make_unique<FakeGraphicsLayer>(client_);
graphics_layer_->SetDrawsContent(true);
clip_layer_->AddChild(scroll_elasticity_layer_.get());
scroll_elasticity_layer_->AddChild(page_scale_layer_.get());
page_scale_layer_->AddChild(graphics_layer_.get());
graphics_layer_->CcLayer()->SetScrollable(clip_layer_->CcLayer()->bounds());
cc_layer_ = graphics_layer_->CcLayer();
layer_tree_ = std::make_unique<LayerTreeHostEmbedder>();
layer_tree_->layer_tree_host()->SetRootLayer(clip_layer_->CcLayer());
cc::LayerTreeHost::ViewportLayers viewport_layers;
viewport_layers.overscroll_elasticity = scroll_elasticity_layer_->CcLayer();
viewport_layers.page_scale = page_scale_layer_->CcLayer();
viewport_layers.inner_viewport_container = clip_layer_->CcLayer();
viewport_layers.inner_viewport_scroll = graphics_layer_->CcLayer();
layer_tree_->layer_tree_host()->RegisterViewportLayers(viewport_layers);
layer_tree_->layer_tree_host()->SetViewportSizeAndScale(
gfx::Size(1, 1), /*device_scale_factor=*/1.f, viz::LocalSurfaceId());
graphics_layer_->SetLayerState(PropertyTreeState(PropertyTreeState::Root()),
IntPoint());
}
GraphicsLayerTest() = default;
~GraphicsLayerTest() = default;
cc::LayerTreeHost* layer_tree_host() {
return layer_tree_->layer_tree_host();
}
cc::AnimationHost* animation_host() { return layer_tree_->animation_host(); }
protected:
bool PaintWithoutCommit(GraphicsLayer& layer, const IntRect* interest_rect) {
return layer.PaintWithoutCommit(interest_rect);
......@@ -116,15 +72,7 @@ class GraphicsLayerTest : public testing::Test, public PaintTestConfigurations {
return layer.paint_controller_.get();
}
cc::Layer* cc_layer_;
std::unique_ptr<FakeGraphicsLayer> graphics_layer_;
std::unique_ptr<FakeGraphicsLayer> page_scale_layer_;
std::unique_ptr<FakeGraphicsLayer> scroll_elasticity_layer_;
std::unique_ptr<FakeGraphicsLayer> clip_layer_;
FakeGraphicsLayerClient client_;
private:
std::unique_ptr<LayerTreeHostEmbedder> layer_tree_;
ViewportLayersSetup layers_;
};
INSTANTIATE_TEST_CASE_P(All,
......@@ -132,108 +80,27 @@ INSTANTIATE_TEST_CASE_P(All,
testing::Values(0,
kBlinkGenPropertyTrees));
class AnimationForTesting : public CompositorAnimationClient {
public:
AnimationForTesting() {
compositor_animation_ = CompositorAnimation::Create();
}
CompositorAnimation* GetCompositorAnimation() const override {
return compositor_animation_.get();
}
std::unique_ptr<CompositorAnimation> compositor_animation_;
};
TEST_P(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations) {
// TODO(bokan): This test doesn't yet work in blink-gen-property-trees
// because cc::Layers can't set an element id in that mode. We fail at
// AttachElement since the element id is invalid. https://crbug.com/836897.
if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled())
return;
cc::MutatorHost* mutator = layer_tree_host()->mutator_host();
EXPECT_FALSE(
mutator->HasTickingKeyframeModelForTesting(cc_layer_->element_id()));
std::unique_ptr<CompositorFloatAnimationCurve> curve =
CompositorFloatAnimationCurve::Create();
curve->AddKeyframe(
CompositorFloatKeyframe(0.0, 0.0,
*CubicBezierTimingFunction::Preset(
CubicBezierTimingFunction::EaseType::EASE)));
std::unique_ptr<CompositorKeyframeModel> float_keyframe_model(
CompositorKeyframeModel::Create(*curve, CompositorTargetProperty::OPACITY,
0, 0));
int keyframe_model_id = float_keyframe_model->Id();
std::unique_ptr<CompositorAnimationTimeline> compositor_timeline =
CompositorAnimationTimeline::Create();
AnimationForTesting animation;
CompositorAnimationHost host(animation_host());
host.AddTimeline(*compositor_timeline);
compositor_timeline->AnimationAttached(animation);
cc_layer_->SetElementId(CompositorElementId(cc_layer_->id()));
animation.GetCompositorAnimation()->AttachElement(cc_layer_->element_id());
ASSERT_TRUE(animation.GetCompositorAnimation()->IsElementAttached());
animation.GetCompositorAnimation()->AddKeyframeModel(
std::move(float_keyframe_model));
EXPECT_TRUE(
mutator->HasTickingKeyframeModelForTesting(cc_layer_->element_id()));
graphics_layer_->SetShouldFlattenTransform(false);
cc_layer_ = graphics_layer_->CcLayer();
ASSERT_TRUE(cc_layer_);
EXPECT_TRUE(
mutator->HasTickingKeyframeModelForTesting(cc_layer_->element_id()));
animation.GetCompositorAnimation()->RemoveKeyframeModel(keyframe_model_id);
EXPECT_FALSE(
mutator->HasTickingKeyframeModelForTesting(cc_layer_->element_id()));
graphics_layer_->SetShouldFlattenTransform(true);
cc_layer_ = graphics_layer_->CcLayer();
ASSERT_TRUE(cc_layer_);
EXPECT_FALSE(
mutator->HasTickingKeyframeModelForTesting(cc_layer_->element_id()));
animation.GetCompositorAnimation()->DetachElement();
ASSERT_FALSE(animation.GetCompositorAnimation()->IsElementAttached());
compositor_timeline->AnimationDestroyed(animation);
host.RemoveTimeline(*compositor_timeline.get());
}
TEST_P(GraphicsLayerTest, Paint) {
IntRect interest_rect(1, 2, 3, 4);
EXPECT_TRUE(PaintWithoutCommit(*graphics_layer_, &interest_rect));
CommitAndFinishCycle(*graphics_layer_);
EXPECT_TRUE(PaintWithoutCommit(layers_.graphics_layer(), &interest_rect));
CommitAndFinishCycle(layers_.graphics_layer());
client_.SetNeedsRepaint(true);
EXPECT_TRUE(PaintWithoutCommit(*graphics_layer_, &interest_rect));
CommitAndFinishCycle(*graphics_layer_);
layers_.graphics_layer_client().SetNeedsRepaint(true);
EXPECT_TRUE(PaintWithoutCommit(layers_.graphics_layer(), &interest_rect));
CommitAndFinishCycle(layers_.graphics_layer());
client_.SetNeedsRepaint(false);
EXPECT_FALSE(PaintWithoutCommit(*graphics_layer_, &interest_rect));
layers_.graphics_layer_client().SetNeedsRepaint(false);
EXPECT_FALSE(PaintWithoutCommit(layers_.graphics_layer(), &interest_rect));
interest_rect.Move(IntSize(10, 20));
EXPECT_TRUE(PaintWithoutCommit(*graphics_layer_, &interest_rect));
CommitAndFinishCycle(*graphics_layer_);
EXPECT_FALSE(PaintWithoutCommit(*graphics_layer_, &interest_rect));
graphics_layer_->SetNeedsDisplay();
EXPECT_TRUE(PaintWithoutCommit(*graphics_layer_, &interest_rect));
CommitAndFinishCycle(*graphics_layer_);
EXPECT_FALSE(PaintWithoutCommit(*graphics_layer_, &interest_rect));
EXPECT_TRUE(PaintWithoutCommit(layers_.graphics_layer(), &interest_rect));
CommitAndFinishCycle(layers_.graphics_layer());
EXPECT_FALSE(PaintWithoutCommit(layers_.graphics_layer(), &interest_rect));
layers_.graphics_layer().SetNeedsDisplay();
EXPECT_TRUE(PaintWithoutCommit(layers_.graphics_layer(), &interest_rect));
CommitAndFinishCycle(layers_.graphics_layer());
EXPECT_FALSE(PaintWithoutCommit(layers_.graphics_layer(), &interest_rect));
}
TEST_P(GraphicsLayerTest, PaintRecursively) {
......@@ -244,8 +111,10 @@ TEST_P(GraphicsLayerTest, PaintRecursively) {
auto transform2 =
CreateTransform(*transform1, TransformationMatrix().Scale(2));
client_.SetPainter([&](const GraphicsLayer* layer, GraphicsContext& context,
GraphicsLayerPaintingPhase, const IntRect&) {
layers_.graphics_layer_client().SetPainter([&](const GraphicsLayer* layer,
GraphicsContext& context,
GraphicsLayerPaintingPhase,
const IntRect&) {
{
ScopedPaintChunkProperties properties(context.GetPaintController(),
transform1.get(), *layer,
......@@ -267,23 +136,23 @@ TEST_P(GraphicsLayerTest, PaintRecursively) {
TransformationMatrix().Translate(20, 30)});
EXPECT_TRUE(transform1->Changed(transform_root));
EXPECT_TRUE(transform2->Changed(transform_root));
client_.SetNeedsRepaint(true);
graphics_layer_->PaintRecursively();
layers_.graphics_layer_client().SetNeedsRepaint(true);
layers_.graphics_layer().PaintRecursively();
EXPECT_FALSE(transform1->Changed(transform_root));
EXPECT_FALSE(transform2->Changed(transform_root));
}
TEST_P(GraphicsLayerTest, SetDrawsContentFalse) {
EXPECT_TRUE(graphics_layer_->DrawsContent());
graphics_layer_->GetPaintController();
EXPECT_NE(nullptr, GetInternalPaintController(*graphics_layer_));
EnsureRasterInvalidator(*graphics_layer_);
EXPECT_NE(nullptr, GetInternalRasterInvalidator(*graphics_layer_));
graphics_layer_->SetDrawsContent(false);
EXPECT_EQ(nullptr, GetInternalPaintController(*graphics_layer_));
EXPECT_EQ(nullptr, GetInternalRasterInvalidator(*graphics_layer_));
EXPECT_TRUE(layers_.graphics_layer().DrawsContent());
layers_.graphics_layer().GetPaintController();
EXPECT_NE(nullptr, GetInternalPaintController(layers_.graphics_layer()));
EnsureRasterInvalidator(layers_.graphics_layer());
EXPECT_NE(nullptr, GetInternalRasterInvalidator(layers_.graphics_layer()));
layers_.graphics_layer().SetDrawsContent(false);
EXPECT_EQ(nullptr, GetInternalPaintController(layers_.graphics_layer()));
EXPECT_EQ(nullptr, GetInternalRasterInvalidator(layers_.graphics_layer()));
}
} // namespace blink
......@@ -5,6 +5,8 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_FAKE_GRAPHICS_LAYER_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_FAKE_GRAPHICS_LAYER_H_
#include "third_party/blink/renderer/platform/graphics/graphics_layer.h"
namespace blink {
// A simple GraphicsLayer implementation suitable for use in unit tests.
......
......@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_FAKE_GRAPHICS_LAYER_CLIENT_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_FAKE_GRAPHICS_LAYER_CLIENT_H_
#include "third_party/blink/renderer/platform/geometry/int_rect.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer_client.h"
namespace blink {
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/platform/testing/viewport_layers_setup.h"
#include <memory>
#include "cc/layers/picture_layer.h"
#include "cc/trees/layer_tree_host.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer.h"
#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h"
#include "third_party/blink/renderer/platform/testing/fake_graphics_layer.h"
#include "third_party/blink/renderer/platform/testing/fake_graphics_layer_client.h"
#include "third_party/blink/renderer/platform/testing/layer_tree_host_embedder.h"
namespace blink {
ViewportLayersSetup::ViewportLayersSetup() {
clip_layer_ = std::make_unique<FakeGraphicsLayer>(client_);
scroll_elasticity_layer_ = std::make_unique<FakeGraphicsLayer>(client_);
page_scale_layer_ = std::make_unique<FakeGraphicsLayer>(client_);
graphics_layer_ = std::make_unique<FakeGraphicsLayer>(client_);
graphics_layer_->SetDrawsContent(true);
clip_layer_->AddChild(scroll_elasticity_layer_.get());
scroll_elasticity_layer_->AddChild(page_scale_layer_.get());
page_scale_layer_->AddChild(graphics_layer_.get());
graphics_layer_->CcLayer()->SetScrollable(clip_layer_->CcLayer()->bounds());
layer_tree_ = std::make_unique<LayerTreeHostEmbedder>();
layer_tree_->layer_tree_host()->SetRootLayer(clip_layer_->CcLayer());
cc::LayerTreeHost::ViewportLayers viewport_layers;
viewport_layers.overscroll_elasticity = scroll_elasticity_layer_->CcLayer();
viewport_layers.page_scale = page_scale_layer_->CcLayer();
viewport_layers.inner_viewport_container = clip_layer_->CcLayer();
viewport_layers.inner_viewport_scroll = graphics_layer_->CcLayer();
layer_tree_->layer_tree_host()->RegisterViewportLayers(viewport_layers);
layer_tree_->layer_tree_host()->SetViewportSizeAndScale(
gfx::Size(1, 1), /*device_scale_factor=*/1.f, viz::LocalSurfaceId());
graphics_layer_->SetLayerState(PropertyTreeState(PropertyTreeState::Root()),
IntPoint());
}
ViewportLayersSetup::~ViewportLayersSetup() = default;
cc::LayerTreeHost* ViewportLayersSetup::layer_tree_host() {
return layer_tree_->layer_tree_host();
}
cc::AnimationHost* ViewportLayersSetup::animation_host() {
return layer_tree_->animation_host();
}
} // namespace blink
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_VIEWPORT_LAYERS_SETUP_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_VIEWPORT_LAYERS_SETUP_H_
#include <memory>
#include "third_party/blink/renderer/platform/testing/fake_graphics_layer_client.h"
namespace cc {
class AnimationHost;
class LayerTreeHost;
} // namespace cc
namespace blink {
class FakeGraphicsLayer;
class LayerTreeHostEmbedder;
class ViewportLayersSetup {
public:
ViewportLayersSetup();
~ViewportLayersSetup();
FakeGraphicsLayer& graphics_layer() { return *graphics_layer_; }
FakeGraphicsLayerClient& graphics_layer_client() { return client_; }
cc::LayerTreeHost* layer_tree_host();
cc::AnimationHost* animation_host();
private:
std::unique_ptr<FakeGraphicsLayer> graphics_layer_;
std::unique_ptr<FakeGraphicsLayer> page_scale_layer_;
std::unique_ptr<FakeGraphicsLayer> scroll_elasticity_layer_;
std::unique_ptr<FakeGraphicsLayer> clip_layer_;
FakeGraphicsLayerClient client_;
std::unique_ptr<LayerTreeHostEmbedder> layer_tree_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_VIEWPORT_LAYERS_SETUP_H_
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