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:43:44 +0100
changeset 113974 35607764ecd3f832242734c2d1e826e727235c73
parent 113973 20f1a116e3494fac6713ec32811a92ee05664685
child 113975 c82029001796b2ac2839cce1aee3b598f259bca6
push id2581
push usermpalmgren@mozilla.com
push dateMon, 05 Nov 2012 22:43:49 +0000
treeherdermozilla-aurora@c82029001796 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs805153
milestone18.0a2
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"
@@ -976,17 +977,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 {