Backing out bug 407359 because of orange
authoraaronleventhal@moonset.net
Tue, 22 Jan 2008 14:26:57 -0800
changeset 10542 1ba78cde1de58c6749b65b4f9e90a4e615632a1e
parent 10541 42b8c66d584807df185be1ef3c80b68a91102049
child 10543 169df77a8fd3f782c6391b33f978df8ab92e9da1
push idunknown
push userunknown
push dateunknown
bugs407359
milestone1.9b3pre
Backing out bug 407359 because of orange
accessible/public/nsIAccessibleProvider.idl
accessible/public/nsIAccessibleRole.idl
accessible/src/atk/nsRoleMap.h
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessibilityService.h
accessible/src/base/nsCaretAccessible.cpp
accessible/src/base/nsOuterDocAccessible.cpp
accessible/src/base/nsRootAccessible.cpp
accessible/src/mac/nsRoleMap.h
accessible/src/msaa/nsRoleMap.h
accessible/src/xul/nsXULAlertAccessible.cpp
accessible/src/xul/nsXULAlertAccessible.h
accessible/src/xul/nsXULMenuAccessible.cpp
accessible/src/xul/nsXULSelectAccessible.cpp
accessible/src/xul/nsXULTextAccessible.cpp
browser/base/content/browser-places.js
browser/base/content/browser.js
browser/base/content/browser.xul
browser/themes/gnomestripe/browser/browser.css
browser/themes/pinstripe/browser/browser.css
browser/themes/winstripe/browser/browser.css
toolkit/content/widgets/autocomplete.xml
toolkit/content/widgets/popup.xml
toolkit/content/widgets/textbox.xml
--- a/accessible/public/nsIAccessibleProvider.idl
+++ b/accessible/public/nsIAccessibleProvider.idl
@@ -47,22 +47,16 @@
 
 [scriptable, uuid(3f7f9194-c625-4a85-8148-6d92d34897fa)]
 interface nsIAccessibleProvider : nsISupports
 {
   /**
    * Constants set of common use.
    */
 
-  /** Do not create an accessible for this object
-   * This is useful if an ancestor binding already implements nsIAccessibleProvider,
-   * but no accessible is desired for the inheriting binding
-   */
-  const long NoAccessible = 0;
-
   /** For elements that spawn a new document. For example now it is used by
     <xul:iframe>, <xul:browser> and <xul:editor>. */
   const long OuterDoc = 0x00000001;
 
   /**
    * Constants set is used by XUL controls.
    */
 
@@ -79,43 +73,42 @@ interface nsIAccessibleProvider : nsISup
   const long XULListbox = 0x0000100B;
   const long XULListitem = 0x0000100C;
   const long XULListHead = 0x00001024;
   const long XULListHeader = 0x00001025;
   const long XULMenubar = 0x0000100D;
   const long XULMenuitem = 0x0000100E;
   const long XULMenupopup = 0x0000100F;
   const long XULMenuSeparator = 0x00001010;
-  const long XULPane    = 0x00001011;
-  const long XULProgressMeter = 0x00001012;
-  const long XULScale = 0x00001013;
-  const long XULStatusBar = 0x00001014;
-  const long XULRadioButton = 0x00001015;
-  const long XULRadioGroup = 0x00001016;
+  const long XULProgressMeter = 0x00001011;
+  const long XULScale = 0x00001012;
+  const long XULStatusBar = 0x00001013;
+  const long XULRadioButton = 0x00001014;
+  const long XULRadioGroup = 0x00001015;
 
   /** The single tab in a dialog or tabbrowser/editor interface */
-  const long XULTab = 0x00001017;
+  const long XULTab = 0x00001016;
 
   /** A combination of a tabs object and a tabpanels object */
-  const long XULTabBox = 0x00001018;
+  const long XULTabBox = 0x00001017;
 
   /** The collection of tab objects, useable in the TabBox and independant of
    as well */
-  const long XULTabs = 0x00001019;
+  const long XULTabs = 0x00001018;
 
-  const long XULText             = 0x0000101A;
-  const long XULTextBox          = 0x0000101B;
-  const long XULThumb            = 0x0000101C;
-  const long XULTree             = 0x0000101D;
-  const long XULTreeColumns      = 0x0000101E;
-  const long XULTreeColumnItem   = 0x0000101F;
-  const long XULToolbar          = 0x00001020;
-  const long XULToolbarSeparator = 0x00001021;
-  const long XULTooltip          = 0x00001022;
-  const long XULToolbarButton    = 0x00001023;
+  const long XULText             = 0x00001019;
+  const long XULTextBox          = 0x0000101A;
+  const long XULThumb            = 0x0000101B;
+  const long XULTree             = 0x0000101C;
+  const long XULTreeColumns      = 0x0000101D;
+  const long XULTreeColumnItem   = 0x0000101E;
+  const long XULToolbar          = 0x0000101F;
+  const long XULToolbarSeparator = 0x00001020;
+  const long XULTooltip          = 0x00001021;
+  const long XULToolbarButton    = 0x00001022;
 
 
   /**
    * Constants set is used by XForms elements.
    */
 
   /** Used for xforms elements that provide accessible object for itself as
    * well for anonymous content. This property are used for upload,
--- a/accessible/public/nsIAccessibleRole.idl
+++ b/accessible/public/nsIAccessibleRole.idl
@@ -105,19 +105,19 @@ interface nsIAccessibleRole : nsISupport
   /**
    * Represents the window frame, which contains child objects such as
    * a title bar, client, and other objects contained in a window. The role
    * is supported automatically by MS Windows.
    */
   const unsigned long ROLE_WINDOW = 9;
 
   /**
-   * A sub-document (<frame> or <iframe>)
+   * XXX: document this.
    */
-  const unsigned long ROLE_INTERNAL_FRAME = 10;
+  const unsigned long ROLE_CLIENT = 10;
 
   /**
    * Represents a menu, which presents a list of options from which the user can
    * make a selection to perform an action. It is used for role="menu".
    */
   const unsigned long ROLE_MENUPOPUP = 11;
 
   /**
--- a/accessible/src/atk/nsRoleMap.h
+++ b/accessible/src/atk/nsRoleMap.h
@@ -51,17 +51,17 @@ static const PRUint32 atkRoleMap[] = {
     ATK_ROLE_MENU_BAR,            // nsIAccessibleRole::ROLE_MENUBAR              2
     ATK_ROLE_SCROLL_BAR,          // nsIAccessibleRole::ROLE_SCROLLBAR            3
     ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_GRIP                 4
     ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_SOUND                5
     ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_CURSOR               6
     ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_CARET                7
     ATK_ROLE_ALERT,               // nsIAccessibleRole::ROLE_ALERT                8
     ATK_ROLE_WINDOW,              // nsIAccessibleRole::ROLE_WINDOW               9
-    ATK_ROLE_INTERNAL_FRAME,      // nsIAccessibleRole::ROLE_INTERNAL_FRAME       10
+    ATK_ROLE_PANEL,               // nsIAccessibleRole::ROLE_CLIENT               10
     ATK_ROLE_MENU,                // nsIAccessibleRole::ROLE_MENUPOPUP            11
     ATK_ROLE_MENU_ITEM,           // nsIAccessibleRole::ROLE_MENUITEM             12
     ATK_ROLE_TOOL_TIP,            // nsIAccessibleRole::ROLE_TOOLTIP              13
     ATK_ROLE_EMBEDDED,            // nsIAccessibleRole::ROLE_APPLICATION          14
     ATK_ROLE_DOCUMENT_FRAME,      // nsIAccessibleRole::ROLE_DOCUMENT             15
     ATK_ROLE_PANEL,               // nsIAccessibleRole::ROLE_PANE                 16
     ATK_ROLE_CHART,               // nsIAccessibleRole::ROLE_CHART                17
     ATK_ROLE_DIALOG,              // nsIAccessibleRole::ROLE_DIALOG               18
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1625,18 +1625,16 @@ nsresult nsAccessibilityService::GetAcce
     return CreateOuterDocAccessible(aNode, aAccessible);
 
   nsCOMPtr<nsIWeakReference> weakShell;
   GetShellFromNode(aNode, getter_AddRefs(weakShell));
 
   switch (type)
   {
 #ifdef MOZ_XUL
-    case nsIAccessibleProvider::NoAccessible:
-      return NS_OK;
     // XUL controls
     case nsIAccessibleProvider::XULAlert:
       *aAccessible = new nsXULAlertAccessible(aNode, weakShell);
       break;
     case nsIAccessibleProvider::XULButton:
       *aAccessible = new nsXULButtonAccessible(aNode, weakShell);
       break;
     case nsIAccessibleProvider::XULCheckbox:
@@ -1711,19 +1709,16 @@ nsresult nsAccessibilityService::GetAcce
       }
 #endif
       *aAccessible = new nsXULMenupopupAccessible(aNode, weakShell);
       break;
     }
     case nsIAccessibleProvider::XULMenuSeparator:
       *aAccessible = new nsXULMenuSeparatorAccessible(aNode, weakShell);
       break;
-    case nsIAccessibleProvider::XULPane:
-      *aAccessible = new nsEnumRoleAccessible(aNode, weakShell, nsIAccessibleRole::ROLE_PANE);
-      break;
     case nsIAccessibleProvider::XULProgressMeter:
       *aAccessible = new nsXULProgressMeterAccessible(aNode, weakShell);
       break;
     case nsIAccessibleProvider::XULStatusBar:
       *aAccessible = new nsXULStatusBarAccessible(aNode, weakShell);
       break;
     case nsIAccessibleProvider::XULScale:
       *aAccessible = new nsXULSliderAccessible(aNode, weakShell);
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -147,17 +147,17 @@ static const char kRoleNames[][20] = {
   "menubar",             //ROLE_MENUBAR
   "scrollbar",           //ROLE_SCROLLBAR 
   "grip",                //ROLE_GRIP
   "sound",               //ROLE_SOUND
   "cursor",              //ROLE_CURSOR
   "caret",               //ROLE_CARET
   "alert",               //ROLE_ALERT
   "window",              //ROLE_WINDOW
-  "internal frame",      //ROLE_INTERNAL_FRAME
+  "client",              //ROLE_CLIENT
   "menupopup",           //ROLE_MENUPOPUP
   "menuitem",            //ROLE_MENUITEM
   "tooltip",             //ROLE_TOOLTIP
   "application",         //ROLE_APPLICATION
   "document",            //ROLE_DOCUMENT
   "pane",                //ROLE_PANE
   "chart",               //ROLE_CHART
   "dialog",              //ROLE_DIALOG
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -166,17 +166,17 @@ NS_IMETHODIMP nsCaretAccessible::NotifyS
 
   mLastUsedSelection = do_GetWeakReference(aSel);
 
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
   NS_ENSURE_TRUE(doc, NS_OK);
   nsIPresShell *presShell = doc->GetPrimaryShell();
   NS_ENSURE_TRUE(presShell, NS_OK);
 
-  // Get first nsIAccessibleText in parent chain and fire caret-move, selection-change event for it
+  // Get first nnsIAccessibleText in parent chain and fire caret-move, selection-change event for it
   nsCOMPtr<nsIAccessible> accessible;
   nsIAccessibilityService *accService = mRootAccessible->GetAccService();
   NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
   // Get accessible from selection's focus node or its parent
   nsCOMPtr<nsIDOMNode> focusNode;
   aSel->GetFocusNode(getter_AddRefs(focusNode));
   if (!focusNode) {
     mLastTextAccessible = nsnull;
--- a/accessible/src/base/nsOuterDocAccessible.cpp
+++ b/accessible/src/base/nsOuterDocAccessible.cpp
@@ -69,17 +69,17 @@ NS_IMETHODIMP nsOuterDocAccessible::GetN
     }
   }
   return rv;
 }
 
 /* unsigned long getRole (); */
 NS_IMETHODIMP nsOuterDocAccessible::GetRole(PRUint32 *aRole)
 {
-  *aRole = nsIAccessibleRole::ROLE_INTERNAL_FRAME;
+  *aRole = nsIAccessibleRole::ROLE_CLIENT;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsOuterDocAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsAccessible::GetState(aState, aExtraState);
   *aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -592,19 +592,16 @@ NS_IMETHODIMP nsRootAccessible::HandleEv
 
 nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
                                                  nsIDOMNode* aTargetNode)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
   nsAutoString localName;
   aTargetNode->GetLocalName(localName);
-#ifdef MOZ_XUL
-  PRBool isTree = localName.EqualsLiteral("tree");
-#endif
 #ifdef DEBUG_A11Y
   // Very useful for debugging, please leave this here.
   if (eventType.EqualsLiteral("AlertActive")) {
     printf("\ndebugging %s events for %s", NS_ConvertUTF16toUTF8(eventType).get(), NS_ConvertUTF16toUTF8(localName).get());
   }
   if (localName.LowerCaseEqualsLiteral("textbox")) {
     printf("\ndebugging %s events for %s", NS_ConvertUTF16toUTF8(eventType).get(), NS_ConvertUTF16toUTF8(localName).get());
   }
@@ -640,60 +637,35 @@ nsresult nsRootAccessible::HandleEventWi
   if (eventType.EqualsLiteral("DOMContentLoaded")) {
     // Don't create the doc accessible until load scripts have a chance to set
     // role attribute for <body> or <html> element, because the value of 
     // role attribute will be cached when the doc accessible is Init()'d
     TryFireEarlyLoadEvent(aTargetNode);
     return NS_OK;
   }
 
-#ifdef MOZ_XUL
   if (eventType.EqualsLiteral("TreeViewChanged")) { // Always asynch, always from user input
-    if (!isTree)
+    if (!localName.EqualsLiteral("tree"))
       return NS_OK;
 
     nsCOMPtr<nsIContent> treeContent = do_QueryInterface(aTargetNode);
     nsAccEvent::PrepareForEvent(aTargetNode, PR_TRUE);
     return accService->InvalidateSubtreeFor(eventShell, treeContent,
                                             nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE);
   }
-#endif
-
-  if (eventType.EqualsLiteral("popuphiding")) {
-    // If accessible focus was on or inside popup that closes,
-    // then restore it to true current focus.
-    // This is the case when we've been getting DOMMenuItemActive events
-    // inside of a combo box that closes. The real focus is on the combo box.
-    // It's also the case when a popup gets focus in ATK -- when it closes
-    // we need to fire an event to restore focus to where it was
-    if (!gLastFocusedNode) {
-      return NS_OK;
-    }
-    if (gLastFocusedNode != aTargetNode) {
-      // Was not focused on popup
-      nsCOMPtr<nsIDOMNode> parentOfFocus;
-      gLastFocusedNode->GetParentNode(getter_AddRefs(parentOfFocus));
-      if (parentOfFocus != aTargetNode) {
-        return NS_OK;  // And was not focused on an item inside the popup
-      }
-    }
-    // Focus was on or inside of a popup that's being hidden
-    FireCurrentFocusEvent();
-  }
 
   nsCOMPtr<nsIAccessible> accessible;
   accService->GetAccessibleInShell(aTargetNode, eventShell,
                                    getter_AddRefs(accessible));
   nsCOMPtr<nsPIAccessible> privAcc(do_QueryInterface(accessible));
   if (!privAcc)
     return NS_OK;
 
-#ifdef MOZ_XUL
   if (eventType.EqualsLiteral("TreeRowCountChanged")) {
-    if (!isTree)
+    if (!localName.EqualsLiteral("tree"))
       return NS_OK;
 
     nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent));
     NS_ENSURE_STATE(dataEvent);
 
     nsCOMPtr<nsIVariant> indexVariant;
     dataEvent->GetData(NS_LITERAL_STRING("index"),
                        getter_AddRefs(indexVariant));
