Bug 679149 - VKB jumping too much on maemo r=dougt
authorOleg Romashin <romaxa@gmail.com>
Tue, 16 Aug 2011 09:27:36 -0700
changeset 75401 c377771c2ecdbf6a77f81f2e7632acea10cd17f2
parent 75400 ea0c9306ef4afdac7421331217e0450fd095724c
child 75402 47ae156df73fcd85dc5389c0d8ccd37e25fa20d3
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersdougt
bugs679149
milestone8.0a1
Bug 679149 - VKB jumping too much on maemo r=dougt
widget/src/qt/nsWindow.cpp
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -3087,19 +3087,32 @@ nsWindow::AreBoundsSane(void)
 }
 
 NS_IMETHODIMP
 nsWindow::SetInputMode(const IMEContext& aContext)
 {
     NS_ENSURE_TRUE(mWidget, NS_ERROR_FAILURE);
 
     mIMEContext = aContext;
+
+     // Ensure that opening the virtual keyboard is allowed for this specific
+     // IMEContext depending on the content.ime.strict.policy pref
+     if (aContext.mStatus != nsIWidget::IME_STATUS_DISABLED && 
+         aContext.mStatus != nsIWidget::IME_STATUS_PLUGIN) {
+       if (Preferences::GetBool("content.ime.strict_policy", PR_FALSE) &&
+           !aContext.FocusMovedByUser() &&
+           aContext.FocusMovedInContentProcess()) {
+         return NS_OK;
+       }
+     }
+
     switch (aContext.mStatus) {
         case nsIWidget::IME_STATUS_ENABLED:
         case nsIWidget::IME_STATUS_PASSWORD:
+        case nsIWidget::IME_STATUS_PLUGIN:
             {
                 PRInt32 openDelay =
                     Preferences::GetInt("ui.vkb.open.delay", 200);
                 mWidget->requestVKB(openDelay);
             }
             break;
         default:
             mWidget->hideVKB();