UpdateIgnoreKeys no longer returns before calling SetIgnoreKeys on item. mIgnoreKeys seems to be changed for item, but keys are still taken as list navigation in Nightly. draft
authorTylerM <maklebus@msu.edu>
Tue, 11 Oct 2016 20:41:28 -0400
changeset 424927 6b66efa9a0eeac155ff1fcb0c4ce9a641a0d91a8
parent 424926 46e6794eaee52e387327e53841fef7c6bfaab56b
child 424928 d37a3064400e333cda4880c928698aa0b740e418
push id32293
push userbmo:maklebus@msu.edu
push dateThu, 13 Oct 2016 20:34:31 +0000
milestone52.0a1
UpdateIgnoreKeys no longer returns before calling SetIgnoreKeys on item. mIgnoreKeys seems to be changed for item, but keys are still taken as list navigation in Nightly. MozReview-Commit-ID: 54ivhyls7eN
layout/xul/nsXULPopupManager.cpp
layout/xul/nsXULPopupManager.h
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -2606,22 +2606,20 @@ nsXULPopupManager::HandleEvent(nsIDOMEve
 	if (!trustedEvent) {
 		return NS_OK;
 	}
 
 	nsAutoString eventType;
 	aEvent->GetType(eventType);
 
 	if(eventType.EqualsLiteral("blur")){
-		UpdateIgnoreKeys(false);
-		return NS_OK;
+		return UpdateIgnoreKeys();
 	}
 	if(eventType.EqualsLiteral("focus")){
-		UpdateIgnoreKeys(true);
-		return NS_OK;
+		return UpdateIgnoreKeys();
 	}
 
   nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
   NS_ENSURE_TRUE(keyEvent, NS_ERROR_UNEXPECTED);
 
   if (eventType.EqualsLiteral("keyup")) {
     return KeyUp(keyEvent);
   }
@@ -2633,63 +2631,59 @@ nsXULPopupManager::HandleEvent(nsIDOMEve
   }
 
   NS_ABORT();
 
   return NS_OK;
 }
 
 nsresult
-nsXULPopupManager::UpdateIgnoreKeys(bool focus)
+nsXULPopupManager::UpdateIgnoreKeys()
 {
   /*
-  nsMenuFrame* menuFrame = do_QueryFrame(GetTopVisibleMenu()->GetPrimaryFrame());
-
+  nsMenuFrame* menuFrame = do_QueryFrame(mMenu->GetPrimaryFrame());
   nsIFrame* frame = menuFrame->GetParent();
   while (frame) {
     nsMenuPopupFrame* popupFrame = do_QueryFrame(frame);
     if (popupFrame) {
       aPopup = popupFrame->GetContent();
       break;
     }
     frame = frame->GetParent();
   }
   */
 
   nsMenuChainItem* item = GetTopVisibleMenu();
 
-  if (!item) {
-	  return NS_OK;
+  if(item){
+    
+	/*  
+	nsIContent* aPopup = item->Frame()->GetContent();
+
+    nsAutoString ignorekeys;
+    aPopup->GetAttr(kNameSpaceID_None, nsGkAtoms::ignorekeys, ignorekeys);
+
+    if (ignorekeys.EqualsLiteral("true")) {
+	*/
+	if (item->IgnoreKeys() == eIgnoreKeys_Handled) {
+		item->SetIgnoreKeys(eIgnoreKeys_True);
+	}
+	if (item->IgnoreKeys() == eIgnoreKeys_True) {
+		item->SetIgnoreKeys(eIgnoreKeys_True);
+	}
+	/*
+    } else if (ignorekeys.EqualsLiteral("handled")) {
+		item->SetIgnoreKeys(eIgnoreKeys_Handled);
+	}
+	else {
+		item->SetIgnoreKeys(eIgnoreKeys_False);
+	}
+	*/
   }
 
-  nsIContent* aPopup = item->Frame()->GetContent();
-
-  // install keyboard event listeners for navigating menus. For panels, the
-  // escape key may be used to close the panel. However, the ignorekeys
-  // attribute may be used to disable adding these event listeners for popups
-  // that want to handle their own keyboard events.
-
-  //nsAutoString ignorekeys;
-  //aPopup->GetAttr(kNameSpaceID_None, nsGkAtoms::ignorekeys, ignorekeys);
-
-  //if (ignorekeys.EqualsLiteral("true")) {
-
-  if (focus) {
-	  item->SetIgnoreKeys(eIgnoreKeys_True);
-  } else {
-	  item->SetIgnoreKeys(eIgnoreKeys_False);
-  }
-
-	/*
-  } else if (ignorekeys.EqualsLiteral("handled")) {
-    item->SetIgnoreKeys(eIgnoreKeys_Handled);
-  }
-  */
-
-
   return NS_OK;
 }
 
 nsresult
 nsXULPopupManager::KeyUp(nsIDOMKeyEvent* aKeyEvent)
 {
   // don't do anything if a menu isn't open or a menubar isn't active
   if (!mActiveMenuBar) {
--- a/layout/xul/nsXULPopupManager.h
+++ b/layout/xul/nsXULPopupManager.h
@@ -655,17 +655,17 @@ public:
 
   /**
    * Handles the keyboard event with keyCode value. Returns true if the event
    * has been handled.
    */
   bool HandleKeyboardEventWithKeyCode(nsIDOMKeyEvent* aKeyEvent,
                                       nsMenuChainItem* aTopVisibleMenuItem);
 
-  nsresult UpdateIgnoreKeys(bool focus);
+  nsresult UpdateIgnoreKeys();
   nsresult KeyUp(nsIDOMKeyEvent* aKeyEvent);
   nsresult KeyDown(nsIDOMKeyEvent* aKeyEvent);
   nsresult KeyPress(nsIDOMKeyEvent* aKeyEvent);
 
 protected:
   nsXULPopupManager();
   ~nsXULPopupManager();