Title: [141043] trunk/Source/WebKit/blackberry
Revision
141043
Author
[email protected]
Date
2013-01-28 20:41:48 -0800 (Mon, 28 Jan 2013)

Log Message

[BlackBerry] Small animated zoom level adjustments are unnecessary
https://bugs.webkit.org/show_bug.cgi?id=108104

Patch by Andrew Lo <[email protected]> on 2013-01-28
Reviewed by Rob Buis.
Internally reviewed by Mike Fenton.

Internal PR 285861.
If the difference between the target scale and current scale is
less than a given threshold, don't perform a zoom animation.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (141042 => 141043)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-01-29 04:38:18 UTC (rev 141042)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-01-29 04:41:48 UTC (rev 141043)
@@ -1,3 +1,18 @@
+2013-01-28  Andrew Lo  <[email protected]>
+
+        [BlackBerry] Small animated zoom level adjustments are unnecessary
+        https://bugs.webkit.org/show_bug.cgi?id=108104
+
+        Reviewed by Rob Buis.
+        Internally reviewed by Mike Fenton.
+
+        Internal PR 285861.
+        If the difference between the target scale and current scale is
+        less than a given threshold, don't perform a zoom animation.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible):
+
 2013-01-28  Nima Ghanavatian  <[email protected]>
 
         [BlackBerry] Reduce the region that is spellchecked on keystroke

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (141042 => 141043)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-01-29 04:38:18 UTC (rev 141042)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-01-29 04:41:48 UTC (rev 141043)
@@ -103,6 +103,8 @@
 namespace BlackBerry {
 namespace WebKit {
 
+static const float zoomAnimationThreshold = 0.5;
+
 class ProcessingChangeGuard {
 public:
     ProcessingChangeGuard(InputHandler* inputHandler)
@@ -1151,6 +1153,10 @@
     else
         zoomScaleRequired = m_webPage->currentScale(); // Don't scale.
 
+    // Zoom level difference must exceed the given threshold before we perform a zoom animation.
+    if (abs(zoomScaleRequired - m_webPage->currentScale()) < zoomAnimationThreshold)
+        zoomScaleRequired = m_webPage->currentScale(); // Don't scale.
+
     // The scroll location we should go to given the zoom required, could be adjusted later.
     WebCore::FloatPoint offset(selectionFocusRect.location().x() - m_webPage->scrollPosition().x(), selectionFocusRect.location().y() - m_webPage->scrollPosition().y());
     double inverseScale = zoomScaleRequired / m_webPage->currentScale();
@@ -1232,9 +1238,10 @@
 
     if (destinationScrollLocation != mainFrameView->scrollPosition() || zoomScaleRequired != m_webPage->currentScale()) {
         InputLog(Platform::LogLevelInfo,
-            "InputHandler::ensureFocusTextElementVisible zooming in to %f and scrolling to point %s",
-            zoomScaleRequired,
-            Platform::IntPoint(destinationScrollLocation).toString().c_str());
+            "InputHandler::ensureFocusTextElementVisible zooming in to %f from %f and scrolling to point %s from %s",
+            zoomScaleRequired, m_webPage->currentScale(),
+            Platform::IntPoint(destinationScrollLocation).toString().c_str(),
+            Platform::IntPoint(mainFrameView->scrollPosition()).toString().c_str());
 
         // Animate to given scroll position & zoom level
         m_webPage->m_finalBlockPoint = WebCore::FloatPoint(destinationScrollLocation);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to