diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 22:05:29 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 22:05:29 +0200 |
commit | 0bb233d1f7c4317bb772d72cc3f92cbcdb4027de (patch) | |
tree | 47b40aab26fdaa15ec446b7d6de9bdf7efd7bbbb /Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | |
parent | b1e9e47fa11f608ae16bc07f97a2acf95bf80272 (diff) | |
download | qtwebkit-0bb233d1f7c4317bb772d72cc3f92cbcdb4027de.tar.gz |
Imported WebKit commit f2da9451cbccb8b7921d55483aa0bc656ff9cf53 (http://svn.webkit.org/repository/webkit/trunk@119269)
New snapshot that includes fix for using -Werror only in developer builds
Diffstat (limited to 'Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | 86 |
1 files changed, 7 insertions, 79 deletions
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 5b43e337d..7fc2e8728 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -735,16 +735,6 @@ void QQuickWebViewPrivate::setContentPos(const QPointF& pos) q->setContentY(pos.y()); } -QRect QQuickWebViewPrivate::visibleContentsRect() const -{ - Q_Q(const QQuickWebView); - const QRectF visibleRect(q->boundingRect().intersected(pageView->boundingRect())); - - // We avoid using toAlignedRect() because it produces inconsistent width and height. - QRectF mappedRect(q->mapRectToWebContent(visibleRect)); - return QRect(floor(mappedRect.x()), floor(mappedRect.y()), floor(mappedRect.width()), floor(mappedRect.height())); -} - WebCore::IntSize QQuickWebViewPrivate::viewSize() const { return WebCore::IntSize(pageView->width(), pageView->height()); @@ -819,8 +809,6 @@ void QQuickWebViewLegacyPrivate::setZoomFactor(qreal factor) QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate(QQuickWebView* viewport) : QQuickWebViewPrivate(viewport) - , pageIsSuspended(false) - , lastCommittedScale(-1) { // Disable mouse events on the flickable web view so we do not // select text during pan gestures on platforms which send both @@ -846,89 +834,29 @@ void QQuickWebViewFlickablePrivate::onComponentComplete() { Q_Q(QQuickWebView); - interactionEngine.reset(new QtViewportInteractionEngine(q, pageView.data())); + interactionEngine.reset(new QtViewportInteractionEngine(webPageProxy.get(), q, pageView.data())); pageView->eventHandler()->setViewportInteractionEngine(interactionEngine.data()); - QObject::connect(interactionEngine.data(), SIGNAL(contentSuspendRequested()), q, SLOT(_q_suspend())); - QObject::connect(interactionEngine.data(), SIGNAL(contentResumeRequested()), q, SLOT(_q_resume())); - QObject::connect(interactionEngine.data(), SIGNAL(informVisibleContentChange(QPointF)), q, SLOT(_q_onInformVisibleContentChange(QPointF))); - - _q_resume(); - // Trigger setting of correct visibility flags after everything was allocated and initialized. _q_onVisibleChanged(); } void QQuickWebViewFlickablePrivate::didChangeViewportProperties(const WebCore::ViewportAttributes& newAttributes) { - interactionEngine->viewportAttributesChanged(newAttributes); + if (interactionEngine) + interactionEngine->viewportAttributesChanged(newAttributes); } void QQuickWebViewFlickablePrivate::updateViewportSize() { - Q_Q(QQuickWebView); - QSize viewportSize = q->boundingRect().size().toSize(); - - if (viewportSize.isEmpty() || !interactionEngine) - return; - - WebPreferences* wkPrefs = webPageProxy->pageGroup()->preferences(); - wkPrefs->setDeviceWidth(viewportSize.width()); - wkPrefs->setDeviceHeight(viewportSize.height()); - - // Let the WebProcess know about the new viewport size, so that - // it can resize the content accordingly. - webPageProxy->setViewportSize(viewportSize); - - _q_onInformVisibleContentChange(QPointF()); -} - -void QQuickWebViewFlickablePrivate::_q_onInformVisibleContentChange(const QPointF& trajectoryVector) -{ - Q_Q(QQuickWebView); - - DrawingAreaProxy* drawingArea = webPageProxy->drawingArea(); - if (!drawingArea) - return; - - QRectF accurateVisibleRect(q->boundingRect()); - accurateVisibleRect.translate(contentPos()); - - if (accurateVisibleRect == drawingArea->contentsRect()) - return; - - float scale = pageView->contentsScale(); - - if (scale != lastCommittedScale) - emit q->experimental()->test()->contentsScaleCommitted(); - lastCommittedScale = scale; - - drawingArea->setVisibleContentsRect(QRect(visibleContentsRect()), scale, trajectoryVector, FloatPoint(accurateVisibleRect.x(), accurateVisibleRect.y())); - - // Ensure that updatePaintNode is always called before painting. - pageView->update(); -} - -void QQuickWebViewFlickablePrivate::_q_suspend() -{ - pageIsSuspended = true; - webPageProxy->suspendActiveDOMObjectsAndAnimations(); -} - -void QQuickWebViewFlickablePrivate::_q_resume() -{ - if (!interactionEngine) - return; - - pageIsSuspended = false; - webPageProxy->resumeActiveDOMObjectsAndAnimations(); - - _q_onInformVisibleContentChange(QPointF()); + // FIXME: Examine why there is not an interactionEngine here in the beginning. + if (interactionEngine) + interactionEngine->viewportItemSizeChanged(); } void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) { - interactionEngine->pageContentPositionRequest(pos); + interactionEngine->pageContentPositionRequested(pos); } void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize) |