• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 "content/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 "content/renderer/compositor_bindings/web_animation_impl.h"
13 #include "content/renderer/compositor_bindings/web_content_layer_impl.h"
14 #include "content/renderer/compositor_bindings/web_external_texture_layer_impl.h"
15 #include "content/renderer/compositor_bindings/web_filter_animation_curve_impl.h"
16 #include "content/renderer/compositor_bindings/web_filter_operations_impl.h"
17 #include "content/renderer/compositor_bindings/web_float_animation_curve_impl.h"
18 #include "content/renderer/compositor_bindings/web_image_layer_impl.h"
19 #include "content/renderer/compositor_bindings/web_layer_impl.h"
20 #include "content/renderer/compositor_bindings/web_nine_patch_layer_impl.h"
21 #include "content/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.h"
22 #include "content/renderer/compositor_bindings/web_scrollbar_layer_impl.h"
23 #include "content/renderer/compositor_bindings/web_solid_color_layer_impl.h"
24 #include "content/renderer/compositor_bindings/web_transform_animation_curve_impl.h"
25 #include "content/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 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED
44 using blink::WebScrollOffsetAnimationCurve;
45 #endif
46 using blink::WebSolidColorLayer;
47 using blink::WebTransformAnimationCurve;
48 using blink::WebTransformOperations;
49 
50 namespace content {
51 
WebCompositorSupportImpl()52 WebCompositorSupportImpl::WebCompositorSupportImpl() {
53 }
54 
~WebCompositorSupportImpl()55 WebCompositorSupportImpl::~WebCompositorSupportImpl() {
56 }
57 
createLayer()58 WebLayer* WebCompositorSupportImpl::createLayer() {
59   return new WebLayerImpl();
60 }
61 
createContentLayer(WebContentLayerClient * client)62 WebContentLayer* WebCompositorSupportImpl::createContentLayer(
63     WebContentLayerClient* client) {
64   return new WebContentLayerImpl(client);
65 }
66 
createExternalTextureLayer(WebExternalTextureLayerClient * client)67 WebExternalTextureLayer* WebCompositorSupportImpl::createExternalTextureLayer(
68     WebExternalTextureLayerClient* client) {
69   return new WebExternalTextureLayerImpl(client);
70 }
71 
createImageLayer()72 blink::WebImageLayer* WebCompositorSupportImpl::createImageLayer() {
73   return new WebImageLayerImpl();
74 }
75 
createNinePatchLayer()76 blink::WebNinePatchLayer* WebCompositorSupportImpl::createNinePatchLayer() {
77   return new WebNinePatchLayerImpl();
78 }
79 
createSolidColorLayer()80 WebSolidColorLayer* WebCompositorSupportImpl::createSolidColorLayer() {
81   return new WebSolidColorLayerImpl();
82 }
83 
createScrollbarLayer(WebScrollbar * scrollbar,WebScrollbarThemePainter painter,WebScrollbarThemeGeometry * geometry)84 WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer(
85     WebScrollbar* scrollbar,
86     WebScrollbarThemePainter painter,
87     WebScrollbarThemeGeometry* geometry) {
88   return new WebScrollbarLayerImpl(scrollbar, painter, geometry);
89 }
90 
createSolidColorScrollbarLayer(WebScrollbar::Orientation orientation,int thumb_thickness,int track_start,bool is_left_side_vertical_scrollbar)91 WebScrollbarLayer* WebCompositorSupportImpl::createSolidColorScrollbarLayer(
92     WebScrollbar::Orientation orientation,
93     int thumb_thickness,
94     int track_start,
95     bool is_left_side_vertical_scrollbar) {
96   return new WebScrollbarLayerImpl(orientation,
97                                    thumb_thickness,
98                                    track_start,
99                                    is_left_side_vertical_scrollbar);
100 }
101 
createAnimation(const blink::WebAnimationCurve & curve,blink::WebAnimation::TargetProperty target,int animation_id)102 WebAnimation* WebCompositorSupportImpl::createAnimation(
103     const blink::WebAnimationCurve& curve,
104     blink::WebAnimation::TargetProperty target,
105     int animation_id) {
106   return new WebAnimationImpl(curve, target, animation_id, 0);
107 }
108 
109 WebFilterAnimationCurve*
createFilterAnimationCurve()110 WebCompositorSupportImpl::createFilterAnimationCurve() {
111   return new WebFilterAnimationCurveImpl();
112 }
113 
createFloatAnimationCurve()114 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() {
115   return new WebFloatAnimationCurveImpl();
116 }
117 
118 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED
119 WebScrollOffsetAnimationCurve*
createScrollOffsetAnimationCurve(blink::WebFloatPoint target_value,blink::WebAnimationCurve::TimingFunctionType timing_function)120 WebCompositorSupportImpl::createScrollOffsetAnimationCurve(
121     blink::WebFloatPoint target_value,
122     blink::WebAnimationCurve::TimingFunctionType timing_function) {
123   return new WebScrollOffsetAnimationCurveImpl(target_value, timing_function);
124 }
125 #endif
126 
127 WebTransformAnimationCurve*
createTransformAnimationCurve()128 WebCompositorSupportImpl::createTransformAnimationCurve() {
129   return new WebTransformAnimationCurveImpl();
130 }
131 
createTransformOperations()132 WebTransformOperations* WebCompositorSupportImpl::createTransformOperations() {
133   return new WebTransformOperationsImpl();
134 }
135 
createFilterOperations()136 WebFilterOperations* WebCompositorSupportImpl::createFilterOperations() {
137   return new WebFilterOperationsImpl();
138 }
139 
140 }  // namespace content
141 
142