From ca6127ea227f6809d9a1cb1fe58d55e888816763 Mon Sep 17 00:00:00 2001 From: Eunmi Lee Date: Thu, 18 Apr 2013 14:58:42 +0900 Subject: [PATCH] Scale to 2.0 if target scale factor is same as current scale factor. [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 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/SmartZoom.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/SmartZoom.cpp index 9a9db66..4c17fc1 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/SmartZoom.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/SmartZoom.cpp @@ -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::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 +} -- 2.7.4