2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
24 #include "DrawingAreaProxy.h"
25 #include "LayerTreeContext.h"
26 #include "PageClient.h"
28 #include "qgraphicswkview.h"
29 #include "WebPageProxy.h"
30 #include <wtf/PassOwnPtr.h>
31 #include <wtf/RefPtr.h>
32 #include <QBasicTimer>
33 #include <QGraphicsView>
36 class QGraphicsWKView;
39 using namespace WebKit;
41 class QWKPagePrivate : WebKit::PageClient {
43 QWKPagePrivate(QWKPage*, QWKContext*);
46 static QWKPagePrivate* get(QWKPage* page) { return page->d; }
48 void init(QGraphicsItem*, QGraphicsWKView::BackingStoreType);
51 virtual PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy();
52 virtual void setViewNeedsDisplay(const WebCore::IntRect&);
53 virtual void displayView();
54 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
56 virtual WebCore::IntSize viewSize();
57 virtual bool isViewWindowActive();
58 virtual bool isViewFocused();
59 virtual bool isViewVisible();
60 virtual bool isViewInWindow();
62 #if USE(ACCELERATED_COMPOSITING)
63 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
64 virtual void exitAcceleratedCompositingMode();
65 #endif // USE(ACCELERATED_COMPOSITING)
66 virtual void pageDidRequestScroll(const WebCore::IntSize&);
67 virtual void processDidCrash();
68 virtual void pageClosed() { }
69 virtual void didRelaunchProcess();
70 virtual void didChangeContentsSize(const WebCore::IntSize&);
71 virtual void didFindZoomableArea(const WebCore::IntRect&);
72 virtual void setCursor(const WebCore::Cursor&);
73 virtual void setViewportArguments(const WebCore::ViewportArguments&);
74 virtual void takeFocus(bool direction);
75 virtual void toolTipChanged(const WTF::String&, const WTF::String&);
76 virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
77 virtual void clearAllEditCommands();
78 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
79 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
80 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
82 virtual void doneWithKeyEvent(const WebKit::NativeWebKeyboardEvent&, bool wasEventHandled);
83 virtual void selectionChanged(bool, bool, bool, bool);
84 virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
85 virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
87 virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
89 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
90 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
91 virtual double customRepresentationZoomFactor() { return 1; }
92 virtual void setCustomRepresentationZoomFactor(double) { }
93 virtual void didChangeScrollbarsForMainFrame() const { }
95 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
97 void paint(QPainter* painter, QRect);
99 void keyPressEvent(QKeyEvent*);
100 void keyReleaseEvent(QKeyEvent*);
101 void mouseMoveEvent(QGraphicsSceneMouseEvent*);
102 void mousePressEvent(QGraphicsSceneMouseEvent*);
103 void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
104 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
105 void wheelEvent(QGraphicsSceneWheelEvent*);
107 void updateAction(QWKPage::WebAction action);
108 void updateNavigationActions();
109 void updateEditorActions();
111 void _q_webActionTriggered(bool checked);
113 void touchEvent(QTouchEvent*);
121 QAction* actions[QWKPage::WebActionCount];
122 QWKPreferences* preferences;
124 RefPtr<WebKit::WebPageProxy> page;
126 WebCore::ViewportArguments viewportArguments;
128 QWKPage::CreateNewPageFn createNewPageFn;
131 QBasicTimer tripleClickTimer;
132 QGraphicsWKView::BackingStoreType backingStoreType;
134 bool isConnectedToEngine;
137 class QtViewportAttributesPrivate : public QSharedData {
139 QtViewportAttributesPrivate(QWKPage::ViewportAttributes* qq)
143 QWKPage::ViewportAttributes* q;
147 #endif /* qkpage_p_h */