2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
27 #ifndef DrawingAreaProxy_h
28 #define DrawingAreaProxy_h
30 #include "BackingStore.h"
31 #include "DrawingAreaInfo.h"
32 #include <WebCore/FloatPoint.h>
33 #include <WebCore/IntRect.h>
34 #include <WebCore/IntSize.h>
36 #include <wtf/Noncopyable.h>
42 #elif PLATFORM(GTK) || PLATFORM(EFL) // SLP_specific TODO: need to contribute
43 typedef struct _cairo cairo_t;
47 class ArgumentDecoder;
53 class TransformationMatrix;
58 class LayerTreeContext;
59 class LayerTreeCoordinatorProxy;
61 class WebLayerTreeInfo;
62 class WebLayerUpdateInfo;
65 class DrawingAreaProxy {
66 WTF_MAKE_NONCOPYABLE(DrawingAreaProxy);
69 virtual ~DrawingAreaProxy();
71 DrawingAreaType type() const { return m_type; }
73 void didReceiveDrawingAreaProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
75 virtual void deviceScaleFactorDidChange() = 0;
77 // FIXME: These should be pure virtual.
78 virtual void visibilityDidChange() { }
79 virtual void layerHostingModeDidChange() { }
81 virtual void setBackingStoreIsDiscardable(bool) { }
83 virtual void waitForBackingStoreUpdateOnNextPaint() { }
85 const WebCore::IntSize& size() const { return m_size; }
86 void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
88 virtual void pageCustomRepresentationChanged() { }
89 virtual void waitForPossibleGeometryUpdate() { }
91 virtual void colorSpaceDidChange() { }
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&) { }
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*);
108 WebPageProxy* page() { return m_webPageProxy; }
111 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
112 virtual void didSuspendPainting() { }
116 explicit DrawingAreaProxy(DrawingAreaType, WebPageProxy*);
118 DrawingAreaType m_type;
119 WebPageProxy* m_webPageProxy;
121 WebCore::IntSize m_size;
122 WebCore::IntSize m_scrollOffset;
124 #if USE(UI_SIDE_COMPOSITING)
125 OwnPtr<LayerTreeCoordinatorProxy> m_layerTreeCoordinatorProxy;
129 virtual void sizeDidChange() = 0;
131 // CoreIPC message handlers.
132 // FIXME: These should be pure virtual.
133 virtual void update(uint64_t backingStoreStateID, const UpdateInfo&) { }
134 virtual void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&) { }
135 #if USE(ACCELERATED_COMPOSITING)
136 virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) { }
137 virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) { }
138 virtual void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) { }
141 virtual void didUpdateGeometry() { }
145 } // namespace WebKit
147 #endif // DrawingAreaProxy_h