Index: content/events/src/nsEventStateManager.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/events/src/nsEventStateManager.cpp,v
retrieving revision 1.595.2.28
diff -u -8 -p -r1.595.2.28 nsEventStateManager.cpp
--- content/events/src/nsEventStateManager.cpp	21 Nov 2006 05:21:38 -0000	1.595.2.28
+++ content/events/src/nsEventStateManager.cpp	3 Aug 2007 11:32:34 -0000
@@ -849,21 +849,23 @@ nsEventStateManager::PreHandleEvent(nsPr
 
       // Hold a strong ref to the focus controller, since we need
       // it after event dispatch.
       nsCOMPtr<nsIFocusController> focusController =
         win->GetRootFocusController();
       nsCOMPtr<nsIDOMElement> focusedElement;
       nsCOMPtr<nsIDOMWindowInternal> focusedWindow;
 
+      PRBool isScrollAlreadySuppressed;
       if (focusController) {
         // Obtain focus info from the focus controller.
         focusController->GetFocusedWindow(getter_AddRefs(focusedWindow));
         focusController->GetFocusedElement(getter_AddRefs(focusedElement));
 
+        focusController->GetSuppressFocusScroll(&isScrollAlreadySuppressed);
         focusController->SetSuppressFocusScroll(PR_TRUE);
         focusController->SetActive(PR_TRUE);
       }
 
       if (!focusedWindow)
         focusedWindow = win;
 
       NS_WARN_IF_FALSE(focusedWindow,"check why focusedWindow is null!!!");
@@ -896,26 +898,26 @@ nsEventStateManager::PreHandleEvent(nsPr
         // Make sure the focus controller is up-to-date, since restoring
         // focus memory may have caused focus to go elsewhere.
 
         if (gLastFocusedDocument && gLastFocusedDocument == mDocument) {
           nsCOMPtr<nsIDOMElement> focusElement = do_QueryInterface(mCurrentFocus);
           focusController->SetFocusedElement(focusElement);
         }
 
-        PRBool isSuppressed;
-        focusController->GetSuppressFocus(&isSuppressed);
-        while (isSuppressed) {
+        PRBool isFocusSuppressed;
+        focusController->GetSuppressFocus(&isFocusSuppressed);
+        while (isFocusSuppressed) {
           // Unsuppress and let the focus controller listen again.
           focusController->SetSuppressFocus(PR_FALSE,
                                             "Activation Suppression");
 
-          focusController->GetSuppressFocus(&isSuppressed);
+          focusController->GetSuppressFocus(&isFocusSuppressed);
         }
-        focusController->SetSuppressFocusScroll(PR_FALSE);
+        focusController->SetSuppressFocusScroll(isScrollAlreadySuppressed);
       }
     }
     break;
 
  case NS_DEACTIVATE:
     {
       EnsureDocument(aPresContext);
 
