From 61cbe492214da0583eb4576648fa3b46d8e898e1 Mon Sep 17 00:00:00 2001 From: Changhyup Jwa Date: Wed, 27 Mar 2013 14:27:07 +0900 Subject: [PATCH] Fix incorrect scroll position adjustment on device rotation [Title] Fix incorrect scroll position adjustment on device rotation [issue#] N/A [Problem] Scroll position moved incorrectly on device rotation [Cause] By patch d7e58608b9d5f779a796e0459a60849079c10faf, scroll position is adjusted by constrainsScrollingToContentEdge [Solution] Disable constrainsScrollingToContentEdge until viewport attibutes change handling Change-Id: Ica53a9a68e4bb6c4ccfa0b436005bddaa745fd13 --- Source/WebKit2/WebProcess/WebPage/WebPage.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index f0ee7fd..1cd2233 100755 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -1073,6 +1073,12 @@ void WebPage::sendViewportAttributesChanged() // In this case, JS returns incorrect inner size value because scale factor is not updated yet // So, we update fixed visible content rect at here. // FIXME: scale factor needs to be calculated and set fixed visible content rect + + // if constrainsScrollingToContentEdge is true, scroll position will be adjusted with contents size. + // disable this to avoid adjust scroll position on setFixedVisibleContentRect() because contents size is not fixed yet. + bool constrainsScrollingToContentEdge = mainFrameView()->constrainsScrollingToContentEdge(); + mainFrameView()->setConstrainsScrollingToContentEdge(false); + FloatSize contentFixedSize = m_viewportSize; contentFixedSize.scale(1 / (attr.initialScale * attr.devicePixelRatio)); mainFrameView()->setFixedVisibleContentRect(IntRect(mainFrameView()->scrollPosition(), roundedIntSize(contentFixedSize))); @@ -1089,6 +1095,11 @@ void WebPage::sendViewportAttributesChanged() setResizesToContentsUsingLayoutSize(IntSize(static_cast(attr.layoutSize.width()), static_cast(attr.layoutSize.height()))); +#if ENABLE(TIZEN_VIEWPORT_META_TAG) + // recover constrainsScrollingToContentEdge + mainFrameView()->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdge); +#endif + send(Messages::WebPageProxy::DidChangeViewportProperties(attr)); } -- 2.7.4