From 44c1687f8c2fc9f914745b874d5787c33348f0a2 Mon Sep 17 00:00:00 2001 From: "fsamuel@chromium.org" Date: Fri, 20 Jan 2012 19:08:33 +0000 Subject: [PATCH] [Chromium] Do not recompute viewport on same page navigation https://bugs.webkit.org/show_bug.cgi?id=75576 Reviewed by Darin Fisher. Added parameter isNavigationWithinPage to WebViewImpl::didCommitLoad that indicates whether a same-page navigation has just occurred. The page scale factor flag is reset only on navigation to a new page. If the flag is not set, viewport and page scale will be recomputed on layoutUpdated. * src/FrameLoaderClientImpl.cpp: (WebKit::FrameLoaderClientImpl::dispatchDidNavigateWithinPage): (WebKit::FrameLoaderClientImpl::dispatchDidCommitLoad): * src/WebViewImpl.cpp: (WebKit::WebViewImpl::didCommitLoad): (WebKit::WebViewImpl::observeNewNavigation): * src/WebViewImpl.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105528 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/chromium/ChangeLog | 22 ++++++++++++++++++++++ .../WebKit/chromium/src/FrameLoaderClientImpl.cpp | 4 ++-- Source/WebKit/chromium/src/WebViewImpl.cpp | 7 +++---- Source/WebKit/chromium/src/WebViewImpl.h | 5 +++-- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 288d56f..90281b8 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,25 @@ +2012-01-20 Fady Samuel + + [Chromium] Do not recompute viewport on same page navigation + https://bugs.webkit.org/show_bug.cgi?id=75576 + + Reviewed by Darin Fisher. + + Added parameter isNavigationWithinPage to WebViewImpl::didCommitLoad + that indicates whether a same-page navigation has just occurred. + + The page scale factor flag is reset only on navigation to a new page. + If the flag is not set, viewport and page scale will be recomputed on + layoutUpdated. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidNavigateWithinPage): + (WebKit::FrameLoaderClientImpl::dispatchDidCommitLoad): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::didCommitLoad): + (WebKit::WebViewImpl::observeNewNavigation): + * src/WebViewImpl.h: + 2012-01-20 Pavel Feldman Web Inspector: [chromium] add WebDevToolsFrontendClient::openInNewTab for upcoming WebCore change. diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index aec28c5..96bf57f 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -693,7 +693,7 @@ void FrameLoaderClientImpl::dispatchDidNavigateWithinPage() } bool isNewNavigation; - webView->didCommitLoad(&isNewNavigation); + webView->didCommitLoad(&isNewNavigation, true); if (m_webFrame->client()) m_webFrame->client()->didNavigateWithinPage(m_webFrame, isNewNavigation); @@ -805,7 +805,7 @@ void FrameLoaderClientImpl::dispatchDidCommitLoad() { WebViewImpl* webview = m_webFrame->viewImpl(); bool isNewNavigation; - webview->didCommitLoad(&isNewNavigation); + webview->didCommitLoad(&isNewNavigation, false); if (m_webFrame->client()) m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, isNewNavigation); diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index a147483..d738890 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -2649,7 +2649,7 @@ void WebView::removeAllUserContent() pageGroup->removeAllUserContent(); } -void WebViewImpl::didCommitLoad(bool* isNewNavigation) +void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPage) { if (isNewNavigation) *isNewNavigation = m_observedNewNavigation; @@ -2660,6 +2660,8 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation) m_newNavigationLoader = 0; #endif m_observedNewNavigation = false; + if (!isNavigationWithinPage) + m_pageScaleFactorIsSet = false; } void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) @@ -2742,9 +2744,6 @@ void WebViewImpl::startDragging(const WebDragData& dragData, void WebViewImpl::observeNewNavigation() { m_observedNewNavigation = true; - // FIXME: We need to make sure that m_pageScaleFactorIsSet is not reset - // on same page navigations. - m_pageScaleFactorIsSet = false; #ifndef NDEBUG m_newNavigationLoader = m_page->mainFrame()->loader()->documentLoader(); #endif diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 6ea196a..56f4bad 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -331,8 +331,9 @@ public: // Notifies the WebView that a load has been committed. isNewNavigation // will be true if a new session history item should be created for that - // load. - void didCommitLoad(bool* isNewNavigation); + // load. isNavigationWithinPage will be true if the navigation does + // not take the user away from the current page. + void didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPage); // Indicates two things: // 1) This view may have a new layout now. -- 2.7.4