OSDN Git Service

Merge "Switch find on page to GL"
[android-x86/external-webkit.git] / Source / WebCore / platform / graphics / android / GraphicsLayerAndroid.h
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef GraphicsLayerAndroid_h
18 #define GraphicsLayerAndroid_h
19
20 #if USE(ACCELERATED_COMPOSITING)
21
22 #include "FloatRect.h"
23 #include "Frame.h"
24 #include "GraphicsLayer.h"
25 #include "GraphicsLayerClient.h"
26 #include "LayerAndroid.h"
27 #include "RefPtr.h"
28 #include "SkBitmapRef.h"
29 #include "Vector.h"
30
31 class FloatPoint3D;
32 class Image;
33 class SkBitmapRef;
34 class SkRegion;
35
36 namespace WebCore {
37
38 class ScrollableLayerAndroid;
39
40 class GraphicsLayerAndroid : public GraphicsLayer {
41 public:
42
43     GraphicsLayerAndroid(GraphicsLayerClient*);
44     virtual ~GraphicsLayerAndroid();
45
46     virtual void setName(const String&);
47
48     // for hosting this GraphicsLayer in a native layer hierarchy
49     virtual NativeLayer nativeLayer() const;
50
51     virtual bool setChildren(const Vector<GraphicsLayer*>&);
52     virtual void addChild(GraphicsLayer*);
53     virtual void addChildAtIndex(GraphicsLayer*, int index);
54     virtual void addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling);
55     virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling);
56     virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
57
58     virtual void removeFromParent();
59
60     virtual void setPosition(const FloatPoint&);
61     virtual void setPreserves3D(bool b);
62     virtual void setAnchorPoint(const FloatPoint3D&);
63     virtual void setSize(const FloatSize&);
64
65     virtual void setBackfaceVisibility(bool b);
66     virtual void setTransform(const TransformationMatrix&);
67
68     virtual void setChildrenTransform(const TransformationMatrix&);
69
70     virtual void setMaskLayer(GraphicsLayer*);
71     virtual void setMasksToBounds(bool);
72     virtual void setDrawsContent(bool);
73
74     virtual void setBackgroundColor(const Color&);
75     virtual void clearBackgroundColor();
76
77     virtual void setContentsOpaque(bool);
78
79     virtual void setOpacity(float);
80
81     virtual void setNeedsDisplay();
82     virtual void setNeedsDisplayInRect(const FloatRect&);
83
84     virtual bool addAnimation(const KeyframeValueList& valueList,
85                               const IntSize& boxSize,
86                               const Animation* anim,
87                               const String& keyframesName,
88                               double beginTime);
89     bool createTransformAnimationsFromKeyframes(const KeyframeValueList&,
90                                                 const Animation*,
91                                                 const String& keyframesName,
92                                                 double beginTime,
93                                                 const IntSize& boxSize);
94     bool createAnimationFromKeyframes(const KeyframeValueList&,
95                                       const Animation*,
96                                       const String& keyframesName,
97                                       double beginTime);
98
99     virtual void removeAnimationsForProperty(AnimatedPropertyID);
100     virtual void removeAnimationsForKeyframes(const String& keyframesName);
101     virtual void pauseAnimation(const String& keyframesName);
102
103     virtual void suspendAnimations(double time);
104     virtual void resumeAnimations();
105
106     virtual void setContentsToImage(Image*);
107     virtual void setContentsToMedia(PlatformLayer*);
108     virtual PlatformLayer* platformLayer() const;
109
110     void pauseDisplay(bool state);
111
112 #ifndef NDEBUG
113     virtual void setDebugBackgroundColor(const Color&);
114     virtual void setDebugBorder(const Color&, float borderWidth);
115 #endif
116
117     virtual void setZPosition(float);
118
119     virtual void syncCompositingState();
120     void notifyClientAnimationStarted();
121
122     LayerAndroid* contentLayer() { return m_contentLayer; }
123
124     static int instancesCount();
125
126 private:
127
128     void askForSync();
129     void syncPositionState();
130     void syncChildren();
131     void syncMask();
132
133     void updateFixedPosition();
134     void updateScrollingLayers();
135
136     // with SkPicture, we always repaint the entire layer's content.
137     bool repaint();
138     void needsNotifyClient();
139
140     bool paintContext(SkPicture* context, const IntRect& rect);
141
142     bool m_needsSyncChildren;
143     bool m_needsSyncMask;
144     bool m_needsRepaint;
145     bool m_needsNotifyClient;
146
147     bool m_haveContents;
148     bool m_haveImage;
149     bool m_newImage;
150
151     SkRegion m_dirtyRegion;
152
153     LayerAndroid* m_contentLayer;
154     ScrollableLayerAndroid* m_foregroundLayer;
155     LayerAndroid* m_foregroundClipLayer;
156 };
157
158 } // namespace WebCore
159
160
161 #endif // USE(ACCELERATED_COMPOSITING)
162
163 #endif // GraphicsLayerAndroid_h