From 9bac6a1b453f77c57f1ce5f4e91f7a99669ef62c Mon Sep 17 00:00:00 2001 From: "ginn.chen%sun.com" Date: Mon, 10 Apr 2006 06:09:08 +0000 Subject: [PATCH] Bug 319532 [gnome]There is no feedback when use keyboard to navigate disabled menuitem in Mozilla menu r+sr+a=roc git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@193981 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp | 15 ++++++++++++--- mozilla/widget/public/nsILookAndFeel.h | 1 + mozilla/widget/src/gtk/nsLookAndFeel.cpp | 3 +++ mozilla/widget/src/gtk2/nsLookAndFeel.cpp | 3 +++ mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp | 1 + 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp index d96e25760e6..e08fba2685d 100644 --- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -1904,10 +1904,19 @@ PRBool nsMenuPopupFrame::IsValidItem(nsIContent* aContent) { nsIAtom *tag = aContent->Tag(); + + PRBool skipNavigatingDisabledMenuItem; + GetPresContext()->LookAndFeel()-> + GetMetric(nsILookAndFeel::eMetric_SkipNavigatingDisabledMenuItem, + skipNavigatingDisabledMenuItem); - return (tag == nsXULAtoms::menu || - tag == nsXULAtoms::menuitem || - tag == nsHTMLAtoms::option); + PRBool result = (tag == nsXULAtoms::menu || + tag == nsXULAtoms::menuitem || + tag == nsHTMLAtoms::option); + if (skipNavigatingDisabledMenuItem) + result = result && !IsDisabled(aContent); + + return result; } PRBool diff --git a/mozilla/widget/public/nsILookAndFeel.h b/mozilla/widget/public/nsILookAndFeel.h index c6ef3570773..c05e0aa356f 100644 --- a/mozilla/widget/public/nsILookAndFeel.h +++ b/mozilla/widget/public/nsILookAndFeel.h @@ -169,6 +169,7 @@ public: eMetric_SelectTextfieldsOnKeyFocus, // select textfields when focused via tab/accesskey? eMetric_SubmenuDelay, // delay before submenus open eMetric_MenusCanOverlapOSBar, // can popups overlap menu/task bar? + eMetric_SkipNavigatingDisabledMenuItem, // skip navigating to disabled menu item? eMetric_DragFullWindow, // show window contents while dragging? eMetric_DragThresholdX, // begin a drag if the mouse is moved further than the threshold while the button is down eMetric_DragThresholdY, diff --git a/mozilla/widget/src/gtk/nsLookAndFeel.cpp b/mozilla/widget/src/gtk/nsLookAndFeel.cpp index c962eff96bd..4b4d01f2515 100644 --- a/mozilla/widget/src/gtk/nsLookAndFeel.cpp +++ b/mozilla/widget/src/gtk/nsLookAndFeel.cpp @@ -367,6 +367,9 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) // we want XUL popups to be able to overlap the task bar. aMetric = 1; break; + case eMetric_SkipNavigatingDisabledMenuItem: + aMetric = 1; + break; case eMetric_DragFullWindow: aMetric = 1; break; diff --git a/mozilla/widget/src/gtk2/nsLookAndFeel.cpp b/mozilla/widget/src/gtk2/nsLookAndFeel.cpp index ae4360011b6..53e2be7fa2f 100644 --- a/mozilla/widget/src/gtk2/nsLookAndFeel.cpp +++ b/mozilla/widget/src/gtk2/nsLookAndFeel.cpp @@ -401,6 +401,9 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) // we want XUL popups to be able to overlap the task bar. aMetric = 1; break; + case eMetric_SkipNavigatingDisabledMenuItem: + aMetric = 1; + break; case eMetric_DragFullWindow: aMetric = 1; break; diff --git a/mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp b/mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp index afd159301c1..9e26dc9e20d 100644 --- a/mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp +++ b/mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp @@ -94,6 +94,7 @@ nsLookAndFeelIntPref nsXPLookAndFeel::sIntPrefs[] = { "ui.isScreenReaderActive", eMetric_IsScreenReaderActive, PR_FALSE, nsLookAndFeelTypeInt, 0 }, { "ui.menusCanOverlapOSBar", eMetric_MenusCanOverlapOSBar, PR_FALSE, nsLookAndFeelTypeInt, 0 }, + { "ui.skipNavigatingDisabledMenuItem", eMetric_SkipNavigatingDisabledMenuItem, PR_FALSE, nsLookAndFeelTypeInt, 0 }, { "ui.treeOpenDelay", eMetric_TreeOpenDelay, PR_FALSE, nsLookAndFeelTypeInt, 0 }, { "ui.treeCloseDelay",