WebPageCompositor_p.h [plain text]
#ifndef WebPageCompositor_p_h
#define WebPageCompositor_p_h
#if USE(ACCELERATED_COMPOSITING)
#include "LayerCompositingThread.h"
#include "LayerRenderer.h"
#include "LayerRendererClient.h"
#include "WebPageCompositor.h"
#include <BlackBerryPlatformAnimationFrameRateController.h>
#include <BlackBerryPlatformGLES2Context.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class LayerWebKitThread;
};
namespace BlackBerry {
namespace WebKit {
class WebPageCompositorClient;
class WebPagePrivate;
class WebPageCompositorPrivate
: public RefCounted<WebPageCompositorPrivate>
, public WebCore::LayerRendererClient
, public Platform::AnimationFrameRateClient {
public:
static PassRefPtr<WebPageCompositorPrivate> create(WebPagePrivate* page, WebPageCompositorClient* client)
{
return adoptRef(new WebPageCompositorPrivate(page, client));
}
~WebPageCompositorPrivate();
void setChildWindowPlacement(WebPageCompositor::ChildWindowPlacement placement) { m_childWindowPlacement = placement; }
void prepareFrame(double animationTime);
void render(const WebCore::IntRect& targetRect, const WebCore::IntRect& clipRect, const WebCore::TransformationMatrix&, const WebCore::FloatRect& documentSrcRect);
Platform::Graphics::GLES2Context* context() const { return m_context; }
void setContext(Platform::Graphics::GLES2Context*);
WebCore::LayerCompositingThread* rootLayer() const { return m_rootLayer.get(); }
void setRootLayer(WebCore::LayerCompositingThread*);
WebCore::LayerCompositingThread* overlayLayer() const { return m_overlayLayer.get(); }
void setOverlayLayer(WebCore::LayerCompositingThread*);
WebCore::LayerCompositingThread* compositingThreadOverlayLayer() const { return m_compositingThreadOverlayLayer.get(); }
bool drawsRootLayer() const;
void setDrawsRootLayer(bool drawsRootLayer) { m_drawsRootLayer = drawsRootLayer; }
bool drawLayers(const WebCore::IntRect& dstRect, const WebCore::FloatRect& contents);
WebCore::IntRect layoutRect() const { return m_layoutRect; }
void setLayoutRect(const WebCore::IntRect& rect) { m_layoutRect = rect; }
WebCore::IntRect documentRect() const { return m_documentRect; }
void setDocumentRect(const WebCore::IntRect& rect) { m_documentRect = rect; }
WebCore::LayerRenderingResults lastCompositingResults() const { return m_lastCompositingResults; }
void setLastCompositingResults(const WebCore::LayerRenderingResults& results) { m_lastCompositingResults = results; }
WebCore::Color backgroundColor() const { return m_backgroundColor; }
void setBackgroundColor(const WebCore::Color&);
void releaseLayerResources();
WebPagePrivate* page() const { return m_webPage; }
void setPage(WebPagePrivate*);
void detach();
WebPageCompositorClient* client() const { return m_client; }
void compositorDestroyed();
void addOverlay(WebCore::LayerCompositingThread*);
void removeOverlay(WebCore::LayerCompositingThread*);
void findFixedElementRect(WebCore::LayerCompositingThread*, WebCore::IntRect&);
protected:
WebPageCompositorPrivate(WebPagePrivate*, WebPageCompositorClient*);
private:
void compositeLayers(const WebCore::TransformationMatrix&);
void attachOverlays() { attachOverlays(m_compositingThreadOverlayLayer.get(), m_webPage); }
void detachOverlays() { attachOverlays(m_compositingThreadOverlayLayer.get(), 0); }
static void attachOverlays(WebCore::LayerCompositingThread* overlayRoot, WebPagePrivate*);
virtual bool shouldChildWindowsUseDocumentCoordinates();
virtual void animationFrameChanged();
WebPageCompositorClient* m_client;
WebPagePrivate* m_webPage;
Platform::Graphics::GLES2Context* m_context;
OwnPtr<WebCore::LayerRenderer> m_layerRenderer;
RefPtr<WebCore::LayerCompositingThread> m_rootLayer;
RefPtr<WebCore::LayerCompositingThread> m_overlayLayer;
RefPtr<WebCore::LayerCompositingThread> m_compositingThreadOverlayLayer;
WebCore::IntRect m_layoutRect;
WebCore::IntRect m_documentRect;
WebCore::LayerRenderingResults m_lastCompositingResults;
WebCore::Color m_backgroundColor;
bool m_drawsRootLayer;
WebPageCompositor::ChildWindowPlacement m_childWindowPlacement;
};
} }
#endif // USE(ACCELERATED_COMPOSITING)
#endif // WebPageCompositor_p_h