Fix unhandled case for adjustScaleWithViewport()
authorChanghyup Jwa <ch.jwa@samsung.com>
Mon, 7 Oct 2013 13:58:32 +0000 (22:58 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Tue, 8 Oct 2013 06:33:08 +0000 (06:33 +0000)
[Title] Fix unhandled case for adjustScaleWithViewport()
[Issue#] P130912-03310
[Problem] adjustScaleWithViewport() returns incorrectly adjusted value even
        it's inside the minimum and maximum scale factor range
[Cause] adjustScaleWithViewport() is not handling the case of maximum scale
        factor is smaller than minimum scale factor
[Solution] Consider minimum scale factor as a maximum scale factor if minimum
        scale factor is larger than maximum scale factor

Change-Id: I1724dbb3736e55ad4e9e5ca9fd3568caf59f95b6

Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp

index a2a07f3..235ce0d 100755 (executable)
@@ -183,7 +183,14 @@ PageClientImpl::ViewportConstraints PageClientImpl::computeViewportConstraints(c
 double PageClientImpl::adjustScaleWithViewport(double scale)
 {
     double minimumScale = min(m_viewportConstraints.minimumScale, m_viewportConstraints.maximumScale);
-    return clampTo(scale, minimumScale, m_viewportConstraints.maximumScale);
+    double maximumScale = max(m_viewportConstraints.minimumScale, m_viewportConstraints.maximumScale);
+#if ENABLE(TIZEN_DLOG_SUPPORT)
+    TIZEN_LOGI("range: [%f, %f], min/max: [%f, %f], result: [%f]"
+        , m_viewportConstraints.minimumScale, m_viewportConstraints.maximumScale
+        , minimumScale, maximumScale
+        , clampTo(scale, minimumScale, maximumScale));
+#endif
+    return clampTo(scale, minimumScale, maximumScale);
 }
 
 #if USE(TILED_BACKING_STORE) && ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)