Scale to 2.0 if target scale factor is same as current scale factor.
authorEunmi Lee <eunmi15.lee@samsung.com>
Thu, 18 Apr 2013 05:58:42 +0000 (14:58 +0900)
committerGerrit Code Review <gerrit2@kim11>
Thu, 18 Apr 2013 08:35:39 +0000 (17:35 +0900)
[Title] Scale to 2.0 if target scale factor is same as current scale factor.
[Issue#] P130416-3501
[Problem] We can not scale when we do double-tap in the left-bottom side of news.google.com.
[Cause] The target rect is same as contents rect in the left-bottom side of news.google.com.
[Solution] Scale to 2.0 if target scale factor is same as current scale factor.

Change-Id: I2ad0908aca4881ef94e3a4fe9da0ed26367330da

Source/WebKit2/UIProcess/API/efl/tizen/SmartZoom.cpp

index 9a9db66..4c17fc1 100755 (executable)
@@ -87,10 +87,19 @@ void SmartZoom::setZoomableArea(const IntPoint& target, const IntRect& area)
     targetRect.inflateX(s_widthMargin);
     FloatRect viewportRect(FloatPoint(), m_viewImpl->page()->viewSize());
     float targetScale = pageClientImpl->adjustScaleWithViewport(viewportRect.width() / targetRect.width());
-
-    FloatRect newContentsRect(targetRect.center(), FloatSize(viewportRect.width() / targetScale, viewportRect.height() / targetScale));
-    if (targetRect.height() > newContentsRect.height())
-        newContentsRect.setY(target.y());
+    FloatRect newContentsRect;
+
+    // Scale to 2.0 if target scale factor is same as current scale factor.
+    // If width of area is same as width of contents and contents is fitted to the viewport now,
+    // the current scale factor and target scale factor can be same.
+    if (fabs(pageClientImpl->scaleFactor() - targetScale) < numeric_limits<float>::epsilon()) {
+        targetScale = 2;
+        newContentsRect = FloatRect(target, FloatSize(viewportRect.width() / targetScale, viewportRect.height() / targetScale));
+    } else {
+        newContentsRect = FloatRect(targetRect.center(), FloatSize(viewportRect.width() / targetScale, viewportRect.height() / targetScale));
+        if (targetRect.height() > newContentsRect.height())
+            newContentsRect.setY(target.y());
+    }
     newContentsRect.move(-newContentsRect.width() / 2, -newContentsRect.height() / 2);
     newContentsRect.setLocation(pageClientImpl->boundContentsPositionAtScale(newContentsRect.location(), targetScale));
 
@@ -159,4 +168,4 @@ bool SmartZoom::process()
 bool SmartZoom::isWorking()
 {
     return m_scaleAnimator ? true : false;
-}
\ No newline at end of file
+}