Title: [129544] trunk/Source/WebKit/blackberry
Revision
129544
Author
mifen...@rim.com
Date
2012-09-25 12:58:11 -0700 (Tue, 25 Sep 2012)

Log Message

[BlackBerry] When zooming into an input field take the current zoom level into account.
https://bugs.webkit.org/show_bug.cgi?id=97594

Reviewed by Antonio Gomes.

PR 188751.

Perform the zoom action prior to scroll to avoid breaking scrolling
rules.  Take the current scale into account when calculating the
zoom factor.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (129543 => 129544)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-09-25 19:55:15 UTC (rev 129543)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-09-25 19:58:11 UTC (rev 129544)
@@ -1,3 +1,19 @@
+2012-09-25  Mike Fenton  <mifen...@rim.com>
+
+        [BlackBerry] When zooming into an input field take the current zoom level into account.
+        https://bugs.webkit.org/show_bug.cgi?id=97594
+
+        Reviewed by Antonio Gomes.
+
+        PR 188751.
+
+        Perform the zoom action prior to scroll to avoid breaking scrolling
+        rules.  Take the current scale into account when calculating the
+        zoom factor.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible):
+
 2012-09-25  Nima Ghanavatian  <nghanavat...@rim.com>
 
         [BlackBerry] Handling required for multiple consecutive whitespace

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (129543 => 129544)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-09-25 19:55:15 UTC (rev 129543)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-09-25 19:58:11 UTC (rev 129544)
@@ -1050,11 +1050,31 @@
         break;
     }
     case VisibleSelection::NoSelection:
+        if (m_focusZoomScale) {
+            m_webPage->zoomAboutPoint(m_focusZoomScale, m_focusZoomLocation);
+            m_focusZoomScale = 0.0;
+            m_focusZoomLocation = WebCore::IntPoint();
+        }
         return;
     }
 
     int fontHeight = selectionFocusRect.height();
 
+    // If the text is too small, zoom in to make it a minimum size.
+    // The minimum size being defined as 3 mm is a good value based on my observations.
+    static const int s_minimumTextHeightInPixels = Graphics::Screen::primaryScreen()->heightInMMToPixels(3);
+
+    if (fontHeight && fontHeight * m_webPage->currentScale() < s_minimumTextHeightInPixels) {
+        if (!m_focusZoomScale) {
+            m_focusZoomScale = m_webPage->currentScale();
+            m_focusZoomLocation = selectionFocusRect.location();
+        }
+        m_webPage->zoomAboutPoint(s_minimumTextHeightInPixels / fontHeight, m_focusZoomLocation);
+    } else {
+        m_focusZoomScale = 0.0;
+        m_focusZoomLocation = WebCore::IntPoint();
+    }
+
     if (elementFrame != mainFrame) { // Element is in a subframe.
         // Remove any scroll offset within the subframe to get the point relative to the main frame.
         selectionFocusRect.move(-elementFrame->view()->scrollPosition().x(), -elementFrame->view()->scrollPosition().y());
@@ -1126,18 +1146,6 @@
             mainFrameView->setConstrainsScrollingToContentEdge(true);
         }
     }
-
-    // If the text is too small, zoom in to make it a minimum size.
-    // The minimum size being defined as 3 mm is a good value based on my observations.
-    static const int s_minimumTextHeightInPixels = Graphics::Screen::primaryScreen()->widthInMMToPixels(3);
-    if (fontHeight && fontHeight < s_minimumTextHeightInPixels) {
-        m_focusZoomScale = s_minimumTextHeightInPixels / fontHeight;
-        m_focusZoomLocation = selectionFocusRect.location();
-        m_webPage->zoomAboutPoint(m_focusZoomScale, m_focusZoomLocation);
-    } else {
-        m_focusZoomScale = 0.0;
-        m_focusZoomLocation = WebCore::IntPoint();
-    }
 }
 
 void InputHandler::ensureFocusPluginElementVisible()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to