From: Changhyup Jwa Date: Thu, 18 Apr 2013 00:38:25 +0000 (+0900) Subject: Floating division miscalculation with launching in landscape mode X-Git-Tag: 2.1_release~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f17e96324ec128a79d84f6dba09d59a36eff918;p=platform%2Fframework%2Fweb%2Fwebkit-efl.git Floating division miscalculation with launching in landscape mode [Title] Floating division miscalculation with launching in landscape mode [Issue#] N_SE-35034, N_SE-35003 [Problem] Content is not fitted correctly if browser loads media content in landscape mode [Cause] Minimum scale factor is selected maximum one between horizontal and vertical minimum scale factor. And on landscape mode, vertical minimum scale factor is a bit larger than horizontal minimum scale factor. So, content is not fitted initially. [Solution] Ignore a bit difference between horizontal and vertial minimum scale factor. And initialize m_viewportAngle for landscape mode launching. Change-Id: I9c551f35606ea724cceaa2461a39705bfd8f949b --- diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index e0ff8f7..34c115a 100755 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -136,6 +136,8 @@ PageClientImpl::PageClientImpl(EwkViewImpl* viewImpl) #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE) m_formDataCandidate = FormDataCandidate::create(m_viewImpl); #endif + Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_viewImpl->view())); + m_viewportAngle = ecore_evas_rotation_get(ee); #endif setBackgroundColor(1, 1, 1, 1); @@ -233,6 +235,11 @@ double PageClientImpl::availableMinimumScale() IntSize contentsSize = m_viewImpl->page()->contentsSize(); double horizontalMinScale = max(((double)viewSize().width() / contentsSize.width()), 0.25); double verticalMinScale = max(((double)viewSize().height() / contentsSize.height()), 0.25); + // If there's only a bit ignorable difference between horizontalMinScale and verticalMinScale, + // ignore verticalMinScale to fit content's width to view + const double ignorableThreshold = 0.01; + if (fabs(horizontalMinScale - verticalMinScale) < ignorableThreshold) + verticalMinScale = horizontalMinScale; return min(max(horizontalMinScale, verticalMinScale), m_viewportConstraints.maximumScale); } @@ -374,8 +381,11 @@ void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribut // if content is reloaded, contents size will not be changed // so, we need to calculate minimum scale here. // if content size is changed later, minimum scale will be re-calculated on didChangeContentsSize() - if (m_viewportConstraints.userScalable) + if (m_viewportConstraints.userScalable) { + if (fabs(m_viewportConstraints.initialScale - m_viewportConstraints.minimumScale) < numeric_limits::epsilon()) + m_viewportConstraints.initialScale = availableMinimumScale(); m_viewportConstraints.minimumScale = availableMinimumScale(); + } // setVisibleContentRect() should be called to adjust visible content rect only when view is resized if (!m_pageDidRendered || m_viewImpl->page()->estimatedProgress() <= 0.1)