From 3a67225b65591f41a786d6f0fa8d0d2fd89928f8 Mon Sep 17 00:00:00 2001 From: "mats.palmgren%bredband.net" Date: Sat, 10 Nov 2007 01:03:36 +0000 Subject: [PATCH] Call PerformAccesskey() on the controlled element in case it's not a nsIDOMXULElement. b=400774 r=surkov.alexander sr=jst a=dsicore git-svn-id: svn://10.0.0.236/trunk@239116 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/xul/content/src/nsXULElement.cpp | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index 5d7004c78b1..e39af9878b8 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -631,19 +631,23 @@ nsXULElement::PerformAccesskey(PRBool aKeyCausesActivation, return; nsCOMPtr elm(do_QueryInterface(content)); - - // Define behavior for each type of XUL element. - nsIAtom *tag = content->Tag(); - if (tag == nsGkAtoms::textbox || tag == nsGkAtoms::menulist) { - // if it's a text box or menulist, give it focus - elm->Focus(); - } else if (tag == nsGkAtoms::toolbarbutton) { - // if it's a toolbar button, just click - elm->Click(); - } else { - // otherwise, focus and click in it - elm->Focus(); - elm->Click(); + if (elm) { + // Define behavior for each type of XUL element. + nsIAtom *tag = content->Tag(); + if (tag == nsGkAtoms::textbox || tag == nsGkAtoms::menulist) { + // if it's a text box or menulist, give it focus + elm->Focus(); + } else if (tag == nsGkAtoms::toolbarbutton) { + // if it's a toolbar button, just click + elm->Click(); + } else { + // otherwise, focus and click in it + elm->Focus(); + elm->Click(); + } + } + else { + content->PerformAccesskey(aKeyCausesActivation, aIsTrustedEvent); } }