From: Changhyup Jwa Date: Mon, 3 Jun 2013 07:47:44 +0000 (+0900) Subject: Keep visible content width on rotation X-Git-Tag: submit/tizen_2.2/20130714.131554~179^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f69f2c3a66c7e6c0e0402c6b79597268b70cd8c9;p=framework%2Fweb%2Fwebkit-efl.git Keep visible content width on rotation [Title] Keep visible content width on rotation [Issue#] N_SE-39623 [Problem] Scale factor is not kept after device rotation from portrait to landscape and getting back to portrait [Cause] Webkit just keep current scale factor, not visible content width [Solution] Keep visible content width on rotation Change-Id: I81a25acee942539e5428461a98a0214fa6171ff1 --- diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index c2c0902..ad113e8 100755 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -367,6 +367,7 @@ void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves) void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes& attributes) { + double scaleRatioBeforeRotation = m_scaleFactor / m_viewportConstraints.minimumScale; m_viewportConstraints = computeViewportConstraints(attributes); // if content is reloaded, contents size will not be changed @@ -387,6 +388,7 @@ void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribut return; float newScale = scaleFactor(); + IntPoint newScrollPosition = m_visibleContentRect.location(); Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_viewImpl->view())); int angle = ecore_evas_rotation_get(ee); bool isRotated = (angle != m_viewportAngle); @@ -394,8 +396,8 @@ void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribut // if it's rotated, we need to fit content to viewport by minimize the scale if (isRotated) { m_viewportAngle = angle; - if (m_viewportFitsToContent) - newScale = m_viewportConstraints.minimumScale; + newScale = m_viewportConstraints.minimumScale * scaleRatioBeforeRotation; + newScrollPosition.scale(newScale / m_scaleFactor, newScale / m_scaleFactor); } #if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) @@ -404,9 +406,9 @@ void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribut #endif #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) - setVisibleContentRect(m_visibleContentRect, newScale); + setVisibleContentRect(IntRect(newScrollPosition, m_visibleContentRect.size()), newScale); #else - m_viewImpl->page()->scalePage(newScale, m_visibleContentRect.location()); + m_viewImpl->page()->scalePage(newScale, newScrollPosition); #endif #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)