@@ -708,17 +680,16 @@ nsresult nsRootAccessible::HandleEventWi
     indexVariant->GetAsInt32(&index);
     countVariant->GetAsInt32(&count);
 
     nsCOMPtr<nsIAccessibleTreeCache> treeAccCache(do_QueryInterface(accessible));
     NS_ENSURE_STATE(treeAccCache);
 
     return treeAccCache->InvalidateCache(index, count);
   }
-#endif
 
   if (eventType.EqualsLiteral("RadioStateChange")) {
     PRUint32 state = State(accessible);
 
     // radiogroup in prefWindow is exposed as a list,
     // and panebutton is exposed as XULListitem in A11y.
     // nsXULListitemAccessible::GetState uses STATE_SELECTED in this case,
     // so we need to check nsIAccessibleStates::STATE_SELECTED also.
@@ -747,17 +718,17 @@ nsresult nsRootAccessible::HandleEventWi
                                 PR_FALSE, isEnabled);
 
     return privAcc->FireAccessibleEvent(accEvent);
   }
 
   nsCOMPtr<nsIAccessible> treeItemAccessible;
 #ifdef MOZ_XUL
   // If it's a tree element, need the currently selected item
-  if (isTree) {
+  if (localName.EqualsLiteral("tree")) {
     nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
       do_QueryInterface(aTargetNode);
     if (multiSelect) {
       PRInt32 treeIndex = -1;
       multiSelect->GetCurrentIndex(&treeIndex);
       if (treeIndex >= 0) {
         nsCOMPtr<nsIAccessibleTreeCache> treeCache(do_QueryInterface(accessible));
         if (!treeCache ||
@@ -871,29 +842,46 @@ nsresult nsRootAccessible::HandleEventWi
       // AT's expect to get an EVENT_SHOW for the tooltip. 
       // In event callback the tooltip's accessible will be ready.
       event = nsIAccessibleEvent::EVENT_ASYNCH_SHOW;
     }
     if (event) {
       nsAccUtils::FireAccEvent(event, accessible);
     }
   }
+
+  else if (eventType.EqualsLiteral("popuphiding")) {
+    // If accessible focus was on or inside popup that closes,
+    // then restore it to true current focus.
+    // This is the case when we've been getting DOMMenuItemActive events
+    // inside of a combo box that closes. The real focus is on the combo box.
+    // It's also the case when a popup gets focus in ATK -- when it closes
+    // we need to fire an event to restore focus to where it was
+    if (!gLastFocusedNode) {
+      return NS_OK;
+    }
+    if (gLastFocusedNode != aTargetNode) {
+      // Was not focused on popup
+      nsCOMPtr<nsIDOMNode> parentOfFocus;
+      gLastFocusedNode->GetParentNode(getter_AddRefs(parentOfFocus));
+      if (parentOfFocus != aTargetNode) {
+        return NS_OK;  // And was not focused on an item inside the popup
+      }
+    }
+    // Focus was on or inside of a popup that's being hidden
+    FireCurrentFocusEvent();
+  }
   else if (eventType.EqualsLiteral("DOMMenuInactive")) {
     if (Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) {
       nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
                                accessible);
     }
   }
   else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
     if (!treeItemAccessible) {
-#ifdef MOZ_XUL
-      if (isTree) {
-        return NS_OK; // Tree with nothing selected
-      }
-#endif
       nsCOMPtr<nsPIAccessNode> menuAccessNode = do_QueryInterface(accessible);
       NS_ENSURE_TRUE(menuAccessNode, NS_ERROR_FAILURE);
       nsIFrame* menuFrame = menuAccessNode->GetFrame();
       NS_ENSURE_TRUE(menuFrame, NS_ERROR_FAILURE);
       nsIMenuFrame* imenuFrame;
       CallQueryInterface(menuFrame, &imenuFrame);
       // QI failed for nsIMenuFrame means it's not on menu bar
       if (imenuFrame && imenuFrame->IsOnMenuBar() &&
--- a/accessible/src/mac/nsRoleMap.h
+++ b/accessible/src/mac/nsRoleMap.h
@@ -47,17 +47,17 @@ static const NSString* AXRoles [] = {
   NSAccessibilityMenuBarRole,                   // ROLE_MENUBAR. (irrelevant on OS X; the menubar will always be native and on the top of the screen.)
   NSAccessibilityScrollBarRole,                 // ROLE_SCROLLBAR. we might need to make this its own mozAccessible, to support the children objects (valueindicator, down/up buttons).
   NSAccessibilitySplitterRole,                  // ROLE_GRIP
   NSAccessibilityUnknownRole,                   // ROLE_SOUND. unused on OS X
   NSAccessibilityUnknownRole,                   // ROLE_CURSOR. unused on OS X
   NSAccessibilityUnknownRole,                   // ROLE_CARET. unused on OS X
   NSAccessibilityWindowRole,                    // ROLE_ALERT
   NSAccessibilityWindowRole,                    // ROLE_WINDOW. irrelevant on OS X; all window a11y is handled by the system.
-  @"AXWebArea",                                 // ROLE_INTERNAL_FRAME
+  @"AXWebArea",                                 // ROLE_CLIENT
   NSAccessibilityMenuRole,                      // ROLE_MENUPOPUP. the parent of menuitems
   NSAccessibilityMenuItemRole,                  // ROLE_MENUITEM.
   @"AXHelpTag",                                 // ROLE_TOOLTIP. 10.4+ only, so we re-define the constant.
   NSAccessibilityGroupRole,                     // ROLE_APPLICATION. unused on OS X. the system will take care of this.
   NSAccessibilityGroupRole,                     // ROLE_DOCUMENT
   NSAccessibilityGroupRole,                     // ROLE_PANE
   NSAccessibilityUnknownRole,                   // ROLE_CHART
   NSAccessibilityWindowRole,                    // ROLE_DIALOG. there's a dialog subrole.
--- a/accessible/src/msaa/nsRoleMap.h
+++ b/accessible/src/msaa/nsRoleMap.h
@@ -90,18 +90,18 @@ static const WindowsRoleMapItem gWindows
   { ROLE_SYSTEM_CARET, ROLE_SYSTEM_CARET },
 
   // nsIAccessibleRole::ROLE_ALERT
   { ROLE_SYSTEM_ALERT, ROLE_SYSTEM_ALERT },
 
   // nsIAccessibleRole::ROLE_WINDOW
   { ROLE_SYSTEM_WINDOW, ROLE_SYSTEM_WINDOW },
 
-  // nsIAccessibleRole::ROLE_INTERNAL_FRAME
-  { USE_ROLE_STRING, IA2_ROLE_INTERNAL_FRAME},
+  // nsIAccessibleRole::ROLE_CLIENT
+  { USE_ROLE_STRING, IA2_ROLE_UNKNOWN},
 
   // nsIAccessibleRole::ROLE_MENUPOPUP
   { ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
 
   // nsIAccessibleRole::ROLE_MENUITEM
   { ROLE_SYSTEM_MENUITEM, ROLE_SYSTEM_MENUITEM },
 
   // nsIAccessibleRole::ROLE_TOOLTIP
@@ -424,17 +424,17 @@ static const WindowsRoleMapItem gWindows
 
   // nsIAccessibleRole::ROLE_IMAGE_MAP
   { ROLE_SYSTEM_GRAPHIC, ROLE_SYSTEM_GRAPHIC },
 
   // nsIAccessibleRole::ROLE_OPTION 
   { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
   
   // nsIAccessibleRole::ROLE_RICH_OPTION
-  { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
+  { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
   
   // nsIAccessibleRole::ROLE_LISTBOX
   { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
   
   // nsIAccessibleRole::ROLE_LAST_ENTRY
   { ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
 };
 
--- a/accessible/src/xul/nsXULAlertAccessible.cpp
+++ b/accessible/src/xul/nsXULAlertAccessible.cpp
@@ -59,16 +59,8 @@ nsXULAlertAccessible::GetState(PRUint32 
   nsresult rv = nsAccessible::GetState(aState, aExtraState);
   NS_ENSURE_SUCCESS(rv, rv);
   if (mDOMNode) {
     *aState |= nsIAccessibleStates::STATE_ALERT_MEDIUM; // XUL has no markup for low, medium or high
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsXULAlertAccessible::GetName(nsAString& aName)
-{
-  // Screen readers need to read contents of alert, not the accessible name.
-  // If we have both some screen readers will read the alert twice.
-  aName.Truncate();
-  return NS_OK;
-}
--- a/accessible/src/xul/nsXULAlertAccessible.h
+++ b/accessible/src/xul/nsXULAlertAccessible.h
@@ -45,12 +45,11 @@
 
 class nsXULAlertAccessible : public nsAccessibleWrap
 {
 public:
   nsXULAlertAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
   NS_DECL_ISUPPORTS_INHERITED
   NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
-  NS_IMETHOD GetName(nsAString& aName);
 };
 
 #endif  
--- a/accessible/src/xul/nsXULMenuAccessible.cpp
+++ b/accessible/src/xul/nsXULMenuAccessible.cpp
@@ -481,19 +481,17 @@ nsXULMenuitemAccessible::GetDefaultKeyBi
 NS_IMETHODIMP nsXULMenuitemAccessible::GetRole(PRUint32 *aRole)
 {
   nsCOMPtr<nsIDOMXULContainerElement> xulContainer(do_QueryInterface(mDOMNode));
   if (xulContainer) {
     *aRole = nsIAccessibleRole::ROLE_PARENT_MENUITEM;
     return NS_OK;
   }
 
-  nsCOMPtr<nsIAccessible> parent;
-  GetParent(getter_AddRefs(parent));
-  if (parent && Role(parent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
+  if (mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
     *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
     return NS_OK;
   }
 
   *aRole = nsIAccessibleRole::ROLE_MENUITEM;
   nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
   if (!element)
     return NS_ERROR_FAILURE;
@@ -713,28 +711,24 @@ nsXULMenupopupAccessible::GetName(nsAStr
 }
 
 NS_IMETHODIMP nsXULMenupopupAccessible::GetRole(PRUint32 *aRole)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
   if (!content) {
     return NS_ERROR_FAILURE;
   }
-  nsCOMPtr<nsIAccessible> parent;
-  GetParent(getter_AddRefs(parent));
-  if (parent) {
-    // Some widgets like the search bar have several popups, owned by buttons
-    PRUint32 role = Role(parent);
-    if (role == nsIAccessibleRole::ROLE_COMBOBOX ||
-        role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
-      *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-      return NS_OK;
-    }
+  if ((mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX) ||
+      content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
+                           nsAccessibilityAtoms::autocomplete, eIgnoreCase)) {
+    *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
   }
-  *aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
+  else {
+    *aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
+  }
   return NS_OK;
 }
 
 // ------------------------ Menu Bar -----------------------------
 
 nsXULMenubarAccessible::nsXULMenubarAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell): 
   nsAccessibleWrap(aDOMNode, aShell)
 { 
--- a/accessible/src/xul/nsXULSelectAccessible.cpp
+++ b/accessible/src/xul/nsXULSelectAccessible.cpp
@@ -36,17 +36,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsXULSelectAccessible.h"
 #include "nsAccessibilityService.h"
 #include "nsIContent.h"
 #include "nsIDOMXULMenuListElement.h"
-#include "nsIDOMXULPopupElement.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDOMXULSelectCntrlEl.h"
 #include "nsIDOMXULTextboxElement.h"
 #include "nsIPresShell.h"
 #include "nsIServiceManager.h"
 #include "nsCaseTreatment.h"
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -190,30 +189,19 @@ NS_IMETHODIMP nsXULListboxAccessible::Ge
     nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
     select->GetSelectedItem(getter_AddRefs(selectedItem));
     if (selectedItem)
       return selectedItem->GetLabel(_retval);
   }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsXULListboxAccessible::GetRole(PRUint32 *aRole)
+NS_IMETHODIMP nsXULListboxAccessible::GetRole(PRUint32 *_retval)
 {
-  nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
-  if (content) {
-    // A richlistbox is used with the new autocomplete URL bar,
-    // and has a parent popup <panel>
-    nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
-      do_QueryInterface(content->GetParent());
-    if (xulPopup) {
-      *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-      return NS_OK;
-    }
-  }
-  *aRole = nsIAccessibleRole::ROLE_LIST;
+  *_retval = nsIAccessibleRole::ROLE_LIST;
   return NS_OK;
 }
 
 /** ----- nsXULListitemAccessible ----- */
 
 /** Constructor */
 nsXULListitemAccessible::nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
 nsXULMenuitemAccessible(aDOMNode, aShell)
@@ -257,18 +245,16 @@ NS_IMETHODIMP nsXULListitemAccessible::G
 
 /**
   *
   */
 NS_IMETHODIMP nsXULListitemAccessible::GetRole(PRUint32 *aRole)
 {
   if (mIsCheckbox)
     *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
-  else if (mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
-    *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
   else
     *aRole = nsIAccessibleRole::ROLE_RICH_OPTION;
   return NS_OK;
 }
 
 /**
   *
   */
--- a/accessible/src/xul/nsXULTextAccessible.cpp
+++ b/accessible/src/xul/nsXULTextAccessible.cpp
@@ -56,19 +56,23 @@ nsHyperTextAccessibleWrap(aDomNode, aShe
 
 /* wstring getName (); */
 NS_IMETHODIMP nsXULTextAccessible::GetName(nsAString& aName)
 { 
   nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
   if (!content) {
     return NS_ERROR_FAILURE;  // Node shut down
   }
-  // if the value attr doesn't exist, the screen reader must get the accessible text
-  // from the accessible text interface or from the children
-  return content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName);
+  if (!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value,
+                        aName)) {
+    // if the value doesn't exist, flatten the inner content as the name (for descriptions)
+    return AppendFlatStringFromSubtree(content, &aName);
+  }
+  // otherwise, use the value attribute as the name (for labels)
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULTextAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -167,19 +171,23 @@ NS_IMETHODIMP nsXULLinkAccessible::GetNa
     return AppendFlatStringFromSubtree(content, &aName);
   }
   // otherwise, use the value attribute as the name (for labels)
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULLinkAccessible::GetRole(PRUint32 *aRole)
 {
-  // We used to say ROLE_BUTTON if there was no href, but then screen readers
-  // would tell users to hit the space bar for activation, which is wrong for a link
-  *aRole = nsIAccessibleRole::ROLE_LINK;
+  if (mIsLink) {
+    *aRole = nsIAccessibleRole::ROLE_LINK;
+  } else {
+    // default to calling the link a button; might have javascript
+    *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
+  }
+  // should there be a third case where it becomes just text?
   return NS_OK;
 }
 
 void nsXULLinkAccessible::CacheActionContent()
 {
   // not a link if no content
   nsCOMPtr<nsIContent> mTempContent = do_QueryInterface(mDOMNode);
   if (!mTempContent) {
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -92,18 +92,21 @@ var PlacesCommandHook = {
       case "popuphidden":
         if (aEvent.originalTarget == this.panel) {
           gEditItemOverlay.uninitPanel(true);
           this._restoreCommandsState();
         }
         break;
       case "keypress":
         if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE ||
-            aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
-          this.panel.hidePopup(); // hide the panel
+            aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
+          // focus the content area and hide the panel
+          window.content.focus();
+          this.panel.hidePopup();
+        }
         break;
     }
   },
 
   _overlayLoaded: false,
   _overlayLoading: false,
   showEditBookmarkPopup:
   function PCH_showEditBookmarkPopup(aItemId, aAnchorElement, aPosition) {
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1498,30 +1498,23 @@ function loadOneOrMoreURIs(aURIString)
   // so that we don't disrupt startup
   try {
     gBrowser.loadTabs(aURIString.split("|"), false, true);
   } 
   catch (e) {
   }
 }
 
-function focusAndSelectUrlBar()
+function openLocation()
 {
   if (gURLBar && isElementVisible(gURLBar) && !gURLBar.readOnly) {
     gURLBar.focus();
     gURLBar.select();
-    return true;
+    return;
   }
-  return false;
-}
-
-function openLocation()
-{
-  if (focusAndSelectUrlBar())
-    return;
 #ifdef XP_MACOSX
   if (window.location.href != getBrowserURL()) {
     var win = getTopWin();
     if (win) {
       // If there's an open browser window, it should handle this command
       win.focus()
       win.openLocation();
     }
@@ -5753,33 +5746,26 @@ IdentityHandler.prototype = {
       body = this._stringBundle.getString("identity.unknown.body");
     }
     
     // Push the appropriate strings out to the UI
     this._identityPopupContent.textContent = body;
     this._identityPopupContentSupp.textContent = supplemental;
     this._identityPopupContentVerif.textContent = verifier;
   },
-
-  hideIdentityPopup : function() {
-    this._identityPopup.hidePopup();
-  },
-
+  
   /**
    * Click handler for the identity-box element in primary chrome.  
    */
-  handleIdentityButtonEvent : function(event) {
-  
+  handleIdentityClick : function(event) {
     event.stopPropagation();
- 
-    if ((event.type == "click" && event.button != 0) ||
-        (event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE &&
-         event.keyCode != KeyEvent.DOM_VK_RETURN))
-      return; // Left click, space or enter only
-
+
+    if (event.button != 0)
+      return; // We only want left-clicks
+        
     // Make sure that the display:none style we set in xul is removed now that
     // the popup is actually needed
     this._identityPopup.hidden = false;
     
     // Tell the popup to consume dismiss clicks, to avoid bug 395314
     this._identityPopup.popupBoxObject
         .setConsumeRollupEvent(Ci.nsIPopupBoxObject.ROLLUP_CONSUME);
     
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -101,18 +101,17 @@
 
     <!-- for search and content formfill/pw manager -->
     <panel type="autocomplete" chromedir="&locale.dir;" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
 
     <!-- for url bar autocomplete -->
     <panel type="autocomplete-richlistbox" chromedir="&locale.dir;" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/>
 
     <panel id="editBookmarkPanel" orient="vertical" hidden="true"
-           onpopupshown="PlacesCommandHook.editBookmarkPanelShown();"
-           label="&bookmarkPageCmd2.label;">
+           onpopupshown="PlacesCommandHook.editBookmarkPanelShown();">
       <vbox id="editBookmarkPanelContent" flex="1"/>
       <hbox flex="1">
         <spacer flex="1"/>
         <button id="editBookmarkPanelDeleteButton"
                 label="&editBookmark.delete.label;"
                 oncommand="PlacesCommandHook.deleteButtonOnCommand();"/>
         <button id="editBookmarkPanelDoneButton"
                 label="&editBookmark.done.label;"
@@ -141,41 +140,38 @@
            onpopupshowing="if (event.target != this) return true; gContextMenu = new nsContextMenu(this, window.getBrowser()); return gContextMenu.shouldDisplay;"
            onpopuphiding="if (event.target == this) { gContextMenu = null; }">
 #include browser-context.inc
     </popup>
 
     <popup id="placesContext"/>
 
     <!-- Popup for site identity information -->
-    <panel id="identity-popup" position="after_start" hidden="true" noautofocus="true"
-           onpopupshown="document.getElementById('identity-popup-more-info-link').focus();"
-           onpopuphidden="focusAndSelectUrlBar();" norestorefocus="true">
+    <panel id="identity-popup" position="after_start" hidden="true" noautofocus="true">
       <hbox id="identity-popup-container" align="top">
         <image id="identity-popup-icon"/>
         <vbox id="identity-popup-content-box">
           <!-- Title Bar -->
-          <label id="identity-popup-title" control="identity-popup"/>
+          <label id="identity-popup-title"/>
           <!-- Content area -->
           <description id="identity-popup-content"/>
           <description id="identity-popup-content-supplemental"/>
           <description id="identity-popup-content-verifier"/>
           <hbox id="identity-popup-encryption" flex="1">
             <vbox>
               <image id="identity-popup-encryption-icon"/>
               <spacer flex="1"/>
             </vbox>
             <description id="identity-popup-encryption-label" flex="1"/>
           </hbox>
           <spacer flex="1"/>
           <!-- Footer link to page info -->
           <label id="identity-popup-more-info-link"
                  class="text-link plain"
                  value="&identity.moreInfoLinkText;"
-                 onblur="getIdentityHandler().hideIdentityPopup();"
                  onclick="getIdentityHandler().handleMoreInfoClick(event);"/>
         </vbox>
       </hbox>
     </panel>
 
     <tooltip id="urlTooltip">
       <label crop="center" flex="1"/>
     </tooltip>
@@ -268,19 +264,18 @@
                  maxrows="10"
                  newlines="stripsurroundingwhitespace"
                  oninput="URLBarOnInput(event);"
                  ontextentered="return handleURLBarCommand(param);"
                  ontextreverted="return handleURLBarRevert();"
                  pageproxystate="invalid">
           <!-- Use onclick instead of normal popup= syntax since the popup
                code fires onmousedown, and hence eats our favicon drag events -->
-          <box id="identity-box" role="button"
-               onclick="getIdentityHandler().handleIdentityButtonEvent(event);"
-               onkeypress="getIdentityHandler().handleIdentityButtonEvent(event);">
+          <box id="identity-box"
+               onclick="getIdentityHandler().handleIdentityClick(event);">
             <hbox align="center">
               <deck id="page-proxy-deck" onclick="PageProxyClickHandler(event);">
                 <image id="page-proxy-button"
                        ondraggesture="PageProxyDragGesture(event);"
                        tooltiptext="&proxyIcon.tooltip;"/>
                 <image id="page-proxy-favicon" validate="never"
                        ondraggesture="PageProxyDragGesture(event);"
                        onload="this.parentNode.selectedIndex = 1;
--- a/browser/themes/gnomestripe/browser/browser.css
+++ b/browser/themes/gnomestripe/browser/browser.css
@@ -841,21 +841,16 @@ toolbar[iconsize="small"] #paste-button[
   cursor: default;
   -moz-image-region: rect(32px, 16px, 48px, 0px) !important;
 }
 
 /* Identity indicator */
 #identity-box {
   background-color: -moz-dialog;
   -moz-border-end: 1px solid ThreeDShadow;
-  -moz-user-focus: normal;
-}
-
-#identity-box:focus {
-  outline: 1px dotted -moz-DialogText;
 }
 
 #identity-icon-label {
   padding: 0 2px;
   margin: 0;
 }
 
 #identity-box.verifiedIdentity > hbox {
--- a/browser/themes/pinstripe/browser/browser.css
+++ b/browser/themes/pinstripe/browser/browser.css
@@ -1630,21 +1630,16 @@ toolbarbutton.bookmark-item[dragover="tr
 #identity-box {
   /* Extend our margins out so that our highlight/separator bar covers the
     location bar properly */
   margin: -1px 0 -2px;
   padding: 1px 2px 2px 0;
   border-right: 1px solid #888;
   background-color: white;
   opacity: 0.9;
-  -moz-user-focus: normal;
-}
-
-#identity-box:focus {
-  outline: 1.4pt solid -moz-mac-focusring;
 }
 
 #identity-box:hover {
   opacity: 1.0;
 }
 
 #urlbar[level="high"] > #identity-box,
 #urlbar[level="low"] > #identity-box {
--- a/browser/themes/winstripe/browser/browser.css
+++ b/browser/themes/winstripe/browser/browser.css
@@ -1587,21 +1587,16 @@ toolbarbutton.bookmark-item[dragover="tr
 #identity-box {
   background-color: -moz-dialog;
   -moz-appearance: toolbox;
   outline: 1px solid ThreeDShadow;
   -moz-margin-start: -1px;
   /* currently, the identity box is always LTR */
   -moz-outline-radius-topleft: 2px;
   -moz-outline-radius-bottomleft: 2px;
-  -moz-user-focus: normal;
-}
-
-#identity-box:focus {
-  outline: 1px dotted -moz-DialogText;
 }
 
 #identity-box:hover {
   outline-color: ThreeDDarkShadow;
 }
 
 #identity-icon-label {
   padding: 0 2px;
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -381,19 +381,16 @@
         ]]></body>
       </method>
 
       <!-- ::::::::::::: key handling ::::::::::::: -->
 
       <method name="onKeyPress">
         <parameter name="aEvent"/>
         <body><![CDATA[
-          if (aEvent.target.localName != "textbox")
-            return;  // Let child buttons of autocomplete take input
-
           //XXXpch this is so bogus...
           if (aEvent.getPreventDefault())
             return false;
 
           var cancel = false;
 
           // Catch any keys that could potentially move the caret. Ctrl can be
           // used in combination with these keys, so only make sure that Alt
@@ -534,17 +531,17 @@
 
   <binding id="autocomplete-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-base-popup">
     <resources>
       <stylesheet src="chrome://global/skin/tree.css"/>
       <stylesheet src="chrome://global/skin/autocomplete.css"/>
     </resources>
 
     <content ignorekeys="true">
-      <xul:tree anonid="tree" class="autocomplete-tree plain" hidecolumnpicker="true" flex="1" seltype="single">
+      <xul:tree anonid="tree" class="autocomplete-tree plain" hidecolumnpicker="true" flex="1">
         <xul:treecols anonid="treecols">
           <xul:treecol id="treecolAutoCompleteValue" class="autocomplete-treecol" flex="1" overflow="true"/>
         </xul:treecols>
         <xul:treechildren class="autocomplete-treebody"/>
       </xul:tree>
     </content>
 
     <implementation>
@@ -739,20 +736,16 @@
         ]]></setter>
       </property>
 
     </implementation>
   </binding>
 
   <binding id="autocomplete-base-popup" extends="chrome://global/content/bindings/popup.xml#popup">
     <implementation implements="nsIAutoCompletePopup">
-      <!-- nsIAccessible from #popup -->
-      <property name="accessibleType" readonly="true"
-                onget="return Components.interfaces.nsIAccessibleProvider.NoAccessible;"/>
-
       <field name="mInput">null</field>
       <field name="mPopupOpen">false</field>
 
       <!-- =================== nsIAutoCompletePopup =================== -->
 
       <property name="input" readonly="true"
                 onget="return this.mInput"/>
 
@@ -837,38 +830,31 @@
         // so that we restore the correct number when the popup is hidden.
         if (this._normalMaxRows < 0)
           this._normalMaxRows = this.mInput.maxRows;
 
         this.mPopupOpen = true;
       ]]></handler>
 
       <handler event="popuphiding"><![CDATA[
-        var isListActive = true;
-        if (this.selectedIndex == -1)
-          isListActive = false;
         var controller = this.view.QueryInterface(Components.interfaces.nsIAutoCompleteController);
         controller.stopSearch();
 
         // when the popup hides, we need to clear the selection
         // otherwise we will use the value of the selected index when the
         // user hits enter.
         // see bug #400671 for details
         this.selectedIndex = -1;
         this.mPopupOpen = false;
 
         // Reset the maxRows property to the cached "normal" value, and reset
         // _normalMaxRows so that we can detect whether it was set by the input
         // when the popupshowing handler runs.
         this.mInput.maxRows = this._normalMaxRows;
         this._normalMaxRows = -1;
-        // If the list was being navigated and then closed, make sure
-        // we fire accessible focus event back to textbox
-        if (isListActive)
-          this.mInput._focus();
       ]]></handler>
     </handlers>
   </binding>
 
   <binding id="autocomplete-rich-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-base-popup">
     <resources>
       <stylesheet src="chrome://global/skin/autocomplete.css"/>
     </resources>
--- a/toolkit/content/widgets/popup.xml
+++ b/toolkit/content/widgets/popup.xml
@@ -4,18 +4,30 @@
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:xbl="http://www.mozilla.org/xbl">
 
   <binding id="popup-base">
     <resources>
       <stylesheet src="chrome://global/skin/popup.css"/>
     </resources>
+  </binding>
 
-    <implementation implements="nsIDOMXULPopupElement">
+  <binding id="panel"
+           extends="chrome://global/content/bindings/popup.xml#popup-base">
+
+    <implementation implements="nsIDOMXULPopupElement, nsIAccessibleProvider">
+      <property name="accessibleType" readonly="true">
+        <getter>
+          <![CDATA[
+            return Components.interfaces.nsIAccessibleProvider.XULMenupopup;
+          ]]>
+        </getter>
+      </property>
+
       <property name="position" onget="return this.getAttribute('position');"
                                 onset="this.setAttribute('position', val); return val;"/>
       <property name="popupBoxObject">
         <getter>
           return this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
         </getter>
       </property>
 
@@ -150,34 +162,23 @@
         ]]>
         </body>
       </method>
     </implementation>     
 
   </binding>
 
   <binding id="popup"
-           extends="chrome://global/content/bindings/popup.xml#popup-base">
-    
+           extends="chrome://global/content/bindings/popup.xml#panel">
     <content>
       <xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical">
         <children/>
       </xul:arrowscrollbox>
     </content>
 
-    <implementation implements="nsIAccessibleProvider">
-      <property name="accessibleType" readonly="true">
-        <getter>
-          <![CDATA[
-              return Components.interfaces.nsIAccessibleProvider.XULMenupopup;
-            ]]>
-        </getter>
-      </property>
-    </implementation>
-
     <handlers>
       <handler event="contextmenu" action="event.preventDefault();"/>
 
       <handler event="popupshowing" phase="target">
         <![CDATA[
           var array = [];
           var width = 0;
           for (var menuitem = this.firstChild; menuitem; menuitem = menuitem.nextSibling) {
@@ -192,74 +193,16 @@
           }
           for (var i = 0; i < array.length; i++)
             array[i].width = width;
         ]]>
       </handler>
     </handlers>
   </binding>
 
-  <binding id="panel"
-           extends="chrome://global/content/bindings/popup.xml#popup-base">
-    <!-- This separate binding for dialog-like panels - not menu, list or autocomplete popups
-         exposes the popup as an alert or a pane, depending on whether it is always intended
-         to get keyboard navigation when it opens -->
-    <implementation implements="nsIDOMXULPopupElement, nsIAccessibleProvider">
-      <property name="accessibleType" readonly="true">
-        <getter>
-          <![CDATA[
-          return (this.getAttribute("noautofocus") == "true") ?
-                       Components.interfaces.nsIAccessibleProvider.XULAlert :
-                       Components.interfaces.nsIAccessibleProvider.XULPane;
-        ]]></getter>
-      </property>
-      <field name="_prevFocus">0</field>
-    </implementation>
-    
-    <handlers>
-      <handler event="popupshowing"><![CDATA[
-        // Capture the previous focus before has a chance to get set inside the panel
-        try {
-          this._prevFocus = document.commandDispatcher.focusedElement;
-          if (!this._prevFocus)  // Content window has focus
-            this._prevFocus = document.commandDispatcher.focusedWindow;
-        } catch (ex) {}
-       ]]></handler>
-      <handler event="popupshown"><![CDATA[
-        // Fire event for accessibility APIs
-        var alertEvent = document.createEvent("Events");
-        alertEvent.initEvent("AlertActive", true, true);
-        this.dispatchEvent(alertEvent);
-       ]]></handler>
-      <handler event="popuphiding"><![CDATA[
-        function restoreFocusIfInPanel(aPanel, currentFocus, prevFocus) {
-          try {
-            if (document.commandDispatcher.focusedWindow != window)
-              return; // Focus has already been set to a window outside of this panel
-          } catch(ex) {}
-          var ancestorOfFocus = currentFocus;
-          while (ancestorOfFocus) {
-            if (ancestorOfFocus == aPanel) {
-              // Focus was set on an element inside this panel,
-              // so we need to move it back to where it was previously
-              prevFocus.focus();
-              return;
-            }
-            ancestorOfFocus = ancestorOfFocus.parentNode;
-          }
-        }
-        try {
-          if (this._prevFocus && this.getAttribute("norestorefocus") != "true")
-            setTimeout(restoreFocusIfInPanel, 0, this, document.commandDispatcher.focusedElement,
-                       this._prevFocus);
-        } catch(ex) { }
-      ]]></handler>
-    </handlers>
-  </binding>
-
   <binding id="tooltip" extends="chrome://global/content/bindings/popup.xml#popup">
     <content>
       <children>
         <xul:label class="tooltip-label" xbl:inherits="xbl:text=label" flex="1"/>
       </children>
     </content>
     
     <implementation implements="nsIAccessibleProvider">
--- a/toolkit/content/widgets/textbox.xml
+++ b/toolkit/content/widgets/textbox.xml
@@ -152,20 +152,18 @@
       </destructor>
 
     </implementation>
 
     <handlers>
       <handler event="focus" phase="capturing">
         <![CDATA[
           if (!this.hasAttribute("focused")) {
-            if (event.originalTarget == this)
-              this.inputField.focus(); // Forward focus to actual HTML input
-            else if (event.originalTarget != this.inputField)
-              return; // Allow other children (e.g. URL bar buttons) to get focus
+            if (event.originalTarget != this.inputField)
+              this.inputField.focus();
             else if (this.mIgnoreFocus)
               this.mIgnoreFocus = false;
             else if (this.clickSelectsAll)
               this.editor.selectAll();
 
             this.setAttribute("focused", "true");
           }
         ]]>