Created
March 20, 2012 16:46
-
-
Save kenchris/2138096 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | |
index fdc2073..8e17f18 100644 | |
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | |
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | |
@@ -489,8 +489,6 @@ void QQuickWebViewLegacyPrivate::updateViewportSize() | |
QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate(QQuickWebView* viewport) | |
: QQuickWebViewPrivate(viewport) | |
- , postTransitionState(adoptPtr(new PostTransitionState(this))) | |
- , isTransitioningToNewPage(false) | |
, pageIsSuspended(true) | |
, loadSuccessDispatchIsPending(false) | |
{ | |
@@ -581,25 +579,17 @@ void QQuickWebViewFlickablePrivate::loadDidCommit() | |
{ | |
// Due to entering provisional load before committing, we | |
// might actually be suspended here. | |
- | |
- isTransitioningToNewPage = true; | |
} | |
void QQuickWebViewFlickablePrivate::didFinishFirstNonEmptyLayout() | |
{ | |
- if (!pageIsSuspended) { | |
- isTransitioningToNewPage = false; | |
- postTransitionState->apply(); | |
- } | |
} | |
void QQuickWebViewFlickablePrivate::didChangeViewportProperties(const WebCore::ViewportArguments& args) | |
{ | |
viewportArguments = args; | |
- if (isTransitioningToNewPage) | |
- return; | |
- | |
+ // FIXME: If suspended we should do this on resume. | |
interactionEngine->applyConstraints(computeViewportConstraints()); | |
} | |
@@ -652,33 +642,17 @@ void QQuickWebViewFlickablePrivate::_q_resume() | |
pageIsSuspended = false; | |
webPageProxy->resumeActiveDOMObjectsAndAnimations(); | |
- if (isTransitioningToNewPage) { | |
- isTransitioningToNewPage = false; | |
- postTransitionState->apply(); | |
- } | |
- | |
_q_contentViewportChanged(QPointF()); | |
} | |
void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) | |
{ | |
- if (isTransitioningToNewPage) { | |
- postTransitionState->position = pos; | |
- return; | |
- } | |
- | |
interactionEngine->pagePositionRequest(pos); | |
} | |
void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize) | |
{ | |
Q_Q(QQuickWebView); | |
- // FIXME: We probably want to handle suspend here as well | |
- if (isTransitioningToNewPage) { | |
- postTransitionState->contentsSize = newSize; | |
- return; | |
- } | |
- | |
pageView->setContentsSize(newSize); | |
q->experimental()->viewportInfo()->didUpdateContentsSize(); | |
} | |
@@ -720,21 +694,6 @@ QtViewportInteractionEngine::Constraints QQuickWebViewFlickablePrivate::computeV | |
return newConstraints; | |
} | |
-void QQuickWebViewFlickablePrivate::PostTransitionState::apply() | |
-{ | |
- p->interactionEngine->reset(); | |
- p->interactionEngine->applyConstraints(p->computeViewportConstraints()); | |
- p->interactionEngine->pagePositionRequest(position); | |
- | |
- if (contentsSize.isValid()) { | |
- p->pageView->setContentsSize(contentsSize); | |
- p->q_ptr->experimental()->viewportInfo()->didUpdateContentsSize(); | |
- } | |
- | |
- position = QPoint(); | |
- contentsSize = QSize(); | |
-} | |
- | |
/*! | |
\qmlsignal WebView::onNavigationRequested(request) | |
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h | |
index f456d7d..1d3aa97 100644 | |
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h | |
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h | |
@@ -204,25 +204,7 @@ public: | |
QtViewportInteractionEngine::Constraints computeViewportConstraints(); | |
private: | |
- // This class is responsible for collecting and applying all properties | |
- // on the viewport item, when transitioning from page A to page B is finished. | |
- // See more at https://trac.webkit.org/wiki/QtWebKitLayoutInteraction | |
- class PostTransitionState { | |
- public: | |
- PostTransitionState(QQuickWebViewFlickablePrivate* parent) | |
- : p(parent) | |
- { } | |
- | |
- void apply(); | |
- | |
- QQuickWebViewFlickablePrivate* p; | |
- QSize contentsSize; | |
- QPoint position; | |
- }; | |
- | |
QScopedPointer<QtViewportInteractionEngine> interactionEngine; | |
- OwnPtr<PostTransitionState> postTransitionState; | |
- bool isTransitioningToNewPage; | |
bool pageIsSuspended; | |
bool loadSuccessDispatchIsPending; | |
}; | |
diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp | |
index 174add2..2ffafd7 100644 | |
--- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp | |
+++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp | |
@@ -418,6 +418,8 @@ void QtViewportInteractionEngine::applyConstraints(const Constraints& constraint | |
// We always have to apply the constrains even if they didn't change, as | |
// the initial scale might need to be applied. | |
+ reset(); | |
+ | |
ViewportUpdateDeferrer guard(this); | |
m_constraints = constraints; | |
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp | |
index 54e7503..4482b4e 100644 | |
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp | |
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp | |
@@ -438,10 +438,13 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) con | |
return; | |
#if PLATFORM(QT) | |
- m_page->send(Messages::WebPageProxy::DidChangeContentsSize(size)); | |
- | |
- if (m_page->useFixedLayout()) | |
+ if (m_page->useFixedLayout()) { | |
+ // The below method updates the size(). | |
m_page->resizeToContentsIfNeeded(); | |
+ } | |
+ | |
+ m_page->send(Messages::WebPageProxy::DidChangeContentsSize(m_page->size())); | |
+ | |
#endif | |
FrameView* frameView = frame->view(); | |
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp | |
index dcdba37..6b82463 100644 | |
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp | |
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp | |
@@ -852,7 +852,7 @@ void WebPage::resizeToContentsIfNeeded() | |
if (contentSize == m_viewSize) | |
return; | |
- m_viewSize = contentSize; | |
+ m_viewSize = contentSize.expandedTo(view->fixedLayoutSize()); | |
view->resize(m_viewSize); | |
view->setNeedsLayout(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment