1 // Copyright (c) 2012 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/renderer/compositor_bindings/web_compositor_support_impl.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop_proxy.h"
9 #include "cc/animation/transform_operations.h"
10 #include "cc/output/output_surface.h"
11 #include "cc/output/software_output_device.h"
12 #include "webkit/child/webthread_impl.h"
13 #include "webkit/renderer/compositor_bindings/web_animation_impl.h"
14 #include "webkit/renderer/compositor_bindings/web_content_layer_impl.h"
15 #include "webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h"
16 #include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h"
17 #include "webkit/renderer/compositor_bindings/web_filter_operations_impl.h"
18 #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h"
19 #include "webkit/renderer/compositor_bindings/web_image_layer_impl.h"
20 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
21 #include "webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h"
22 #include "webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h"
23 #include "webkit/renderer/compositor_bindings/web_solid_color_layer_impl.h"
24 #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h"
25 #include "webkit/renderer/compositor_bindings/web_transform_operations_impl.h"
26
27 using blink::WebAnimation;
28 using blink::WebAnimationCurve;
29 using blink::WebContentLayer;
30 using blink::WebContentLayerClient;
31 using blink::WebExternalTextureLayer;
32 using blink::WebExternalTextureLayerClient;
33 using blink::WebFilterAnimationCurve;
34 using blink::WebFilterOperations;
35 using blink::WebFloatAnimationCurve;
36 using blink::WebImageLayer;
37 using blink::WebNinePatchLayer;
38 using blink::WebLayer;
39 using blink::WebScrollbar;
40 using blink::WebScrollbarLayer;
41 using blink::WebScrollbarThemeGeometry;
42 using blink::WebScrollbarThemePainter;
43 using blink::WebSolidColorLayer;
44 using blink::WebTransformAnimationCurve;
45 using blink::WebTransformOperations;
46
47 namespace webkit {
48
WebCompositorSupportImpl()49 WebCompositorSupportImpl::WebCompositorSupportImpl() {}
50
~WebCompositorSupportImpl()51 WebCompositorSupportImpl::~WebCompositorSupportImpl() {}
52
createLayer()53 WebLayer* WebCompositorSupportImpl::createLayer() {
54 return new WebLayerImpl();
55 }
56
createContentLayer(WebContentLayerClient * client)57 WebContentLayer* WebCompositorSupportImpl::createContentLayer(
58 WebContentLayerClient* client) {
59 return new WebContentLayerImpl(client);
60 }
61
createExternalTextureLayer(WebExternalTextureLayerClient * client)62 WebExternalTextureLayer* WebCompositorSupportImpl::createExternalTextureLayer(
63 WebExternalTextureLayerClient* client) {
64 return new WebExternalTextureLayerImpl(client);
65 }
66
createImageLayer()67 blink::WebImageLayer* WebCompositorSupportImpl::createImageLayer() {
68 return new WebImageLayerImpl();
69 }
70
createNinePatchLayer()71 blink::WebNinePatchLayer* WebCompositorSupportImpl::createNinePatchLayer() {
72 return new WebNinePatchLayerImpl();
73 }
74
createSolidColorLayer()75 WebSolidColorLayer* WebCompositorSupportImpl::createSolidColorLayer() {
76 return new WebSolidColorLayerImpl();
77 }
78
createScrollbarLayer(WebScrollbar * scrollbar,WebScrollbarThemePainter painter,WebScrollbarThemeGeometry * geometry)79 WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer(
80 WebScrollbar* scrollbar,
81 WebScrollbarThemePainter painter,
82 WebScrollbarThemeGeometry* geometry) {
83 return new WebScrollbarLayerImpl(scrollbar, painter, geometry);
84 }
85
createSolidColorScrollbarLayer(WebScrollbar::Orientation orientation,int thumb_thickness,bool is_left_side_vertical_scrollbar)86 WebScrollbarLayer* WebCompositorSupportImpl::createSolidColorScrollbarLayer(
87 WebScrollbar::Orientation orientation, int thumb_thickness,
88 bool is_left_side_vertical_scrollbar) {
89 return new WebScrollbarLayerImpl(orientation, thumb_thickness,
90 is_left_side_vertical_scrollbar);
91 }
92
createAnimation(const blink::WebAnimationCurve & curve,blink::WebAnimation::TargetProperty target,int animation_id)93 WebAnimation* WebCompositorSupportImpl::createAnimation(
94 const blink::WebAnimationCurve& curve,
95 blink::WebAnimation::TargetProperty target,
96 int animation_id) {
97 return new WebAnimationImpl(curve, target, animation_id, 0);
98 }
99
100 WebFilterAnimationCurve*
createFilterAnimationCurve()101 WebCompositorSupportImpl::createFilterAnimationCurve() {
102 return new WebFilterAnimationCurveImpl();
103 }
104
createFloatAnimationCurve()105 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() {
106 return new WebFloatAnimationCurveImpl();
107 }
108
109 WebTransformAnimationCurve*
createTransformAnimationCurve()110 WebCompositorSupportImpl::createTransformAnimationCurve() {
111 return new WebTransformAnimationCurveImpl();
112 }
113
createTransformOperations()114 WebTransformOperations* WebCompositorSupportImpl::createTransformOperations() {
115 return new WebTransformOperationsImpl();
116 }
117
createFilterOperations()118 WebFilterOperations* WebCompositorSupportImpl::createFilterOperations() {
119 return new WebFilterOperationsImpl();
120 }
121
122 } // namespace webkit
123