OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/string_number_conversions.h" |
| 9 #include "cc/fake_web_graphics_context_3d.h" |
| 10 #include "cc/font_atlas.h" |
| 11 #include "cc/input_handler.h" |
| 12 #include "cc/layer.h" |
| 13 #include "cc/layer_tree_host.h" |
| 14 #include "cc/switches.h" |
| 15 #include "cc/thread.h" |
| 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" |
| 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
| 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli
ent.h" |
| 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h
" |
| 22 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 23 #include "webkit/compositor_bindings/web_compositor_support_output_surface.h" |
| 24 #include "webkit/compositor_bindings/web_layer_impl.h" |
| 25 #include "webkit/compositor_bindings/web_rendering_stats_impl.h" |
| 26 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" |
| 27 |
| 28 namespace WebKit { |
| 29 |
| 30 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {} |
| 31 |
| 32 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} |
| 33 |
| 34 bool WebLayerTreeViewImplForTesting::initialize() { |
| 35 layer_tree_host_ = cc::LayerTreeHost::create(this, cc::LayerTreeSettings(), |
| 36 scoped_ptr<cc::Thread>()); |
| 37 if (!layer_tree_host_.get()) |
| 38 return false; |
| 39 return true; |
| 40 } |
| 41 |
| 42 void WebLayerTreeViewImplForTesting::setSurfaceReady() { |
| 43 layer_tree_host_->setSurfaceReady(); |
| 44 } |
| 45 |
| 46 void WebLayerTreeViewImplForTesting::setRootLayer(const WebLayer& root) { |
| 47 layer_tree_host_->setRootLayer( |
| 48 static_cast<const WebLayerImpl*>(&root)->layer()); |
| 49 } |
| 50 |
| 51 void WebLayerTreeViewImplForTesting::clearRootLayer() { |
| 52 layer_tree_host_->setRootLayer(scoped_refptr<cc::Layer>()); |
| 53 } |
| 54 |
| 55 void WebLayerTreeViewImplForTesting::setViewportSize( |
| 56 const WebSize& layout_viewport_size, const WebSize& device_viewport_size) { |
| 57 layer_tree_host_->setViewportSize(layout_viewport_size, device_viewport_size); |
| 58 } |
| 59 |
| 60 WebSize WebLayerTreeViewImplForTesting::layoutViewportSize() const { |
| 61 return layer_tree_host_->layoutViewportSize(); |
| 62 } |
| 63 |
| 64 WebSize WebLayerTreeViewImplForTesting::deviceViewportSize() const { |
| 65 return layer_tree_host_->deviceViewportSize(); |
| 66 } |
| 67 |
| 68 void WebLayerTreeViewImplForTesting::setDeviceScaleFactor( |
| 69 float device_scale_factor) { |
| 70 layer_tree_host_->setDeviceScaleFactor(device_scale_factor); |
| 71 } |
| 72 |
| 73 float WebLayerTreeViewImplForTesting::deviceScaleFactor() const { |
| 74 return layer_tree_host_->deviceScaleFactor(); |
| 75 } |
| 76 |
| 77 void WebLayerTreeViewImplForTesting::setBackgroundColor(WebColor color) { |
| 78 layer_tree_host_->setBackgroundColor(color); |
| 79 } |
| 80 |
| 81 void WebLayerTreeViewImplForTesting::setHasTransparentBackground( |
| 82 bool transparent) { |
| 83 layer_tree_host_->setHasTransparentBackground(transparent); |
| 84 } |
| 85 |
| 86 void WebLayerTreeViewImplForTesting::setVisible(bool visible) { |
| 87 layer_tree_host_->setVisible(visible); |
| 88 } |
| 89 |
| 90 void WebLayerTreeViewImplForTesting::setPageScaleFactorAndLimits( |
| 91 float page_scale_factor, float minimum, float maximum) { |
| 92 layer_tree_host_->setPageScaleFactorAndLimits(page_scale_factor, minimum, |
| 93 maximum); |
| 94 } |
| 95 |
| 96 void WebLayerTreeViewImplForTesting::startPageScaleAnimation( |
| 97 const WebPoint& scroll, bool use_anchor, float new_page_scale, |
| 98 double duration_sec) { |
| 99 } |
| 100 |
| 101 void WebLayerTreeViewImplForTesting::setNeedsAnimate() { |
| 102 layer_tree_host_->setNeedsAnimate(); |
| 103 } |
| 104 |
| 105 void WebLayerTreeViewImplForTesting::setNeedsRedraw() { |
| 106 layer_tree_host_->setNeedsRedraw(); |
| 107 } |
| 108 |
| 109 bool WebLayerTreeViewImplForTesting::commitRequested() const { |
| 110 return layer_tree_host_->commitRequested(); |
| 111 } |
| 112 |
| 113 void WebLayerTreeViewImplForTesting::composite() { |
| 114 layer_tree_host_->composite(); |
| 115 } |
| 116 |
| 117 void WebLayerTreeViewImplForTesting::updateAnimations( |
| 118 double frame_begin_timeSeconds) { |
| 119 base::TimeTicks frame_begin_time = base::TimeTicks::FromInternalValue( |
| 120 frame_begin_timeSeconds * base::Time::kMicrosecondsPerMillisecond); |
| 121 layer_tree_host_->updateAnimations(frame_begin_time); |
| 122 } |
| 123 |
| 124 void WebLayerTreeViewImplForTesting::didStopFlinging() { |
| 125 } |
| 126 |
| 127 bool WebLayerTreeViewImplForTesting::compositeAndReadback(void* pixels, |
| 128 const WebRect& rect) { |
| 129 return layer_tree_host_->compositeAndReadback(pixels, rect); |
| 130 } |
| 131 |
| 132 void WebLayerTreeViewImplForTesting::finishAllRendering() { |
| 133 layer_tree_host_->finishAllRendering(); |
| 134 } |
| 135 |
| 136 void WebLayerTreeViewImplForTesting::setDeferCommits(bool defer_commits) { |
| 137 layer_tree_host_->setDeferCommits(defer_commits); |
| 138 } |
| 139 |
| 140 void WebLayerTreeViewImplForTesting::renderingStats(WebRenderingStats&) const { |
| 141 } |
| 142 |
| 143 void WebLayerTreeViewImplForTesting::willBeginFrame() { |
| 144 } |
| 145 |
| 146 void WebLayerTreeViewImplForTesting::didBeginFrame() { |
| 147 } |
| 148 |
| 149 void WebLayerTreeViewImplForTesting::animate( |
| 150 double monotonic_frame_begin_time) { } |
| 151 |
| 152 void WebLayerTreeViewImplForTesting::layout() { } |
| 153 |
| 154 void WebLayerTreeViewImplForTesting::applyScrollAndScale( |
| 155 gfx::Vector2d scroll_delta, float page_scale) { |
| 156 } |
| 157 |
| 158 scoped_ptr<cc::OutputSurface> |
| 159 WebLayerTreeViewImplForTesting::createOutputSurface() { |
| 160 scoped_ptr<WebGraphicsContext3D> context3d( |
| 161 new cc::FakeWebGraphicsContext3D); |
| 162 return webkit::WebCompositorSupportOutputSurface::Create3d( |
| 163 context3d.Pass()).PassAs<cc::OutputSurface>(); |
| 164 } |
| 165 |
| 166 void WebLayerTreeViewImplForTesting::didRecreateOutputSurface(bool success) { } |
| 167 |
| 168 scoped_ptr<cc::InputHandler> |
| 169 WebLayerTreeViewImplForTesting::createInputHandler() { |
| 170 return scoped_ptr<cc::InputHandler>(); |
| 171 } |
| 172 |
| 173 void WebLayerTreeViewImplForTesting::willCommit() { } |
| 174 |
| 175 void WebLayerTreeViewImplForTesting::didCommit() { } |
| 176 |
| 177 void WebLayerTreeViewImplForTesting::didCommitAndDrawFrame() { } |
| 178 |
| 179 void WebLayerTreeViewImplForTesting::didCompleteSwapBuffers() { } |
| 180 |
| 181 void WebLayerTreeViewImplForTesting::scheduleComposite() { } |
| 182 |
| 183 scoped_ptr<cc::FontAtlas> WebLayerTreeViewImplForTesting::createFontAtlas() { |
| 184 return scoped_ptr<cc::FontAtlas>(); |
| 185 } |
| 186 |
| 187 } // namespace WebKit |
OLD | NEW |