Automated Commit: Committing new LKGM version 7252.0.0 for chromeos.
[chromium-blink-merge.git] / cc / blink / web_layer_impl.h
blobeb049b8e711610359396d6a3272a69178d076288
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>
9 #include <utility>
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "cc/blink/cc_blink_export.h"
14 #include "cc/layers/layer_client.h"
15 #include "third_party/WebKit/public/platform/WebCString.h"
16 #include "third_party/WebKit/public/platform/WebColor.h"
17 #include "third_party/WebKit/public/platform/WebCompositorAnimation.h"
18 #include "third_party/WebKit/public/platform/WebDoublePoint.h"
19 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
20 #include "third_party/WebKit/public/platform/WebLayer.h"
21 #include "third_party/WebKit/public/platform/WebPoint.h"
22 #include "third_party/WebKit/public/platform/WebRect.h"
23 #include "third_party/WebKit/public/platform/WebSize.h"
24 #include "third_party/WebKit/public/platform/WebString.h"
25 #include "third_party/WebKit/public/platform/WebVector.h"
26 #include "third_party/skia/include/utils/SkMatrix44.h"
28 namespace blink {
29 class WebFilterOperations;
30 class WebLayerClient;
31 struct WebFloatRect;
34 namespace base {
35 namespace trace_event {
36 class ConvertableToTraceFormat;
40 namespace cc {
41 class Layer;
42 class LayerSettings;
45 namespace cc_blink {
47 class WebToCCAnimationDelegateAdapter;
49 class WebLayerImpl : public blink::WebLayer, public cc::LayerClient {
50 public:
51 CC_BLINK_EXPORT WebLayerImpl();
52 CC_BLINK_EXPORT explicit WebLayerImpl(scoped_refptr<cc::Layer>);
53 virtual ~WebLayerImpl();
55 CC_BLINK_EXPORT static void SetLayerSettings(
56 const cc::LayerSettings& settings);
57 CC_BLINK_EXPORT static const cc::LayerSettings& LayerSettings();
59 CC_BLINK_EXPORT cc::Layer* layer() const;
61 // WebLayer implementation.
62 virtual int id() const;
63 virtual void invalidateRect(const blink::WebRect&);
64 virtual void invalidate();
65 virtual void addChild(blink::WebLayer* child);
66 virtual void insertChild(blink::WebLayer* child, size_t index);
67 virtual void replaceChild(blink::WebLayer* reference,
68 blink::WebLayer* new_layer);
69 virtual void removeFromParent();
70 virtual void removeAllChildren();
71 virtual void setBounds(const blink::WebSize& bounds);
72 virtual blink::WebSize bounds() const;
73 virtual void setMasksToBounds(bool masks_to_bounds);
74 virtual bool masksToBounds() const;
75 virtual void setMaskLayer(blink::WebLayer* mask);
76 virtual void setReplicaLayer(blink::WebLayer* replica);
77 virtual void setOpacity(float opacity);
78 virtual float opacity() const;
79 virtual void setBlendMode(blink::WebBlendMode blend_mode);
80 virtual blink::WebBlendMode blendMode() const;
81 virtual void setIsRootForIsolatedGroup(bool root);
82 virtual bool isRootForIsolatedGroup();
83 virtual void setOpaque(bool opaque);
84 virtual bool opaque() const;
85 virtual void setPosition(const blink::WebFloatPoint& position);
86 virtual blink::WebFloatPoint position() const;
87 virtual void setTransform(const SkMatrix44& transform);
88 virtual void setTransformOrigin(const blink::WebFloatPoint3D& point);
89 virtual blink::WebFloatPoint3D transformOrigin() const;
90 virtual SkMatrix44 transform() const;
91 virtual void setDrawsContent(bool draws_content);
92 virtual bool drawsContent() const;
93 virtual void setShouldFlattenTransform(bool flatten);
94 virtual void setRenderingContext(int context);
95 virtual void setUseParentBackfaceVisibility(bool visible);
96 virtual void setBackgroundColor(blink::WebColor color);
97 virtual blink::WebColor backgroundColor() const;
98 virtual void setFilters(const blink::WebFilterOperations& filters);
99 virtual void setBackgroundFilters(const blink::WebFilterOperations& filters);
100 virtual void setAnimationDelegate(
101 blink::WebCompositorAnimationDelegate* delegate);
102 virtual bool addAnimation(blink::WebCompositorAnimation* animation);
103 virtual void removeAnimation(int animation_id);
104 virtual void removeAnimation(int animation_id,
105 blink::WebCompositorAnimation::TargetProperty);
106 virtual void pauseAnimation(int animation_id, double time_offset);
107 virtual bool hasActiveAnimation();
108 virtual void setForceRenderSurface(bool force);
109 virtual void setScrollPositionDouble(blink::WebDoublePoint position);
110 virtual blink::WebDoublePoint scrollPositionDouble() const;
111 virtual void setScrollCompensationAdjustment(blink::WebDoublePoint position);
112 virtual void setScrollClipLayer(blink::WebLayer* clip_layer);
113 virtual bool scrollable() const;
114 virtual void setUserScrollable(bool horizontal, bool vertical);
115 virtual bool userScrollableHorizontal() const;
116 virtual bool userScrollableVertical() const;
117 virtual void setHaveWheelEventHandlers(bool have_wheel_event_handlers);
118 virtual bool haveWheelEventHandlers() const;
119 virtual void setHaveScrollEventHandlers(bool have_scroll_event_handlers);
120 virtual bool haveScrollEventHandlers() const;
121 virtual void setShouldScrollOnMainThread(bool scroll_on_main);
122 virtual bool shouldScrollOnMainThread() const;
123 virtual void setNonFastScrollableRegion(
124 const blink::WebVector<blink::WebRect>& region);
125 virtual blink::WebVector<blink::WebRect> nonFastScrollableRegion() const;
126 virtual void setTouchEventHandlerRegion(
127 const blink::WebVector<blink::WebRect>& region);
128 virtual blink::WebVector<blink::WebRect> touchEventHandlerRegion() const;
129 virtual void setScrollBlocksOn(blink::WebScrollBlocksOn);
130 virtual blink::WebScrollBlocksOn scrollBlocksOn() const;
131 virtual void setFrameTimingRequests(
132 const blink::WebVector<std::pair<int64_t, blink::WebRect>>& requests);
133 virtual blink::WebVector<std::pair<int64_t, blink::WebRect>>
134 frameTimingRequests() const;
135 virtual void setIsContainerForFixedPositionLayers(bool is_container);
136 virtual bool isContainerForFixedPositionLayers() const;
137 virtual void setPositionConstraint(
138 const blink::WebLayerPositionConstraint& constraint);
139 virtual blink::WebLayerPositionConstraint positionConstraint() const;
140 virtual void setScrollClient(blink::WebLayerScrollClient* client);
141 virtual bool isOrphan() const;
142 virtual void setWebLayerClient(blink::WebLayerClient* client);
144 // LayerClient implementation.
145 scoped_refptr<base::trace_event::ConvertableToTraceFormat> TakeDebugInfo()
146 override;
148 virtual void setScrollParent(blink::WebLayer* parent);
149 virtual void setClipParent(blink::WebLayer* parent);
151 protected:
152 scoped_refptr<cc::Layer> layer_;
153 blink::WebLayerClient* web_layer_client_;
155 private:
156 scoped_ptr<WebToCCAnimationDelegateAdapter> animation_delegate_adapter_;
158 DISALLOW_COPY_AND_ASSIGN(WebLayerImpl);
161 } // namespace cc_blink
163 #endif // CC_BLINK_WEB_LAYER_IMPL_H_