Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: content/test/web_layer_tree_view_impl_for_testing.cc

Issue 1413373007: CC AnimationHost: Fix LinkHighlights detach scope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/test/web_layer_tree_view_impl_for_testing.cc
diff --git a/content/test/web_layer_tree_view_impl_for_testing.cc b/content/test/web_layer_tree_view_impl_for_testing.cc
index 8b07ba26e9cc11f7ad4c170070c3cda8b196c9a0..534085df35f01b81a548dd0a2c2dbb28f7cd6ee1 100644
--- a/content/test/web_layer_tree_view_impl_for_testing.cc
+++ b/content/test/web_layer_tree_view_impl_for_testing.cc
@@ -8,7 +8,10 @@
#include "base/strings/string_number_conversions.h"
#include "base/synchronization/lock.h"
#include "base/thread_task_runner_handle.h"
+#include "cc/animation/animation_host.h"
+#include "cc/animation/animation_timeline.h"
#include "cc/base/switches.h"
+#include "cc/blink/web_compositor_animation_timeline_impl.h"
#include "cc/blink/web_layer_impl.h"
#include "cc/input/input_handler.h"
#include "cc/layers/layer.h"
@@ -19,6 +22,7 @@
#include "third_party/WebKit/public/platform/WebLayer.h"
#include "third_party/WebKit/public/platform/WebLayerTreeView.h"
#include "third_party/WebKit/public/platform/WebSize.h"
+#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
using blink::WebColor;
using blink::WebRect;
@@ -30,7 +34,8 @@ WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {}
WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {}
-void WebLayerTreeViewImplForTesting::Initialize() {
+void WebLayerTreeViewImplForTesting::Initialize(
+ bool use_compositor_animation_timelines) {
cc::LayerTreeSettings settings;
// For web contents, layer transforms should scale up the contents of layers
@@ -39,6 +44,11 @@ void WebLayerTreeViewImplForTesting::Initialize() {
// Accelerated animations are enabled for unit tests.
settings.accelerated_animation_enabled = true;
+ settings.use_compositor_animation_timelines =
+ use_compositor_animation_timelines;
+ blink::WebRuntimeFeatures::enableCompositorAnimationTimelines(
+ use_compositor_animation_timelines);
loyso (OOO) 2015/11/03 05:08:53 Alternatively, we can land it with 'settings.use_c
chrishtr 2015/11/03 05:43:29 I think that would be better, since you'll want to
+
cc::LayerTreeHost::InitParams params;
params.client = this;
params.settings = &settings;
@@ -58,6 +68,26 @@ void WebLayerTreeViewImplForTesting::clearRootLayer() {
layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>());
}
+void WebLayerTreeViewImplForTesting::attachCompositorAnimationTimeline(
+ blink::WebCompositorAnimationTimeline* compositor_timeline) {
+ DCHECK(compositor_timeline);
+ DCHECK(layer_tree_host_->animation_host());
+ layer_tree_host_->animation_host()->AddAnimationTimeline(
+ static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>(
+ compositor_timeline)
+ ->animation_timeline());
+}
+
+void WebLayerTreeViewImplForTesting::detachCompositorAnimationTimeline(
+ blink::WebCompositorAnimationTimeline* compositor_timeline) {
+ DCHECK(compositor_timeline);
+ DCHECK(layer_tree_host_->animation_host());
+ layer_tree_host_->animation_host()->RemoveAnimationTimeline(
+ static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>(
+ compositor_timeline)
+ ->animation_timeline());
+}
+
void WebLayerTreeViewImplForTesting::setViewportSize(
const WebSize& unused_deprecated,
const WebSize& device_viewport_size) {
« no previous file with comments | « content/test/web_layer_tree_view_impl_for_testing.h ('k') | third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698