зеркало из https://github.com/mozilla/gecko-dev.git
Making sure the mouse over behavior is right.
This commit is contained in:
Родитель
1293472895
Коммит
6239477090
|
@ -257,10 +257,11 @@ void nsMenuBarFrame::SetCurrentMenuItem(nsIContent* aMenuItem)
|
|||
return;
|
||||
|
||||
// Unset the current child.
|
||||
mCurrentMenu->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, PR_TRUE);
|
||||
if (mCurrentMenu)
|
||||
mCurrentMenu->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, PR_TRUE);
|
||||
|
||||
// Set the new child.
|
||||
aMenuItem->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE);
|
||||
if (aMenuItem)
|
||||
aMenuItem->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE);
|
||||
mCurrentMenu = aMenuItem;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,31 +133,34 @@ nsMenuBarListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
nsresult
|
||||
nsMenuBarListener::MouseMove(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (mMenuBarFrame->IsActive()) {
|
||||
// Make sure the active menu gets set properly.
|
||||
// If we're over something then switch to it.
|
||||
nsCOMPtr<nsIDOMNode> target;
|
||||
aMouseEvent->GetTarget(getter_AddRefs(target));
|
||||
// Make sure the active menu gets set properly.
|
||||
// If we're over something then switch to it.
|
||||
nsCOMPtr<nsIDOMNode> target;
|
||||
aMouseEvent->GetTarget(getter_AddRefs(target));
|
||||
|
||||
nsCOMPtr<nsIContent> current = do_QueryInterface(target);
|
||||
nsCOMPtr<nsIContent> menuBar;
|
||||
mMenuBarFrame->GetContent(getter_AddRefs(menuBar));
|
||||
nsCOMPtr<nsIContent> current = do_QueryInterface(target);
|
||||
nsCOMPtr<nsIContent> menuBar;
|
||||
mMenuBarFrame->GetContent(getter_AddRefs(menuBar));
|
||||
|
||||
while (current && (current.get() != menuBar)) {
|
||||
// See if we're a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag && (tag.get() == nsXULAtoms::xpmenu)) {
|
||||
// We found a menu.
|
||||
mMenuBarFrame->SetCurrentMenuItem(current);
|
||||
break;
|
||||
}
|
||||
|
||||
// Get our parent.
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
current->GetParent(*getter_AddRefs(parent));
|
||||
current = parent.get();
|
||||
while (current && (current.get() != menuBar)) {
|
||||
// See if we're a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag && (tag.get() == nsXULAtoms::xpmenu)) {
|
||||
// We found a menu.
|
||||
mMenuBarFrame->SetCurrentMenuItem(current);
|
||||
break;
|
||||
}
|
||||
|
||||
// Get our parent.
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
current->GetParent(*getter_AddRefs(parent));
|
||||
current = parent.get();
|
||||
}
|
||||
|
||||
if (!mMenuBarFrame->IsActive()) {
|
||||
// Clear the selected item if there is one.
|
||||
mMenuBarFrame->SetCurrentMenuItem(nsnull);
|
||||
}
|
||||
|
||||
return NS_OK; // means I am NOT consuming event
|
||||
|
|
Загрузка…
Ссылка в новой задаче