OLD | NEW |
| (Empty) |
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 #ifndef CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_H_ | |
6 #define CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "cc/layers/layer_client.h" | |
13 #include "content/common/content_export.h" | |
14 #include "third_party/WebKit/public/platform/WebCString.h" | |
15 #include "third_party/WebKit/public/platform/WebColor.h" | |
16 #include "third_party/WebKit/public/platform/WebCompositorAnimation.h" | |
17 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | |
18 #include "third_party/WebKit/public/platform/WebLayer.h" | |
19 #include "third_party/WebKit/public/platform/WebPoint.h" | |
20 #include "third_party/WebKit/public/platform/WebRect.h" | |
21 #include "third_party/WebKit/public/platform/WebSize.h" | |
22 #include "third_party/WebKit/public/platform/WebString.h" | |
23 #include "third_party/WebKit/public/platform/WebVector.h" | |
24 #include "third_party/skia/include/utils/SkMatrix44.h" | |
25 | |
26 namespace cc { | |
27 class Layer; | |
28 } | |
29 | |
30 namespace blink { | |
31 class WebFilterOperations; | |
32 class WebLayerClient; | |
33 struct WebFloatRect; | |
34 } | |
35 | |
36 namespace base { | |
37 namespace debug { | |
38 class ConvertableToTraceFormat; | |
39 } | |
40 } | |
41 | |
42 namespace content { | |
43 | |
44 class WebToCCAnimationDelegateAdapter; | |
45 | |
46 class WebLayerImpl : public blink::WebLayer, public cc::LayerClient { | |
47 public: | |
48 CONTENT_EXPORT WebLayerImpl(); | |
49 CONTENT_EXPORT explicit WebLayerImpl( | |
50 scoped_refptr<cc::Layer>); | |
51 virtual ~WebLayerImpl(); | |
52 | |
53 static bool UsingPictureLayer(); | |
54 CONTENT_EXPORT static void SetImplSidePaintingEnabled( | |
55 bool enabled); | |
56 | |
57 CONTENT_EXPORT cc::Layer* layer() const; | |
58 | |
59 // WebLayer implementation. | |
60 virtual int id() const; | |
61 virtual void invalidateRect(const blink::WebFloatRect&); | |
62 virtual void invalidate(); | |
63 virtual void addChild(blink::WebLayer* child); | |
64 virtual void insertChild(blink::WebLayer* child, size_t index); | |
65 virtual void replaceChild(blink::WebLayer* reference, | |
66 blink::WebLayer* new_layer); | |
67 virtual void removeFromParent(); | |
68 virtual void removeAllChildren(); | |
69 virtual void setBounds(const blink::WebSize& bounds); | |
70 virtual blink::WebSize bounds() const; | |
71 virtual void setMasksToBounds(bool masks_to_bounds); | |
72 virtual bool masksToBounds() const; | |
73 virtual void setMaskLayer(blink::WebLayer* mask); | |
74 virtual void setReplicaLayer(blink::WebLayer* replica); | |
75 virtual void setOpacity(float opacity); | |
76 virtual float opacity() const; | |
77 virtual void setBlendMode(blink::WebBlendMode blend_mode); | |
78 virtual blink::WebBlendMode blendMode() const; | |
79 virtual void setIsRootForIsolatedGroup(bool root); | |
80 virtual bool isRootForIsolatedGroup(); | |
81 virtual void setOpaque(bool opaque); | |
82 virtual bool opaque() const; | |
83 virtual void setPosition(const blink::WebFloatPoint& position); | |
84 virtual blink::WebFloatPoint position() const; | |
85 virtual void setTransform(const SkMatrix44& transform); | |
86 virtual void setTransformOrigin(const blink::WebFloatPoint3D& point); | |
87 virtual blink::WebFloatPoint3D transformOrigin() const; | |
88 | |
89 // FIXME: get rid of these once Blink is no longer using them. | |
90 virtual void setAnchorPoint(const blink::WebFloatPoint&); | |
91 virtual blink::WebFloatPoint anchorPoint() const; | |
92 virtual void setAnchorPointZ(float); | |
93 virtual float anchorPointZ() const; | |
94 | |
95 virtual SkMatrix44 transform() const; | |
96 virtual void setDrawsContent(bool draws_content); | |
97 virtual bool drawsContent() const; | |
98 virtual void setShouldFlattenTransform(bool flatten); | |
99 virtual void setRenderingContext(int context); | |
100 virtual void setUseParentBackfaceVisibility(bool visible); | |
101 virtual void setBackgroundColor(blink::WebColor color); | |
102 virtual blink::WebColor backgroundColor() const; | |
103 virtual void setFilters(const blink::WebFilterOperations& filters); | |
104 virtual void setBackgroundFilters(const blink::WebFilterOperations& filters); | |
105 virtual void setAnimationDelegate( | |
106 blink::WebCompositorAnimationDelegate* delegate); | |
107 virtual bool addAnimation(blink::WebCompositorAnimation* animation); | |
108 virtual void removeAnimation(int animation_id); | |
109 virtual void removeAnimation(int animation_id, | |
110 blink::WebCompositorAnimation::TargetProperty); | |
111 virtual void pauseAnimation(int animation_id, double time_offset); | |
112 virtual bool hasActiveAnimation(); | |
113 virtual void setForceRenderSurface(bool force); | |
114 virtual void setScrollPosition(blink::WebPoint position); | |
115 virtual blink::WebPoint scrollPosition() const; | |
116 virtual void setScrollClipLayer(blink::WebLayer* clip_layer); | |
117 virtual bool scrollable() const; | |
118 virtual void setUserScrollable(bool horizontal, bool vertical); | |
119 virtual bool userScrollableHorizontal() const; | |
120 virtual bool userScrollableVertical() const; | |
121 virtual void setHaveWheelEventHandlers(bool have_wheel_event_handlers); | |
122 virtual bool haveWheelEventHandlers() const; | |
123 virtual void setHaveScrollEventHandlers(bool have_scroll_event_handlers); | |
124 virtual bool haveScrollEventHandlers() const; | |
125 virtual void setShouldScrollOnMainThread(bool scroll_on_main); | |
126 virtual bool shouldScrollOnMainThread() const; | |
127 virtual void setNonFastScrollableRegion( | |
128 const blink::WebVector<blink::WebRect>& region); | |
129 virtual blink::WebVector<blink::WebRect> nonFastScrollableRegion() const; | |
130 virtual void setTouchEventHandlerRegion( | |
131 const blink::WebVector<blink::WebRect>& region); | |
132 virtual blink::WebVector<blink::WebRect> touchEventHandlerRegion() const; | |
133 virtual void setIsContainerForFixedPositionLayers(bool is_container); | |
134 virtual bool isContainerForFixedPositionLayers() const; | |
135 virtual void setPositionConstraint( | |
136 const blink::WebLayerPositionConstraint& constraint); | |
137 virtual blink::WebLayerPositionConstraint positionConstraint() const; | |
138 virtual void setScrollClient(blink::WebLayerScrollClient* client); | |
139 virtual bool isOrphan() const; | |
140 virtual void setWebLayerClient(blink::WebLayerClient* client); | |
141 | |
142 // LayerClient implementation. | |
143 virtual scoped_refptr<base::debug::ConvertableToTraceFormat> | |
144 TakeDebugInfo() OVERRIDE; | |
145 | |
146 virtual void setScrollParent(blink::WebLayer* parent); | |
147 virtual void setClipParent(blink::WebLayer* parent); | |
148 | |
149 protected: | |
150 scoped_refptr<cc::Layer> layer_; | |
151 blink::WebLayerClient* web_layer_client_; | |
152 | |
153 private: | |
154 scoped_ptr<WebToCCAnimationDelegateAdapter> animation_delegate_adapter_; | |
155 | |
156 DISALLOW_COPY_AND_ASSIGN(WebLayerImpl); | |
157 }; | |
158 | |
159 } // namespace content | |
160 | |
161 #endif // CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_H_ | |
162 | |
OLD | NEW |