Home | History | Annotate | Download | only in UIProcess
      1 /*
      2  * Copyright (C) 2010 Apple Inc. All rights reserved.
      3  * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
      4  * Copyright (C) 2011 Igalia S.L
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     17  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     19  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     25  * THE POSSIBILITY OF SUCH DAMAGE.
     26  */
     27 
     28 #ifndef ChunkedUpdateDrawingAreaProxy_h
     29 #define ChunkedUpdateDrawingAreaProxy_h
     30 
     31 #include "DrawingAreaProxy.h"
     32 #include <WebCore/IntSize.h>
     33 #include <wtf/PassOwnPtr.h>
     34 #include <wtf/OwnPtr.h>
     35 
     36 #if PLATFORM(MAC)
     37 #include <wtf/RetainPtr.h>
     38 OBJC_CLASS WKView;
     39 #elif PLATFORM(QT)
     40 #include <QImage>
     41 class QGraphicsWKView;
     42 #elif PLATFORM(GTK)
     43 typedef struct _cairo_surface cairo_surface_t;
     44 #endif
     45 
     46 namespace WebKit {
     47 
     48 class UpdateChunk;
     49 class WebPageProxy;
     50 
     51 #if PLATFORM(MAC)
     52 typedef WKView PlatformWebView;
     53 #elif PLATFORM(WIN)
     54 class WebView;
     55 typedef WebView PlatformWebView;
     56 #elif PLATFORM(QT)
     57 typedef QGraphicsWKView PlatformWebView;
     58 #elif PLATFORM(GTK)
     59 class WebView;
     60 typedef WebView PlatformWebView;
     61 #endif
     62 
     63 class ChunkedUpdateDrawingAreaProxy : public DrawingAreaProxy {
     64 public:
     65     static PassOwnPtr<ChunkedUpdateDrawingAreaProxy> create(PlatformWebView*, WebPageProxy*);
     66 
     67     virtual ~ChunkedUpdateDrawingAreaProxy();
     68 
     69 private:
     70     ChunkedUpdateDrawingAreaProxy(PlatformWebView*, WebPageProxy*);
     71 
     72     WebPageProxy* page();
     73 
     74     // DrawingAreaProxy
     75     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     76     virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext);
     77     virtual void sizeDidChange();
     78     virtual void setPageIsVisible(bool isVisible);
     79 
     80     void ensureBackingStore();
     81     void invalidateBackingStore();
     82     bool platformPaint(const WebCore::IntRect&, PlatformDrawingContext);
     83     void drawUpdateChunkIntoBackingStore(UpdateChunk*);
     84     void didSetSize(UpdateChunk*);
     85     void deprecatedUpdate(UpdateChunk*);
     86 
     87     void sendSetSize();
     88 
     89     bool m_isWaitingForDidSetFrameNotification;
     90     bool m_isVisible;
     91     bool m_forceRepaintWhenResumingPainting;
     92 
     93 #if PLATFORM(MAC)
     94     // BackingStore
     95     RetainPtr<CGContextRef> m_bitmapContext;
     96 #elif PLATFORM(WIN)
     97     // BackingStore
     98     OwnPtr<HDC> m_backingStoreDC;
     99     OwnPtr<HBITMAP> m_backingStoreBitmap;
    100 #elif PLATFORM(QT)
    101     QImage m_backingStoreImage;
    102 #elif PLATFORM(GTK)
    103     cairo_surface_t* m_backingStoreImage;
    104 #endif
    105 
    106     PlatformWebView* m_webView;
    107 };
    108 
    109 } // namespace WebKit
    110 
    111 #endif // ChunkedUpdateDrawingAreaProxy_h
    112