Changeset 102765 in webkit
- Timestamp:
- Dec 14, 2011 4:50:02 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r102724 r102765 1 2011-12-14 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 [Qt][WK2] Remove DrawingArea and QtWebPageEventHandler code from QtWebPageProxy 4 https://bugs.webkit.org/show_bug.cgi?id=74414 5 6 Reviewed by Simon Hausmann. 7 8 This also moves QtWebPageEventHandler to inside QQuickWebPagePrivate, to avoid 9 the WebPage having a backpointer to the QQuickWebView. 10 11 * Target.pri: 12 * UIProcess/API/qt/qquickwebpage.cpp: 13 (QQuickWebPage::geometryChanged): 14 (QQuickWebPage::event): 15 (QQuickWebPagePrivate::QQuickWebPagePrivate): 16 (QQuickWebPagePrivate::initialize): 17 (QQuickWebPagePrivate::setDrawingAreaSize): 18 (QQuickWebPagePrivate::paintToCurrentGLContext): 19 (QQuickWebPagePrivate::resetPaintNode): 20 * UIProcess/API/qt/qquickwebpage_p.h: 21 * UIProcess/API/qt/qquickwebpage_p_p.h: 22 * UIProcess/API/qt/qquickwebview.cpp: 23 (QQuickWebViewPrivate::initialize): 24 (QQuickWebViewPrivate::initializeDesktop): 25 (QQuickWebViewPrivate::initializeTouch): 26 (QQuickWebViewPrivate::_q_resume): 27 (QQuickWebViewPrivate::processDidCrash): 28 (QQuickWebViewPrivate::didRelaunchProcess): 29 (QQuickWebViewPrivate::createDrawingAreaProxy): 30 (QQuickWebViewPrivate::updateVisibleContentRectAndScale): 31 (QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged): 32 (QQuickWebViewPrivate::updateViewportSize): 33 * UIProcess/API/qt/qquickwebview_p_p.h: 34 * UIProcess/qt/QtPageClient.cpp: 35 (QtPageClient::createDrawingAreaProxy): 36 * UIProcess/qt/QtPageClient.h: 37 (QtPageClient::findStringInCustomRepresentation): 38 (QtPageClient::countStringMatchesInCustomRepresentation): 39 * UIProcess/qt/QtWebPageEventHandler.cpp: 40 (QtWebPageEventHandler::QtWebPageEventHandler): 41 (QtWebPageEventHandler::startDrag): 42 * UIProcess/qt/QtWebPageEventHandler.h: 43 * UIProcess/qt/QtWebPageProxy.cpp: 44 (QtWebPageProxy::init): 45 * UIProcess/qt/QtWebPageProxy.h: 46 1 47 2011-12-13 Gustavo Noronha Silva <gns@gnome.org> 2 48 -
trunk/Source/WebKit2/Target.pri
r102670 r102765 199 199 UIProcess/Launcher/ProcessLauncher.h \ 200 200 UIProcess/Launcher/ThreadLauncher.h \ 201 UIProcess/LayerTreeHostProxy.h \ 201 202 UIProcess/Notifications/NotificationPermissionRequest.h \ 202 203 UIProcess/Notifications/NotificationPermissionRequestManagerProxy.h \ -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
r102674 r102765 22 22 #include "qquickwebpage_p.h" 23 23 24 #include "LayerTreeHostProxy.h" 24 25 #include "QtWebPageEventHandler.h" 25 26 #include "QtWebPageProxy.h" 26 27 #include "TransformationMatrix.h" 27 28 #include "qquickwebpage_p_p.h" 28 #include "qquickwebview_p.h"29 #include <QUrl>30 29 #include <QtQuick/QQuickCanvas> 31 30 #include <QtQuick/QSGGeometryNode> … … 143 142 QQuickItem::geometryChanged(newGeometry, oldGeometry); 144 143 if (newGeometry.size() != oldGeometry.size()) 145 d-> pageProxy->setDrawingAreaSize(newGeometry.size().toSize());144 d->setDrawingAreaSize(newGeometry.size().toSize()); 146 145 } 147 146 148 147 bool QQuickWebPage::event(QEvent* ev) 149 148 { 150 if (d-> pageProxy->eventHandler()->handleEvent(ev))149 if (d->eventHandler.data()->handleEvent(ev)) 151 150 return true; 152 151 if (ev->type() == QEvent::InputMethod) … … 161 160 } 162 161 163 QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* view)164 : q( view)165 , pageProxy(0)166 , sgUpdateQueue( view)162 QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q) 163 : q(q) 164 , webPageProxy(0) 165 , sgUpdateQueue(q) 167 166 , paintingIsInitialized(false) 168 167 , m_paintNode(0) … … 170 169 } 171 170 172 void QQuickWebPagePrivate::setPageProxy(QtWebPageProxy* pageProxy) 173 { 174 ASSERT(!this->pageProxy); 175 ASSERT(pageProxy); 176 this->pageProxy = pageProxy; 171 void QQuickWebPagePrivate::initialize(WebKit::WebPageProxy* webPageProxy) 172 { 173 this->webPageProxy = webPageProxy; 174 eventHandler.reset(new QtWebPageEventHandler(toAPI(webPageProxy), q)); 177 175 } 178 176 … … 189 187 } 190 188 189 void QQuickWebPagePrivate::setDrawingAreaSize(const QSize& size) 190 { 191 DrawingAreaProxy* drawingArea = webPageProxy->drawingArea(); 192 if (!drawingArea) 193 return; 194 drawingArea->setSize(WebCore::IntSize(size), WebCore::IntSize()); 195 } 196 191 197 void QQuickWebPagePrivate::paintToCurrentGLContext() 192 198 { … … 200 206 201 207 if (!clipRect.isValid()) 208 return; 209 210 DrawingAreaProxy* drawingArea = webPageProxy->drawingArea(); 211 if (!drawingArea) 202 212 return; 203 213 … … 215 225 ASSERT(!glGetError()); 216 226 217 pageProxy->renderToCurrentGLContext(transform, opacity); 227 drawingArea->paintToCurrentGLContext(transform, opacity); 228 218 229 glDisable(GL_SCISSOR_TEST); 219 230 ASSERT(!glGetError()); … … 316 327 { 317 328 m_paintNode = 0; 318 pageProxy->purgeGLResources(); 329 DrawingAreaProxy* drawingArea = webPageProxy->drawingArea(); 330 if (drawingArea && drawingArea->layerTreeHostProxy()) 331 drawingArea->layerTreeHostProxy()->purgeGLResources(); 319 332 } 320 333 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h
r102445 r102765 27 27 #include <QtQuick/QQuickItem> 28 28 29 class QQuickWebView;30 29 class QQuickWebPagePrivate; 31 30 class QWebPreferences; -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
r101683 r102765 23 23 24 24 #include "QtSGUpdateQueue.h" 25 #include "QtWebPageProxy.h"26 25 #include "qquickwebpage_p.h" 27 26 28 QT_BEGIN_NAMESPACE 29 class QRectF; 30 class QSGNode; 31 class QString; 32 QT_END_NAMESPACE 27 namespace WebKit { 28 class WebPageProxy; 29 class QtViewportInteractionEngine; 30 } 33 31 34 class Q QuickWebPage;32 class QtWebPageEventHandler; 35 33 36 34 class QQuickWebPagePrivate { 37 35 public: 38 QQuickWebPagePrivate(QQuickWebPage* view);36 QQuickWebPagePrivate(QQuickWebPage* q); 39 37 ~QQuickWebPagePrivate(); 40 38 41 void setPageProxy(QtWebPageProxy*); 39 void initialize(WebKit::WebPageProxy*); 40 void setDrawingAreaSize(const QSize&); 42 41 43 42 void paintToCurrentGLContext(); 44 43 void resetPaintNode(); 45 44 45 QScopedPointer<QtWebPageEventHandler> eventHandler; 46 46 QQuickWebPage* const q; 47 QtWebPageProxy* pageProxy;47 WebKit::WebPageProxy* webPageProxy; 48 48 WebKit::QtSGUpdateQueue sgUpdateQueue; 49 49 bool paintingIsInitialized; -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
r102680 r102765 22 22 #include "qquickwebview_p.h" 23 23 24 #include "DrawingAreaProxyImpl.h" 24 25 #include "QtDialogRunner.h" 26 #include "QtWebPageEventHandler.h" 25 27 #include "QtWebPageProxy.h" 26 28 #include "UtilsQt.h" … … 66 68 QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d; 67 69 setPageProxy(new QtWebPageProxy(q_ptr, &pageClient, contextRef, pageGroupRef)); 68 pageViewPrivate-> setPageProxy(pageProxy.data());70 pageViewPrivate->initialize(webPageProxy()); 69 71 70 72 pageLoadClient.reset(new QtWebPageLoadClient(pageProxy->pageRef(), q_ptr)); 71 73 pagePolicyClient.reset(new QtWebPagePolicyClient(pageProxy->pageRef(), q_ptr)); 72 74 pageUIClient.reset(new QtWebPageUIClient(pageProxy->pageRef(), q_ptr)); 73 eventHandler.reset(new QtWebPageEventHandler(pageProxy->pageRef(), q_ptr));74 75 75 76 // Any page setting should preferrable be set before creating the page, so set them here: … … 77 78 QWebPreferencesPrivate::get(pageProxy->preferences())->setAttribute(QWebPreferencesPrivate::AcceleratedCompositingEnabled, true); 78 79 79 pageClient.initialize(q_ptr, pageProxy.data(), eventHandler.data(), &undoController);80 pageClient.initialize(q_ptr, pageProxy.data(), pageViewPrivate->eventHandler.data(), &undoController); 80 81 81 82 // Creates a page with the page creation parameters. 82 pageProxy->init( eventHandler.data());83 pageProxy->init(); 83 84 84 85 // Trigger setting of correct visibility flags after everything was allocated and initialized. … … 112 113 } 113 114 interactionEngine.reset(0); 114 eventHandler->setViewportInteractionEngine(0);115 pageView->d->eventHandler->setViewportInteractionEngine(0); 115 116 enableMouseEvents(); 116 117 } … … 119 120 { 120 121 interactionEngine.reset(new QtViewportInteractionEngine(viewport, pageView.data())); 121 eventHandler->setViewportInteractionEngine(interactionEngine.data());122 pageView->d->eventHandler->setViewportInteractionEngine(interactionEngine.data()); 122 123 disableMouseEvents(); 123 124 QObject::connect(interactionEngine.data(), SIGNAL(contentSuspendRequested()), viewport, SLOT(_q_suspend())); … … 163 164 } 164 165 165 updateVisibleContentRect ();166 updateVisibleContentRectAndScale(); 166 167 } 167 168 … … 215 216 { 216 217 emit q_ptr->navigationStateChanged(); 217 eventHandler->resetGestureRecognizers();218 pageView->d->eventHandler->resetGestureRecognizers(); 218 219 WebCore::KURL url(WebCore::ParsedURLString, webPageProxy()->urlAtProcessExit()); 219 220 qWarning("WARNING: The web process experienced a crash on '%s'.", qPrintable(QUrl(url).toString(QUrl::RemoveUserInfo))); … … 224 225 emit q_ptr->navigationStateChanged(); 225 226 qWarning("WARNING: The web process has been successfully restarted."); 226 pageProxy->setDrawingAreaSize(viewSize()); 227 } 228 229 void QQuickWebViewPrivate::updateVisibleContentRect() 230 { 227 pageView->d->setDrawingAreaSize(viewSize()); 228 } 229 230 PassOwnPtr<DrawingAreaProxy> QQuickWebViewPrivate::createDrawingAreaProxy() 231 { 232 return DrawingAreaProxyImpl::create(webPageProxy()); 233 } 234 235 void QQuickWebViewPrivate::updateVisibleContentRectAndScale() 236 { 237 DrawingAreaProxy* drawingArea = webPageProxy()->drawingArea(); 238 if (!drawingArea) 239 return; 240 231 241 Q_Q(QQuickWebView); 232 242 const QRectF visibleRectInPageViewCoordinates = q->mapRectToItem(pageView.data(), q->boundingRect()).intersected(pageView->boundingRect()); 233 243 float scale = pageView->scale(); 234 pageProxy->setVisibleContentRectAndScale(visibleRectInPageViewCoordinates, scale); 244 245 QRect alignedVisibleContentRect = visibleRectInPageViewCoordinates.toAlignedRect(); 246 drawingArea->setVisibleContentsRectAndScale(alignedVisibleContentRect, scale); 247 248 // FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended. 249 webPageProxy()->setFixedVisibleContentRect(alignedVisibleContentRect); 235 250 } 236 251 237 252 void QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged(const QPointF& trajectoryVector) 238 253 { 239 pageProxy->setVisibleContentRectTrajectoryVector(trajectoryVector); 254 DrawingAreaProxy* drawingArea = webPageProxy()->drawingArea(); 255 if (!drawingArea) 256 return; 257 drawingArea->setVisibleContentRectTrajectoryVector(trajectoryVector); 240 258 } 241 259 … … 258 276 259 277 interactionEngine->applyConstraints(computeViewportConstraints()); 260 updateVisibleContentRect ();278 updateVisibleContentRectAndScale(); 261 279 } 262 280 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
r102680 r102765 22 22 #define qquickwebview_p_p_h 23 23 24 #include "DrawingAreaProxy.h" 24 25 #include "QtPageClient.h" 25 #include "QtWebPageEventHandler.h"26 26 #include "QtViewportInteractionEngine.h" 27 27 #include "QtWebPageLoadClient.h" … … 51 51 Q_DECLARE_PUBLIC(QQuickWebView) 52 52 friend class QQuickWebViewExperimental; 53 friend class QQuickWebPage; 53 54 54 55 public: … … 75 76 QtViewportInteractionEngine::Constraints computeViewportConstraints(); 76 77 77 void updateVisibleContentRect ();78 void updateVisibleContentRectAndScale(); 78 79 79 80 void _q_suspend(); … … 101 102 void processDidCrash(); 102 103 void didRelaunchProcess(); 103 104 PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); 104 105 105 106 private: … … 136 137 QtWebUndoController undoController; 137 138 138 QScopedPointer<QtWebPageEventHandler> eventHandler;139 140 139 QScopedPointer<QtWebPageLoadClient> pageLoadClient; 141 140 QScopedPointer<QtWebPagePolicyClient> pagePolicyClient; -
trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp
r102680 r102765 53 53 PassOwnPtr<DrawingAreaProxy> QtPageClient::createDrawingAreaProxy() 54 54 { 55 return m_qtWebPageProxy->createDrawingAreaProxy();55 return QQuickWebViewPrivate::get(m_webView)->createDrawingAreaProxy(); 56 56 } 57 57 -
trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h
r102680 r102765 50 50 virtual void processDidCrash(); 51 51 virtual void didRelaunchProcess(); 52 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); 52 53 53 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();54 54 virtual void displayView(); 55 55 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); … … 86 86 virtual void didChangeScrollbarsForMainFrame() const { } 87 87 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects); 88 virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) { }89 virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) { }88 virtual void findStringInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { } 89 virtual void countStringMatchesInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { } 90 90 virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); 91 91 virtual void focusEditableArea(const WebCore::IntRect&, const WebCore::IntRect&); -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
r102579 r102765 22 22 #include "QtWebPageEventHandler.h" 23 23 24 #include "qquickwebview_p.h"25 24 #include "NativeWebKeyboardEvent.h" 26 25 #include "NativeWebMouseEvent.h" 27 26 #include "NativeWebWheelEvent.h" 28 27 #include "QtViewportInteractionEngine.h" 28 #include "qquickwebpage_p.h" 29 29 #include <QDrag> 30 30 #include <QGraphicsSceneMouseEvent> … … 81 81 } 82 82 83 QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWeb View* qmlWebView, WebKit::QtViewportInteractionEngine* viewportInteractionEngine)83 QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWebPage* qmlWebPage) 84 84 : m_webPageProxy(toImpl(pageRef)) 85 , m_interactionEngine(viewportInteractionEngine)86 85 , m_panGestureRecognizer(this) 87 86 , m_pinchGestureRecognizer(this) 88 87 , m_tapGestureRecognizer(this) 89 , m_web View(qmlWebView)88 , m_webPage(qmlWebPage) 90 89 , m_previousClickButton(Qt::NoButton) 91 90 , m_clickCount(0) … … 415 414 Qt::DropAction actualDropAction = Qt::IgnoreAction; 416 415 417 if (QWindow* window = m_web View->canvas()) {416 if (QWindow* window = m_webPage->canvas()) { 418 417 QDrag* drag = new QDrag(window); 419 418 drag->setPixmap(QPixmap::fromImage(dragQImage)); -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h
r102579 r102765 32 32 #include <WKPage.h> 33 33 34 class QQuickWeb View;34 class QQuickWebPage; 35 35 36 36 using namespace WebKit; … … 40 40 41 41 public: 42 QtWebPageEventHandler(WKPageRef, QQuickWeb View*, WebKit::QtViewportInteractionEngine* = 0);42 QtWebPageEventHandler(WKPageRef, QQuickWebPage*); 43 43 ~QtWebPageEventHandler(); 44 44 … … 65 65 QtPinchGestureRecognizer m_pinchGestureRecognizer; 66 66 QtTapGestureRecognizer m_tapGestureRecognizer; 67 QQuickWeb View* m_webView;67 QQuickWebPage* m_webPage; 68 68 69 69 private: -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r102680 r102765 34 34 35 35 #include "DownloadProxy.h" 36 #include "DrawingAreaProxyImpl.h"37 #include "LayerTreeHostProxy.h"38 36 #include "QtDownloadManager.h" 39 37 #include "QtPageClient.h" 40 #include "QtWebPageEventHandler.h"41 38 #include "WebBackForwardList.h" 42 #include "WebContextMenuProxyQt.h"43 39 #include "WKStringQt.h" 44 40 #include <WebKit2/WKFrame.h> … … 58 54 } 59 55 60 void QtWebPageProxy::init( QtWebPageEventHandler* eventHandler)56 void QtWebPageProxy::init() 61 57 { 62 m_eventHandler = eventHandler;63 58 m_webPageProxy->initializeWebPage(); 64 59 } … … 147 142 } 148 143 149 void QtWebPageProxy::setDrawingAreaSize(const QSize& size)150 {151 if (!m_webPageProxy->drawingArea())152 return;153 154 m_webPageProxy->drawingArea()->setSize(IntSize(size), IntSize());155 }156 157 144 qreal QtWebPageProxy::textZoomFactor() const 158 145 { … … 208 195 } 209 196 210 PassOwnPtr<DrawingAreaProxy> QtWebPageProxy::createDrawingAreaProxy()211 {212 return DrawingAreaProxyImpl::create(m_webPageProxy.get());213 }214 215 void QtWebPageProxy::renderToCurrentGLContext(const TransformationMatrix& transform, float opacity)216 {217 DrawingAreaProxy* drawingArea = m_webPageProxy->drawingArea();218 if (drawingArea)219 drawingArea->paintToCurrentGLContext(transform, opacity);220 }221 222 void QtWebPageProxy::purgeGLResources()223 {224 DrawingAreaProxy* drawingArea = m_webPageProxy->drawingArea();225 if (drawingArea && drawingArea->layerTreeHostProxy())226 drawingArea->layerTreeHostProxy()->purgeGLResources();227 }228 229 void QtWebPageProxy::setVisibleContentRectAndScale(const QRectF& visibleContentRect, float scale)230 {231 if (!m_webPageProxy->drawingArea())232 return;233 234 QRect alignedVisibleContentRect = visibleContentRect.toAlignedRect();235 m_webPageProxy->drawingArea()->setVisibleContentsRectAndScale(alignedVisibleContentRect, scale);236 237 // FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended.238 m_webPageProxy->setFixedVisibleContentRect(alignedVisibleContentRect);239 }240 241 void QtWebPageProxy::setVisibleContentRectTrajectoryVector(const QPointF& trajectoryVector)242 {243 if (!m_webPageProxy->drawingArea())244 return;245 246 m_webPageProxy->drawingArea()->setVisibleContentRectTrajectoryVector(trajectoryVector);247 }248 249 197 #include "moc_QtWebPageProxy.cpp" -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
r102680 r102765 22 22 #define QtWebPageProxy_h 23 23 24 #include "DrawingAreaProxy.h"25 24 #include "QtWebContext.h" 26 25 #include "WebPageProxy.h" … … 32 31 class QQuickWebPage; 33 32 class QQuickWebView; 34 class QtWebPageEventHandler;35 33 class QWebDownloadItem; 36 34 class QWebNavigationHistory; … … 51 49 ~QtWebPageProxy(); 52 50 53 PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();54 55 51 void goBackTo(int index); 56 52 void goForwardTo(int index); 57 53 58 54 WKPageRef pageRef() const; 59 60 void setDrawingAreaSize(const QSize&);61 55 62 56 QWebPreferences* preferences() const; … … 76 70 void setPageAndTextZoomFactors(qreal pageZoomFactor, qreal textZoomFactor); 77 71 78 void setVisibleContentRectAndScale(const QRectF&, float);79 void setVisibleContentRectTrajectoryVector(const QPointF&);80 void renderToCurrentGLContext(const WebCore::TransformationMatrix&, float);81 void purgeGLResources();82 83 72 QWebNavigationHistory* navigationHistory() const; 84 73 … … 89 78 90 79 void handleDownloadRequest(DownloadProxy*); 91 void init( QtWebPageEventHandler*);80 void init(); 92 81 93 82 void showContextMenu(QSharedPointer<QMenu>); 94 83 void hideContextMenu(); 95 96 QtWebPageEventHandler* eventHandler() { return m_eventHandler; }97 84 98 85 public Q_SLOTS: … … 115 102 116 103 QSharedPointer<QMenu> activeMenu; 117 QtWebPageEventHandler* m_eventHandler;118 104 }; 119 105
Note: See TracChangeset
for help on using the changeset viewer.