зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1815309 - Make IsOnMenu() only return true for menupopups/popup elements. r=smaug
This matches what the old code did. Differential Revision: https://phabricator.services.mozilla.com/D169016
This commit is contained in:
Родитель
3acb069157
Коммит
1aa0c40769
|
@ -120,10 +120,8 @@ bool XULButtonElement::IsMenuPopupOpen() {
|
|||
}
|
||||
|
||||
bool XULButtonElement::IsOnMenu() const {
|
||||
if (XULMenuParentElement* menu = GetMenuParent()) {
|
||||
return !menu->IsMenuBar();
|
||||
}
|
||||
return false;
|
||||
auto* popup = XULPopupElement::FromNodeOrNull(GetMenuParent());
|
||||
return popup && popup->IsMenu();
|
||||
}
|
||||
|
||||
bool XULButtonElement::IsOnMenuList() const {
|
||||
|
|
|
@ -47,6 +47,10 @@ class XULPopupElement : public XULMenuParentElement {
|
|||
SetXULAttr(nsGkAtoms::label, aValue, rv);
|
||||
}
|
||||
|
||||
bool IsMenu() const {
|
||||
return IsAnyOfXULElements(nsGkAtoms::popup, nsGkAtoms::menupopup);
|
||||
}
|
||||
|
||||
void GetPosition(DOMString& aValue) const {
|
||||
GetXULAttr(nsGkAtoms::position, aValue);
|
||||
}
|
||||
|
|
|
@ -179,10 +179,11 @@ void nsMenuPopupFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|||
nsViewManager* viewManager = ourView->GetViewManager();
|
||||
viewManager->SetViewFloating(ourView, true);
|
||||
|
||||
const auto& el = PopupElement();
|
||||
mPopupType = PopupType::Panel;
|
||||
if (aContent->IsAnyOfXULElements(nsGkAtoms::menupopup, nsGkAtoms::popup)) {
|
||||
if (el.IsMenu()) {
|
||||
mPopupType = PopupType::Menu;
|
||||
} else if (aContent->IsXULElement(nsGkAtoms::tooltip)) {
|
||||
} else if (el.IsXULElement(nsGkAtoms::tooltip)) {
|
||||
mPopupType = PopupType::Tooltip;
|
||||
}
|
||||
|
||||
|
@ -192,14 +193,11 @@ void nsMenuPopupFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|||
|
||||
// Support incontentshell=false attribute to allow popups to be displayed
|
||||
// outside of the content shell. Chrome only.
|
||||
if (aContent->NodePrincipal()->IsSystemPrincipal()) {
|
||||
if (aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::incontentshell,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
if (el.NodePrincipal()->IsSystemPrincipal()) {
|
||||
if (el.GetXULBoolAttr(nsGkAtoms::incontentshell)) {
|
||||
mInContentShell = true;
|
||||
} else if (aContent->AsElement()->AttrValueIs(
|
||||
kNameSpaceID_None, nsGkAtoms::incontentshell,
|
||||
nsGkAtoms::_false, eCaseMatters)) {
|
||||
} else if (el.AttrValueIs(kNameSpaceID_None, nsGkAtoms::incontentshell,
|
||||
nsGkAtoms::_false, eCaseMatters)) {
|
||||
mInContentShell = false;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче