Bug 393791. Don't allow menus to open before we've generated their child frames. r=enn,sr=neil,a=beltzner

This commit is contained in:
roc+@cs.cmu.edu 2008-04-22 20:05:54 -07:00
Родитель 6efc31a8bb
Коммит bc61a34233
3 изменённых файлов: 13 добавлений и 19 удалений

Просмотреть файл

@ -312,7 +312,8 @@ nsMenuPopupFrame::SetPreferredBounds(nsBoxLayoutState& aState,
void
nsMenuPopupFrame::AdjustView()
{
if (mPopupState == ePopupOpen || mPopupState == ePopupOpenAndVisible) {
if ((mPopupState == ePopupOpen || mPopupState == ePopupOpenAndVisible) &&
mGeneratedChildren) {
// if the popup has just opened, make sure the scrolled window is at 0,0
if (mIsOpenChanged) {
nsIBox* child = GetChildBox();

Просмотреть файл

@ -168,7 +168,9 @@ function goNext()
gTestIndex++;
gTestStepIndex = 0;
if (gTestIndex < gPopupTests.length) {
var test = gPopupTests[gTestIndex]
var test = gPopupTests[gTestIndex];
// Set the location hash so it's easy to see which test is running
document.location.hash = test.testname;
// skip the test if the condition returns false
if ("condition" in test && !test.condition()) {

Просмотреть файл

@ -157,15 +157,12 @@ var popupTests = [
"DOMMenuInactive filepopup"
];
// finally, the first item is activated and popupshown is fired.
// On Windows, don't skip disabled items. A style rule in the Windows
// theme causes a reflow to happen once the open attribute is set, which
// in turn pushes a popupshown event onto the event queue. The themes on
// other platforms don't have this, so the reflow which pushes the
// popupshown event doesn't happen until later.
// On Windows, don't skip disabled items.
if (navigator.platform.indexOf("Win") == 0)
elist.push("popupshown editpopup", "DOMMenuItemActive cut");
elist.push("DOMMenuItemActive cut");
else
elist.push("DOMMenuItemActive copy", "popupshown editpopup");
elist.push("DOMMenuItemActive copy");
elist.push("popupshown editpopup");
return elist;
},
test: function() { synthesizeKey("VK_RIGHT", { }); },
@ -200,15 +197,9 @@ var popupTests = [
// pressing Alt + a key should open the corresponding menu
testname: "open with accelerator",
events: function() {
var elist = ["DOMMenuBarActive menubar",
"popupshowing viewpopup", "DOMMenuItemActive viewmenu"];
// see the 'cursor right skip disabled' test above for why this is
// reversed on Windows
if (navigator.platform.indexOf("Win") == 0)
elist.push("popupshown viewpopup", "DOMMenuItemActive toolbar");
else
elist.push("DOMMenuItemActive toolbar", "popupshown viewpopup");
return elist;
return [ "DOMMenuBarActive menubar",
"popupshowing viewpopup", "DOMMenuItemActive viewmenu",
"DOMMenuItemActive toolbar", "popupshown viewpopup" ];
},
test: function() { synthesizeKey("V", { altKey: true }); },
result: function(testname) { checkOpen("viewmenu", testname); }
@ -325,7 +316,7 @@ var popupTests = [
condition: function() { return (navigator.platform.indexOf("Win") == 0) },
events: [ "popupshowing helppopup",
"DOMMenuItemInactive filemenu", "DOMMenuItemActive helpmenu",
"popupshown helppopup", "DOMMenuItemActive contents" ],
"DOMMenuItemActive contents", "popupshown helppopup" ],
test: function() { synthesizeKey("H", { }); },
result: function(testname) { checkOpen("helpmenu", testname); },
},