2 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
29 #include "DrawingAreaInfo.h"
30 #include <WebCore/FloatPoint.h>
31 #include <WebCore/IntRect.h>
32 #include <wtf/Forward.h>
33 #include <wtf/Noncopyable.h>
34 #include <wtf/PassOwnPtr.h>
36 #if ENABLE(TIZEN_RECORDING_SURFACE_PAINT_THREAD)
37 #include <wtf/Threading.h>
41 class ArgumentDecoder;
46 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
47 #include "PlatformContextCairo.h"
53 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
54 class GraphicsContext;
55 class PlatformContextCairo;
61 struct ColorSpaceData;
64 struct WebPageCreationParameters;
67 struct WindowGeometry;
70 #if ENABLE(TIZEN_RECORDING_SURFACE_PAINT_THREAD)
71 class DrawingArea : public ThreadSafeRefCounted<DrawingArea> {
75 WTF_MAKE_NONCOPYABLE(DrawingArea);
78 static PassOwnPtr<DrawingArea> create(WebPage*, const WebPageCreationParameters&);
79 virtual ~DrawingArea();
81 void didReceiveDrawingAreaMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
83 virtual void setNeedsDisplay(const WebCore::IntRect&) = 0;
84 virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
86 // FIXME: These should be pure virtual.
87 virtual void pageBackgroundTransparencyChanged() { }
88 virtual void forceRepaint() { }
89 virtual bool forceRepaintAsync(uint64_t callbackID) { return false; }
90 virtual void setLayerTreeStateIsFrozen(bool) { }
91 virtual bool layerTreeStateIsFrozen() const { return false; }
92 virtual LayerTreeHost* layerTreeHost() const { return 0; }
94 virtual void didInstallPageOverlay() { }
95 virtual void didUninstallPageOverlay() { }
96 virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) { }
97 virtual void setPageOverlayOpacity(float) { }
98 // If this function returns false, PageOverlay should apply opacity when painting.
99 virtual bool pageOverlayShouldApplyFadeWhenPainting() const { return true; }
100 virtual void pageCustomRepresentationChanged() { }
102 virtual void setPaintingEnabled(bool) { }
103 virtual void updatePreferences() { }
105 #if USE(ACCELERATED_COMPOSITING)
106 virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
107 virtual void scheduleCompositingLayerSync() = 0;
109 #if ENABLE(TIZEN_ONESHOT_DRAWING_SYNCHRONIZATION)
110 virtual void setNeedsOneShotDrawingSynchronization() = 0;
113 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
114 virtual void addOrUpdateScrollingLayer(WebCore::GraphicsLayer* scrollingLayer, WebCore::GraphicsLayer* contentsLayer, const WebCore::IntSize& scrollSize) = 0;
115 virtual void removeScrollingLayer(WebCore::GraphicsLayer* scrollingLayer, WebCore::GraphicsLayer* contentsLayer) = 0;
119 #if USE(UI_SIDE_COMPOSITING)
120 virtual void didReceiveLayerTreeCoordinatorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0;
124 virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&) = 0;
127 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
128 virtual void recordingSurfaceSetLoadStartSet() { }
129 virtual void recordingSurfaceSetLoadFinishedSet(bool isFinishLoad) { }
132 #if ENABLE(TIZEN_LAYER_FLUSH_THROTTLING)
133 virtual void didStartProgress() {}
134 virtual void didFinishProgress() {}
137 virtual void dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>&);
140 DrawingArea(DrawingAreaType, WebPage*);
142 DrawingAreaType m_type;
146 // CoreIPC message handlers.
147 // FIXME: These should be pure virtual.
148 virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { }
149 virtual void didUpdate() { }
150 virtual void suspendPainting() { }
151 virtual void resumePainting() { }
152 virtual void setLayerHostingMode(uint32_t) { }
155 // Used by TiledCoreAnimationDrawingArea.
156 virtual void updateGeometry(const WebCore::IntSize& viewSize) { }
157 virtual void setDeviceScaleFactor(float) { }
158 virtual void setColorSpace(const ColorSpaceData&) { }
161 #if USE(TILED_BACKING_STORE)
162 virtual void setSize(const WebCore::IntSize& viewSize) { }
163 virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float) { }
164 virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&) { }
165 virtual void setContentsScale(float scale) { }
166 virtual void renderNextFrame() { }
167 virtual void takeSnapshot(const WebCore::IntSize& targetSize, const WebCore::IntRect& contentsRect) { }
168 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
169 virtual void freePlatformSurface(int platformSurfaceId) { }
174 } // namespace WebKit
176 #endif // DrawingArea_h