initial import
[vuplus_webkit] / Source / WebKit2 / WebProcess / WebPage / TiledDrawingArea.h
1 /*
2  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
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.
12  *
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.
24  */
25
26 #ifndef TiledDrawingArea_h
27 #define TiledDrawingArea_h
28
29 #if ENABLE(TILED_BACKING_STORE)
30
31 #include "DrawingArea.h"
32 #include "TiledBackingStoreClient.h"
33 #include "TiledBackingStoreRemoteTile.h"
34 #include <WebCore/IntRect.h>
35
36 namespace WebKit {
37
38 class TiledDrawingArea : public DrawingArea, public WebCore::TiledBackingStoreClient, public TiledBackingStoreRemoteTileClient {
39 public:
40     explicit TiledDrawingArea(WebPage*);
41     virtual ~TiledDrawingArea();
42
43     virtual void setNeedsDisplay(const WebCore::IntRect&);
44     virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta);
45
46 #if USE(ACCELERATED_COMPOSITING)
47     virtual void attachCompositingContext() { }
48     virtual void detachCompositingContext() { }
49     virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) { }
50     virtual void scheduleCompositingLayerSync() { }
51     virtual void syncCompositingLayers() { }
52 #endif
53
54 private:
55     // CoreIPC message handlers.
56     virtual void setSize(const WebCore::IntSize& viewSize);
57     virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float);
58     virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
59     virtual void renderNextFrame();
60     virtual void suspendPainting();
61     virtual void resumePainting();
62
63     // TiledBackingStoreClient
64     virtual void tiledBackingStorePaintBegin();
65     virtual void tiledBackingStorePaint(WebCore::GraphicsContext*, const WebCore::IntRect& contentRect);
66     virtual void tiledBackingStorePaintEnd(const Vector<WebCore::IntRect>& paintedArea);
67     virtual bool tiledBackingStoreUpdatesAllowed() const;
68     virtual WebCore::IntRect tiledBackingStoreContentsRect();
69     virtual WebCore::IntRect tiledBackingStoreVisibleRect();
70     virtual WebCore::Color tiledBackingStoreBackgroundColor() const;
71
72     // TiledBackingStoreRemoteTileClient
73     virtual void createTile(int tileID, const UpdateInfo&);
74     virtual void updateTile(int tileID, const UpdateInfo&);
75     virtual void removeTile(int tileID);
76
77     bool m_suspended;
78     bool m_isWaitingForUIProcess;
79     bool m_didSendTileUpdate;
80     WebCore::IntRect m_visibleContentRect;
81
82     OwnPtr<WebCore::TiledBackingStore> m_mainBackingStore;
83     OwnPtr<WebCore::TiledBackingStore> m_previousBackingStore;
84 };
85
86 } // namespace WebKit
87
88 #endif // TILED_BACKING_STORE
89
90 #endif // TiledDrawingArea_h