Merge "Use EwkView's variables instead of drawingScaleFactor and drawingScrollPositio...
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / DrawingAreaProxy.h
1 /*
2  * Copyright (C) 2010 Apple Inc. All rights reserved.
3  * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24  * THE POSSIBILITY OF SUCH DAMAGE.
25  */
26
27 #ifndef DrawingAreaProxy_h
28 #define DrawingAreaProxy_h
29
30 #include "BackingStore.h"
31 #include "DrawingAreaInfo.h"
32 #include <WebCore/FloatPoint.h>
33 #include <WebCore/IntRect.h>
34 #include <WebCore/IntSize.h>
35 #include <stdint.h>
36 #include <wtf/Noncopyable.h>
37
38 #if PLATFORM(QT)
39 QT_BEGIN_NAMESPACE
40 class QPainter;
41 QT_END_NAMESPACE
42 #elif PLATFORM(GTK) || PLATFORM(EFL) // SLP_specific TODO: need to contribute
43 typedef struct _cairo cairo_t;
44 #endif
45
46 namespace CoreIPC {
47     class ArgumentDecoder;
48     class Connection;
49     class MessageID;
50 }
51
52 namespace WebCore {
53     class TransformationMatrix;
54 }
55
56 namespace WebKit {
57
58 class LayerTreeContext;
59 class LayerTreeCoordinatorProxy;
60 class UpdateInfo;
61 class WebLayerTreeInfo;
62 class WebLayerUpdateInfo;
63 class WebPageProxy;
64
65 class DrawingAreaProxy {
66     WTF_MAKE_NONCOPYABLE(DrawingAreaProxy);
67
68 public:
69     virtual ~DrawingAreaProxy();
70
71     DrawingAreaType type() const { return m_type; }
72
73     void didReceiveDrawingAreaProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
74
75     virtual void deviceScaleFactorDidChange() = 0;
76
77     // FIXME: These should be pure virtual.
78     virtual void visibilityDidChange() { }
79     virtual void layerHostingModeDidChange() { }
80
81     virtual void setBackingStoreIsDiscardable(bool) { }
82
83     virtual void waitForBackingStoreUpdateOnNextPaint() { }
84
85     const WebCore::IntSize& size() const { return m_size; }
86     void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
87
88     virtual void pageCustomRepresentationChanged() { }
89     virtual void waitForPossibleGeometryUpdate() { }
90
91     virtual void colorSpaceDidChange() { }
92
93 #if USE(UI_SIDE_COMPOSITING)
94     virtual void updateViewport();
95     virtual WebCore::IntRect viewportVisibleRect() const { return contentsRect(); }
96     virtual WebCore::IntRect contentsRect() const;
97     virtual bool isBackingStoreReady() const { return true; }
98     LayerTreeCoordinatorProxy* layerTreeCoordinatorProxy() const { return m_layerTreeCoordinatorProxy.get(); }
99     virtual void setVisibleContentsRect(const WebCore::IntRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectoryVector, const WebCore::FloatPoint& accurateVisibleContentsPosition = WebCore::FloatPoint()) { }
100 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
101     virtual void setVisibleContentsRectForScrollingContentsLayers(const WebCore::IntRect&) { }
102 #endif
103     virtual void createTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo&) { }
104     virtual void updateTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo&) { }
105     virtual void removeTileForLayer(int layerID, int tileID) { }
106     virtual void didReceiveLayerTreeCoordinatorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
107
108     WebPageProxy* page() { return m_webPageProxy; }
109 #endif
110
111 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
112 #if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
113     virtual void setAngle(int) { }
114 #endif
115     virtual void didSuspendPainting() { }
116 #endif
117
118 protected:
119     explicit DrawingAreaProxy(DrawingAreaType, WebPageProxy*);
120
121     DrawingAreaType m_type;
122     WebPageProxy* m_webPageProxy;
123
124     WebCore::IntSize m_size;
125     WebCore::IntSize m_scrollOffset;
126
127 #if USE(UI_SIDE_COMPOSITING)
128     OwnPtr<LayerTreeCoordinatorProxy> m_layerTreeCoordinatorProxy;
129 #endif
130
131 private:
132     virtual void sizeDidChange() = 0;
133
134     // CoreIPC message handlers.
135     // FIXME: These should be pure virtual.
136     virtual void update(uint64_t backingStoreStateID, const UpdateInfo&) { }
137     virtual void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&) { }
138 #if USE(ACCELERATED_COMPOSITING)
139     virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) { }
140     virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) { }
141     virtual void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) { }
142 #endif
143 #if PLATFORM(MAC)
144     virtual void didUpdateGeometry() { }
145 #endif
146 };
147
148 } // namespace WebKit
149
150 #endif // DrawingAreaProxy_h