Merge "[CherryPick] [EFL][Qt][WK2] Fixed position elements are not always fixed"...
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / LayerTreeCoordinatorProxy.h
1 /*
2     Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
3
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Library General Public
6     License as published by the Free Software Foundation; either
7     version 2 of the License, or (at your option) any later version.
8
9     This library is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12     Library General Public License for more details.
13
14     You should have received a copy of the GNU Library General Public License
15     along with this library; see the file COPYING.LIB.  If not, write to
16     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17     Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef LayerTreeCoordinatorProxy_h
21 #define LayerTreeCoordinatorProxy_h
22
23 #if USE(UI_SIDE_COMPOSITING)
24
25 #include "BackingStore.h"
26 #include "CoordinatedGraphicsArgumentCoders.h"
27 #include "DrawingAreaProxy.h"
28 #include "Region.h"
29 #include "SurfaceUpdateInfo.h"
30 #include "WebLayerTreeInfo.h"
31 #include <WebCore/GraphicsContext.h>
32 #include <WebCore/GraphicsLayer.h>
33 #include <WebCore/GraphicsLayerAnimation.h>
34 #include <WebCore/IntRect.h>
35 #include <WebCore/IntSize.h>
36 #include <WebCore/RunLoop.h>
37 #include <WebCore/Timer.h>
38 #include <wtf/Functional.h>
39 #include <wtf/HashSet.h>
40
41 #if PLATFORM(QT)
42 QT_BEGIN_NAMESPACE
43 class QSGNode;
44 QT_END_NAMESPACE
45 #endif
46
47 namespace WebKit {
48
49 class WebLayerInfo;
50 class WebLayerTreeRenderer;
51 class WebLayerUpdateInfo;
52
53 class LayerTreeCoordinatorProxy {
54 public:
55     LayerTreeCoordinatorProxy(DrawingAreaProxy*);
56 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
57     LayerTreeCoordinatorProxy(DrawingAreaProxy*, bool isGLMode);
58 #endif
59     virtual ~LayerTreeCoordinatorProxy();
60     void setCompositingLayerState(WebLayerID, const WebLayerInfo&);
61     void setCompositingLayerChildren(WebLayerID, const Vector<WebLayerID>&);
62 #if ENABLE(CSS_FILTERS)
63     void setCompositingLayerFilters(WebLayerID, const WebCore::FilterOperations&);
64 #endif
65     void deleteCompositingLayer(WebLayerID);
66     void setRootCompositingLayer(WebLayerID);
67     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
68     void purgeGLResources();
69     void setContentsSize(const WebCore::FloatSize&);
70     void setVisibleContentsRect(const WebCore::IntRect&, float scale, const WebCore::FloatPoint& trajectory, const WebCore::FloatPoint& accurateVisibleContentsPosition);
71     void didRenderFrame();
72     void createTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
73     void updateTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
74     void removeTileForLayer(int layerID, int tileID);
75     void createDirectlyCompositedImage(int64_t, const WebKit::ShareableBitmap::Handle&);
76     void destroyDirectlyCompositedImage(int64_t);
77     void didReceiveLayerTreeCoordinatorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
78     void updateViewport();
79     void renderNextFrame();
80     void didChangeScrollPosition(const WebCore::IntPoint& position);
81 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
82     void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer, int flags);
83 #else
84     void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer);
85 #endif
86     void purgeBackingStores();
87     WebLayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); }
88     void setLayerAnimations(WebLayerID, const WebCore::GraphicsLayerAnimations&);
89     void setAnimationsLocked(bool);
90 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
91     void clearBackingStores();
92 #endif
93
94 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
95     bool hasOverflowLayer() const;
96     virtual void platformLayerChanged(WebCore::GraphicsLayer*, WebCore::PlatformLayer* oldPlatformLayer, WebCore::PlatformLayer* newPlatformLayer) { ASSERT_NOT_REACHED(); }
97 #endif
98 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
99     bool setOffsetForFocusedScrollingContentsLayer(const WebCore::FloatPoint&);
100     void setVisibleContentsRectForScrollingContentsLayers(const WebCore::IntRect&);
101 #endif
102
103 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
104     void initializeAcceleratedCompositingMode(bool isGLMode);
105 #endif
106
107 protected:
108     void dispatchUpdate(const Function<void()>&);
109
110     DrawingAreaProxy* m_drawingAreaProxy;
111     RefPtr<WebLayerTreeRenderer> m_renderer;
112 #if USE(GRAPHICS_SURFACE)
113     HashMap<uint32_t, RefPtr<ShareableSurface> > m_surfaces;
114 #endif
115 };
116
117 }
118
119 #endif
120
121 #endif // LayerTreeCoordinatorProxy_h