| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/testing/WebLayerTreeViewImplForTesting.h" | 5 #include "platform/testing/WebLayerTreeViewImplForTesting.h" |
| 6 | 6 |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "cc/animation/animation_host.h" | 8 #include "cc/animation/animation_host.h" |
| 9 #include "cc/animation/animation_timeline.h" | 9 #include "cc/animation/animation_timeline.h" |
| 10 #include "cc/blink/web_layer_impl.h" | 10 #include "cc/blink/web_layer_impl.h" |
| 11 #include "cc/layers/layer.h" | 11 #include "cc/layers/layer.h" |
| 12 #include "cc/trees/layer_tree_host.h" | 12 #include "cc/trees/layer_tree_host.h" |
| 13 #include "public/platform/Platform.h" | 13 #include "public/platform/Platform.h" |
| 14 #include "public/platform/WebLayer.h" | 14 #include "public/platform/WebLayer.h" |
| 15 #include "public/platform/WebLayerTreeView.h" | 15 #include "public/platform/WebLayerTreeView.h" |
| 16 #include "public/platform/WebSize.h" | 16 #include "public/platform/WebSize.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() | 20 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() |
| 21 : WebLayerTreeViewImplForTesting(defaultLayerTreeSettings()) |
| 21 { | 22 { |
| 22 cc::LayerTreeSettings settings; | 23 } |
| 23 | 24 |
| 24 // For web contents, layer transforms should scale up the contents of layers | 25 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting(const cc::LayerTr
eeSettings& settings) |
| 25 // to keep content always crisp when possible. | 26 { |
| 26 settings.layer_transforms_should_scale_layer_contents = true; | |
| 27 | |
| 28 cc::LayerTreeHost::InitParams params; | 27 cc::LayerTreeHost::InitParams params; |
| 29 params.client = this; | 28 params.client = this; |
| 30 params.settings = &settings; | 29 params.settings = &settings; |
| 31 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 30 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 32 params.task_graph_runner = &m_taskGraphRunner; | 31 params.task_graph_runner = &m_taskGraphRunner; |
| 33 m_layerTreeHost = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); | 32 m_layerTreeHost = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); |
| 34 ASSERT(m_layerTreeHost); | 33 ASSERT(m_layerTreeHost); |
| 35 } | 34 } |
| 36 | 35 |
| 37 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} | 36 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} |
| 38 | 37 |
| 38 // static |
| 39 cc::LayerTreeSettings WebLayerTreeViewImplForTesting::defaultLayerTreeSettings() |
| 40 { |
| 41 cc::LayerTreeSettings settings; |
| 42 |
| 43 // For web contents, layer transforms should scale up the contents of layers |
| 44 // to keep content always crisp when possible. |
| 45 settings.layer_transforms_should_scale_layer_contents = true; |
| 46 |
| 47 return settings; |
| 48 } |
| 49 |
| 39 void WebLayerTreeViewImplForTesting::setRootLayer(const blink::WebLayer& root) | 50 void WebLayerTreeViewImplForTesting::setRootLayer(const blink::WebLayer& root) |
| 40 { | 51 { |
| 41 m_layerTreeHost->SetRootLayer(static_cast<const cc_blink::WebLayerImpl*>(&ro
ot)->layer()); | 52 m_layerTreeHost->SetRootLayer(static_cast<const cc_blink::WebLayerImpl*>(&ro
ot)->layer()); |
| 42 } | 53 } |
| 43 | 54 |
| 44 void WebLayerTreeViewImplForTesting::clearRootLayer() | 55 void WebLayerTreeViewImplForTesting::clearRootLayer() |
| 45 { | 56 { |
| 46 m_layerTreeHost->SetRootLayer(scoped_refptr<cc::Layer>()); | 57 m_layerTreeHost->SetRootLayer(scoped_refptr<cc::Layer>()); |
| 47 } | 58 } |
| 48 | 59 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 { | 210 { |
| 200 m_layerTreeHost->SetHaveScrollEventHandlers(haveEentHandlers); | 211 m_layerTreeHost->SetHaveScrollEventHandlers(haveEentHandlers); |
| 201 } | 212 } |
| 202 | 213 |
| 203 bool WebLayerTreeViewImplForTesting::haveScrollEventHandlers() const | 214 bool WebLayerTreeViewImplForTesting::haveScrollEventHandlers() const |
| 204 { | 215 { |
| 205 return m_layerTreeHost->have_scroll_event_handlers(); | 216 return m_layerTreeHost->have_scroll_event_handlers(); |
| 206 } | 217 } |
| 207 | 218 |
| 208 } // namespace blink | 219 } // namespace blink |
| OLD | NEW |