Bug 805153 - Check with the focus manager if our *content* is already focused. r=roc a=lsblakk
authorMats Palmgren <matspal@gmail.com>
Mon, 05 Nov 2012 23:44:18 +0100
changeset 109775 07fe19d85b51178e8039e93588c21568aebae80d
parent 109774 6e071059b71c51ca6194137f0a3f30ef9f148608
child 109776 6c1314c972a41336ad0b41eed79e3e3f7c2527c2
push id1666
push usermpalmgren@mozilla.com
push dateMon, 05 Nov 2012 22:44:22 +0000
treeherdermozilla-beta@6c1314c972a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs805153
milestone17.0
Bug 805153 - Check with the focus manager if our *content* is already focused. r=roc a=lsblakk
layout/forms/nsComboboxControlFrame.cpp
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1,18 +1,19 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsComboboxControlFrame.h"
 #include "nsIDOMEventTarget.h"
+#include "nsFocusManager.h"
+#include "nsFormControlFrame.h"
 #include "nsFrameManager.h"
-#include "nsFormControlFrame.h"
 #include "nsGfxButtonControlFrame.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsHTMLParts.h"
 #include "nsIFormControl.h"
 #include "nsINameSpaceManager.h"
 #include "nsIDOMElement.h"
 #include "nsIListControlFrame.h"
@@ -977,17 +978,18 @@ nsComboboxControlFrame::ShowDropDown(boo
 {
   mDelayedShowDropDown = false;
   nsEventStates eventStates = mContent->AsElement()->State();
   if (aDoDropDown && eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
     return;
   }
 
   if (!mDroppedDown && aDoDropDown) {
-    if (sFocused == this) {
+    nsFocusManager* fm = nsFocusManager::GetFocusManager();
+    if (!fm || fm->GetFocusedContent() == GetContent()) {
       DropDownPositionState state = AbsolutelyPositionDropDown();
       if (state == eDropDownPositionFinal) {
         ShowList(aDoDropDown); // might destroy us
       } else if (state == eDropDownPositionPendingResize) {
         // Delay until after the resize reflow, see nsAsyncResize.
         mDelayedShowDropDown = true;
       }
     } else {