Roll src/third_party/skia 199ba8e:bb928a0
[chromium-blink-merge.git] / cc / blink / web_layer_impl.h
blobbced59805c27fadd62d73f0b97cde5627ce8428f
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.
5 #ifndef CC_BLINK_WEB_LAYER_IMPL_H_
6 #define CC_BLINK_WEB_LAYER_IMPL_H_
8 #include <string>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "cc/blink/cc_blink_export.h"
13 #include "cc/layers/layer_client.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/WebDoublePoint.h"
18 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
19 #include "third_party/WebKit/public/platform/WebLayer.h"
20 #include "third_party/WebKit/public/platform/WebPoint.h"
21 #include "third_party/WebKit/public/platform/WebRect.h"
22 #include "third_party/WebKit/public/platform/WebSize.h"
23 #include "third_party/WebKit/public/platform/WebString.h"
24 #include "third_party/WebKit/public/platform/WebVector.h"
25 #include "third_party/skia/include/utils/SkMatrix44.h"
27 namespace blink {
28 class WebFilterOperations;
29 class WebLayerClient;
30 struct WebFloatRect;
33 namespace base {
34 namespace debug {
35 class ConvertableToTraceFormat;
39 namespace cc {
40 class Layer;
43 namespace cc_blink {
45 class WebToCCAnimationDelegateAdapter;
47 class WebLayerImpl : public blink::WebLayer, public cc::LayerClient {
48 public:
49 CC_BLINK_EXPORT WebLayerImpl();
50 CC_BLINK_EXPORT explicit WebLayerImpl(scoped_refptr<cc::Layer>);
51 virtual ~WebLayerImpl();
53 static bool UsingPictureLayer();
54 CC_BLINK_EXPORT static void SetImplSidePaintingEnabled(bool enabled);
56 CC_BLINK_EXPORT cc::Layer* layer() const;
58 // WebLayer implementation.
59 virtual int id() const;
60 virtual void invalidateRect(const blink::WebRect&);
61 virtual void invalidate();
62 virtual void addChild(blink::WebLayer* child);
63 virtual void insertChild(blink::WebLayer* child, size_t index);
64 virtual void replaceChild(blink::WebLayer* reference,
65 blink::WebLayer* new_layer);
66 virtual void removeFromParent();
67 virtual void removeAllChildren();
68 virtual void setBounds(const blink::WebSize& bounds);
69 virtual blink::WebSize bounds() const;
70 virtual void setMasksToBounds(bool masks_to_bounds);
71 virtual bool masksToBounds() const;
72 virtual void setMaskLayer(blink::WebLayer* mask);
73 virtual void setReplicaLayer(blink::WebLayer* replica);
74 virtual void setOpacity(float opacity);
75 virtual float opacity() const;
76 virtual void setBlendMode(blink::WebBlendMode blend_mode);
77 virtual blink::WebBlendMode blendMode() const;
78 virtual void setIsRootForIsolatedGroup(bool root);
79 virtual bool isRootForIsolatedGroup();
80 virtual void setOpaque(bool opaque);
81 virtual bool opaque() const;
82 virtual void setPosition(const blink::WebFloatPoint& position);
83 virtual blink::WebFloatPoint position() const;
84 virtual void setTransform(const SkMatrix44& transform);
85 virtual void setTransformOrigin(const blink::WebFloatPoint3D& point);
86 virtual blink::WebFloatPoint3D transformOrigin() const;
87 virtual SkMatrix44 transform() const;
88 virtual void setDrawsContent(bool draws_content);
89 virtual bool drawsContent() const;
90 virtual void setShouldFlattenTransform(bool flatten);
91 virtual void setRenderingContext(int context);
92 virtual void setUseParentBackfaceVisibility(bool visible);
93 virtual void setBackgroundColor(blink::WebColor color);
94 virtual blink::WebColor backgroundColor() const;
95 virtual void setFilters(const blink::WebFilterOperations& filters);
96 virtual void setBackgroundFilters(const blink::WebFilterOperations& filters);
97 virtual void setAnimationDelegate(
98 blink::WebCompositorAnimationDelegate* delegate);
99 virtual bool addAnimation(blink::WebCompositorAnimation* animation);
100 virtual void removeAnimation(int animation_id);
101 virtual void removeAnimation(int animation_id,
102 blink::WebCompositorAnimation::TargetProperty);
103 virtual void pauseAnimation(int animation_id, double time_offset);
104 virtual bool hasActiveAnimation();
105 virtual void setForceRenderSurface(bool force);
106 virtual void setScrollPositionDouble(blink::WebDoublePoint position);
107 virtual blink::WebDoublePoint scrollPositionDouble() const;
108 virtual void setScrollClipLayer(blink::WebLayer* clip_layer);
109 virtual bool scrollable() const;
110 virtual void setUserScrollable(bool horizontal, bool vertical);
111 virtual bool userScrollableHorizontal() const;
112 virtual bool userScrollableVertical() const;
113 virtual void setHaveWheelEventHandlers(bool have_wheel_event_handlers);
114 virtual bool haveWheelEventHandlers() const;
115 virtual void setHaveScrollEventHandlers(bool have_scroll_event_handlers);
116 virtual bool haveScrollEventHandlers() const;
117 virtual void setShouldScrollOnMainThread(bool scroll_on_main);
118 virtual bool shouldScrollOnMainThread() const;
119 virtual void setNonFastScrollableRegion(
120 const blink::WebVector<blink::WebRect>& region);
121 virtual blink::WebVector<blink::WebRect> nonFastScrollableRegion() const;
122 virtual void setTouchEventHandlerRegion(
123 const blink::WebVector<blink::WebRect>& region);
124 virtual blink::WebVector<blink::WebRect> touchEventHandlerRegion() const;
125 virtual void setIsContainerForFixedPositionLayers(bool is_container);
126 virtual bool isContainerForFixedPositionLayers() const;
127 virtual void setPositionConstraint(
128 const blink::WebLayerPositionConstraint& constraint);
129 virtual blink::WebLayerPositionConstraint positionConstraint() const;
130 virtual void setScrollClient(blink::WebLayerScrollClient* client);
131 virtual bool isOrphan() const;
132 virtual void setWebLayerClient(blink::WebLayerClient* client);
134 // LayerClient implementation.
135 scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo() override;
137 virtual void setScrollParent(blink::WebLayer* parent);
138 virtual void setClipParent(blink::WebLayer* parent);
140 protected:
141 scoped_refptr<cc::Layer> layer_;
142 blink::WebLayerClient* web_layer_client_;
144 private:
145 scoped_ptr<WebToCCAnimationDelegateAdapter> animation_delegate_adapter_;
147 DISALLOW_COPY_AND_ASSIGN(WebLayerImpl);
150 } // namespace cc_blink
152 #endif // CC_BLINK_WEB_LAYER_IMPL_H_