зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset f9a25f51a254 (bug 1811487) for causing bc failures related to PanelMultiView. CLOSED TREE
This commit is contained in:
Родитель
ec1b030216
Коммит
a713f3dd73
|
@ -290,12 +290,14 @@ add_task(async function testTabOpenMenulist() {
|
|||
await shown;
|
||||
ok(gMainMenulist.open, "menulist open");
|
||||
let menuHidden = BrowserTestUtils.waitForEvent(popup, "popuphidden");
|
||||
let panelHidden = BrowserTestUtils.waitForEvent(gPanel, "popuphidden");
|
||||
EventUtils.synthesizeKey("KEY_Tab");
|
||||
await menuHidden;
|
||||
ok(!gMainMenulist.open, "menulist closed after Tab");
|
||||
|
||||
is(gPanel.state, "open", "Panel should be open");
|
||||
await hidePopup();
|
||||
// Tab in an open menulist closes the menulist, but also dismisses the panel
|
||||
// above it (bug 1566673). So, we just wait for the panel to hide rather than
|
||||
// using hidePopup().
|
||||
await panelHidden;
|
||||
});
|
||||
|
||||
if (AppConstants.platform == "macosx") {
|
||||
|
|
|
@ -95,9 +95,9 @@ void XULButtonElement::HandleEnterKeyPress(WidgetEvent& aEvent) {
|
|||
#ifdef XP_WIN
|
||||
if (XULPopupElement* popup = GetContainingPopupElement()) {
|
||||
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
|
||||
pm->HidePopup(
|
||||
popup, {HidePopupOption::HideChain, HidePopupOption::DeselectMenu,
|
||||
HidePopupOption::Async});
|
||||
pm->HidePopup(popup, /* aHideChain = */ true,
|
||||
/* aDeselectMenu = */ true, /* aAsynchronous = */ true,
|
||||
/* aIsCancel = */ false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -211,11 +211,7 @@ void XULButtonElement::CloseMenuPopup(bool aDeselectMenu) {
|
|||
return;
|
||||
}
|
||||
if (auto* popup = GetMenuPopupContent()) {
|
||||
HidePopupOptions options{HidePopupOption::Async};
|
||||
if (aDeselectMenu) {
|
||||
options += HidePopupOption::DeselectMenu;
|
||||
}
|
||||
pm->HidePopup(popup, options);
|
||||
pm->HidePopup(popup, false, aDeselectMenu, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,14 +106,9 @@ void XULPopupElement::OpenPopupAtScreenRect(const nsAString& aPosition,
|
|||
|
||||
void XULPopupElement::HidePopup(bool aCancel) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (!pm) {
|
||||
return;
|
||||
if (pm) {
|
||||
pm->HidePopup(this, false, true, false, aCancel);
|
||||
}
|
||||
HidePopupOptions options{HidePopupOption::DeselectMenu};
|
||||
if (aCancel) {
|
||||
options += HidePopupOption::IsRollup;
|
||||
}
|
||||
pm->HidePopup(this, options);
|
||||
}
|
||||
|
||||
static Modifiers ConvertModifiers(const ActivateMenuItemOptions& aModifiers) {
|
||||
|
|
|
@ -170,9 +170,7 @@ void nsXULPopupListener::ClosePopup() {
|
|||
// popup is hidden. Use asynchronous hiding just to be safe so we don't
|
||||
// fire events during destruction.
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm)
|
||||
pm->HidePopup(mPopupContent,
|
||||
{HidePopupOption::DeselectMenu, HidePopupOption::Async});
|
||||
if (pm) pm->HidePopup(mPopupContent, false, true, true, false);
|
||||
mPopupContent = nullptr; // release the popup
|
||||
}
|
||||
} // ClosePopup
|
||||
|
|
|
@ -207,7 +207,7 @@ nsresult nsMenuBarListener::KeyUp(Event* aKeyEvent) {
|
|||
// handle key events when menubar is active and IME should be
|
||||
// disabled.
|
||||
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
|
||||
pm->Rollup({});
|
||||
pm->Rollup(0, false, nullptr, nullptr);
|
||||
}
|
||||
// If menubar active state is changed or the menubar is destroyed
|
||||
// during closing the popups, we should do nothing anymore.
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include "X11UndefineNone.h"
|
||||
#include "nsXULPopupManager.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::Document;
|
||||
|
@ -2464,8 +2463,7 @@ void nsMenuPopupFrame::CheckForAnchorChange(nsRect& aRect) {
|
|||
if (pm) {
|
||||
// As the caller will be iterating over the open popups, hide
|
||||
// asyncronously.
|
||||
pm->HidePopup(mContent,
|
||||
{HidePopupOption::DeselectMenu, HidePopupOption::Async});
|
||||
pm->HidePopup(mContent, false, true, true, false);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -278,12 +278,14 @@ nsXULPopupManager* nsXULPopupManager::GetInstance() {
|
|||
}
|
||||
|
||||
bool nsXULPopupManager::RollupTooltips() {
|
||||
return RollupInternal(RollupKind::Tooltip, {}, nullptr);
|
||||
return RollupInternal(RollupKind::Tooltip, UINT32_MAX, false, nullptr,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
bool nsXULPopupManager::Rollup(const RollupOptions& aOptions,
|
||||
bool nsXULPopupManager::Rollup(uint32_t aCount, bool aFlush,
|
||||
const LayoutDeviceIntPoint* aPos,
|
||||
nsIContent** aLastRolledUp) {
|
||||
return RollupInternal(RollupKind::Menu, aOptions, aLastRolledUp);
|
||||
return RollupInternal(RollupKind::Menu, aCount, aFlush, aPos, aLastRolledUp);
|
||||
}
|
||||
|
||||
bool nsXULPopupManager::RollupNativeMenu() {
|
||||
|
@ -294,8 +296,9 @@ bool nsXULPopupManager::RollupNativeMenu() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool nsXULPopupManager::RollupInternal(RollupKind aKind,
|
||||
const RollupOptions& aOptions,
|
||||
bool nsXULPopupManager::RollupInternal(RollupKind aKind, uint32_t aCount,
|
||||
bool aFlush,
|
||||
const LayoutDeviceIntPoint* pos,
|
||||
nsIContent** aLastRolledUp) {
|
||||
if (aLastRolledUp) {
|
||||
*aLastRolledUp = nullptr;
|
||||
|
@ -346,7 +349,7 @@ bool nsXULPopupManager::RollupInternal(RollupKind aKind,
|
|||
// This would be used to allow adjusting the caret position in an
|
||||
// autocomplete field without hiding the popup for example.
|
||||
bool noRollupOnAnchor =
|
||||
(!consume && aOptions.mPoint &&
|
||||
(!consume && pos &&
|
||||
item->Frame()->GetContent()->AsElement()->AttrValueIs(
|
||||
kNameSpaceID_None, nsGkAtoms::norolluponanchor, nsGkAtoms::_true,
|
||||
eCaseMatters));
|
||||
|
@ -355,7 +358,7 @@ bool nsXULPopupManager::RollupInternal(RollupKind aKind,
|
|||
// when the click was over the anchor. This way, clicking on a menu doesn't
|
||||
// reopen the menu.
|
||||
if ((consumeResult == ConsumeOutsideClicks_ParentOnly || noRollupOnAnchor) &&
|
||||
aOptions.mPoint) {
|
||||
pos) {
|
||||
nsMenuPopupFrame* popupFrame = item->Frame();
|
||||
CSSIntRect anchorRect = [&] {
|
||||
if (popupFrame->IsAnchored()) {
|
||||
|
@ -396,8 +399,7 @@ bool nsXULPopupManager::RollupInternal(RollupKind aKind,
|
|||
// event will get consumed, so here only a quick coordinates check is
|
||||
// done rather than a slower complete check of what is at that location.
|
||||
nsPresContext* presContext = item->Frame()->PresContext();
|
||||
CSSIntPoint posCSSPixels =
|
||||
presContext->DevPixelsToIntCSSPixels(*aOptions.mPoint);
|
||||
CSSIntPoint posCSSPixels = presContext->DevPixelsToIntCSSPixels(*pos);
|
||||
if (anchorRect.Contains(posCSSPixels)) {
|
||||
if (consumeResult == ConsumeOutsideClicks_ParentOnly) {
|
||||
consume = true;
|
||||
|
@ -413,13 +415,12 @@ bool nsXULPopupManager::RollupInternal(RollupKind aKind,
|
|||
return false;
|
||||
}
|
||||
|
||||
// If a number of popups to close has been specified, determine the last
|
||||
// popup to close.
|
||||
// if a number of popups to close has been specified, determine the last
|
||||
// popup to close
|
||||
nsIContent* lastPopup = nullptr;
|
||||
uint32_t count = aOptions.mCount;
|
||||
if (count && count != UINT32_MAX) {
|
||||
if (aCount != UINT32_MAX) {
|
||||
nsMenuChainItem* last = item;
|
||||
while (--count && last->GetParent()) {
|
||||
while (--aCount && last->GetParent()) {
|
||||
last = last->GetParent();
|
||||
}
|
||||
if (last) {
|
||||
|
@ -431,12 +432,9 @@ bool nsXULPopupManager::RollupInternal(RollupKind aKind,
|
|||
RefPtr<nsViewManager> viewManager =
|
||||
presContext->PresShell()->GetViewManager();
|
||||
|
||||
HidePopup(item->Content(),
|
||||
{HidePopupOption::HideChain, HidePopupOption::DeselectMenu,
|
||||
HidePopupOption::IsRollup},
|
||||
lastPopup);
|
||||
HidePopup(item->Content(), true, true, false, true, lastPopup);
|
||||
|
||||
if (aOptions.mFlush == FlushViews::Yes) {
|
||||
if (aFlush) {
|
||||
// The popup's visibility doesn't update until the minimize animation
|
||||
// has finished, so call UpdateWidgetGeometry to update it right away.
|
||||
viewManager->UpdateWidgetGeometry();
|
||||
|
@ -946,7 +944,7 @@ void nsXULPopupManager::OnNativeMenuClosed() {
|
|||
// menus.
|
||||
// Close the non-native menus now. This matches the HidePopup call in
|
||||
// nsXULMenuCommandEvent::Run.
|
||||
HidePopup(mPopups->Content(), {HidePopupOption::HideChain});
|
||||
HidePopup(mPopups->Content(), true, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1132,8 +1130,9 @@ nsMenuChainItem* nsXULPopupManager::FindPopup(nsIContent* aPopup) const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void nsXULPopupManager::HidePopup(nsIContent* aPopup, HidePopupOptions aOptions,
|
||||
nsIContent* aLastPopup) {
|
||||
void nsXULPopupManager::HidePopup(nsIContent* aPopup, bool aHideChain,
|
||||
bool aDeselectMenu, bool aAsynchronous,
|
||||
bool aIsCancel, nsIContent* aLastPopup) {
|
||||
if (mNativeMenu && mNativeMenu->Element() == aPopup) {
|
||||
RefPtr<NativeMenu> menu = mNativeMenu;
|
||||
(void)menu->Close();
|
||||
|
@ -1147,6 +1146,7 @@ void nsXULPopupManager::HidePopup(nsIContent* aPopup, HidePopupOptions aOptions,
|
|||
|
||||
nsMenuChainItem* foundPopup = FindPopup(aPopup);
|
||||
|
||||
bool deselectMenu = false;
|
||||
nsCOMPtr<nsIContent> popupToHide, nextPopup, lastPopup;
|
||||
|
||||
if (foundPopup) {
|
||||
|
@ -1154,8 +1154,6 @@ void nsXULPopupManager::HidePopup(nsIContent* aPopup, HidePopupOptions aOptions,
|
|||
// If this is a noautohide panel, remove it but don't close any other
|
||||
// panels.
|
||||
popupToHide = aPopup;
|
||||
// XXX This preserves behavior but why is it the right thing to do?
|
||||
aOptions -= HidePopupOption::DeselectMenu;
|
||||
} else {
|
||||
// At this point, foundPopup will be set to the found item in the list. If
|
||||
// foundPopup is the topmost menu, the one to remove, then there are no
|
||||
|
@ -1185,15 +1183,14 @@ void nsXULPopupManager::HidePopup(nsIContent* aPopup, HidePopupOptions aOptions,
|
|||
}
|
||||
}
|
||||
|
||||
deselectMenu = aDeselectMenu;
|
||||
popupToHide = topMenu->Content();
|
||||
popupFrame = topMenu->Frame();
|
||||
|
||||
const bool hideChain = aOptions.contains(HidePopupOption::HideChain);
|
||||
|
||||
// Close up another popup if there is one, and we are either hiding the
|
||||
// entire chain or the item to hide isn't the topmost popup.
|
||||
nsMenuChainItem* parent = topMenu->GetParent();
|
||||
if (parent && (hideChain || topMenu != foundPopup)) {
|
||||
if (parent && (aHideChain || topMenu != foundPopup)) {
|
||||
while (parent && parent->IsNoAutoHide()) {
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
@ -1203,41 +1200,41 @@ void nsXULPopupManager::HidePopup(nsIContent* aPopup, HidePopupOptions aOptions,
|
|||
}
|
||||
}
|
||||
|
||||
lastPopup = aLastPopup ? aLastPopup : (hideChain ? nullptr : aPopup);
|
||||
lastPopup = aLastPopup ? aLastPopup : (aHideChain ? nullptr : aPopup);
|
||||
}
|
||||
} else if (popupFrame->PopupState() == ePopupPositioning) {
|
||||
// When the popup is in the popuppositioning state, it will not be in the
|
||||
// mPopups list. We need another way to find it and make sure it does not
|
||||
// continue the popup showing process.
|
||||
deselectMenu = aDeselectMenu;
|
||||
popupToHide = aPopup;
|
||||
}
|
||||
|
||||
if (!popupToHide) {
|
||||
return;
|
||||
}
|
||||
if (popupToHide) {
|
||||
nsPopupState state = popupFrame->PopupState();
|
||||
// If the popup is already being hidden, don't attempt to hide it again
|
||||
if (state == ePopupHiding) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsPopupState state = popupFrame->PopupState();
|
||||
// If the popup is already being hidden, don't attempt to hide it again
|
||||
if (state == ePopupHiding) {
|
||||
return;
|
||||
}
|
||||
// Change the popup state to hiding. Don't set the hiding state if the
|
||||
// popup is invisible, otherwise nsMenuPopupFrame::HidePopup will
|
||||
// run again. In the invisible state, we just want the events to fire.
|
||||
if (state != ePopupInvisible) {
|
||||
popupFrame->SetPopupState(ePopupHiding);
|
||||
}
|
||||
|
||||
// Change the popup state to hiding. Don't set the hiding state if the
|
||||
// popup is invisible, otherwise nsMenuPopupFrame::HidePopup will
|
||||
// run again. In the invisible state, we just want the events to fire.
|
||||
if (state != ePopupInvisible) {
|
||||
popupFrame->SetPopupState(ePopupHiding);
|
||||
}
|
||||
|
||||
// For menus, popupToHide is always the frontmost item in the list to hide.
|
||||
if (aOptions.contains(HidePopupOption::Async)) {
|
||||
nsCOMPtr<nsIRunnable> event = new nsXULPopupHidingEvent(
|
||||
popupToHide, nextPopup, lastPopup, popupFrame->PopupType(), aOptions);
|
||||
aPopup->OwnerDoc()->Dispatch(TaskCategory::Other, event.forget());
|
||||
} else {
|
||||
RefPtr<nsPresContext> presContext = popupFrame->PresContext();
|
||||
FirePopupHidingEvent(popupToHide, nextPopup, lastPopup, presContext,
|
||||
popupFrame->PopupType(), aOptions);
|
||||
// For menus, popupToHide is always the frontmost item in the list to hide.
|
||||
if (aAsynchronous) {
|
||||
nsCOMPtr<nsIRunnable> event = new nsXULPopupHidingEvent(
|
||||
popupToHide, nextPopup, lastPopup, popupFrame->PopupType(),
|
||||
deselectMenu, aIsCancel);
|
||||
aPopup->OwnerDoc()->Dispatch(TaskCategory::Other, event.forget());
|
||||
} else {
|
||||
RefPtr<nsPresContext> presContext = popupFrame->PresContext();
|
||||
FirePopupHidingEvent(popupToHide, nextPopup, lastPopup, presContext,
|
||||
popupFrame->PopupType(), deselectMenu, aIsCancel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1256,7 +1253,7 @@ void nsXULPopupManager::HideMenu(nsIContent* aMenu) {
|
|||
if (!popup) {
|
||||
return;
|
||||
}
|
||||
HidePopup(popup, {HidePopupOption::DeselectMenu});
|
||||
HidePopup(popup, false, true, false, false);
|
||||
}
|
||||
|
||||
// This is used to hide the popup after a transition finishes.
|
||||
|
@ -1269,13 +1266,13 @@ class TransitionEnder final : public nsIDOMEventListener {
|
|||
virtual ~TransitionEnder() = default;
|
||||
|
||||
public:
|
||||
HidePopupOptions mOptions;
|
||||
bool mDeselectMenu;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(TransitionEnder)
|
||||
|
||||
TransitionEnder(nsIContent* aContent, HidePopupOptions aOptions)
|
||||
: mContent(aContent), mOptions(aOptions) {}
|
||||
TransitionEnder(nsIContent* aContent, bool aDeselectMenu)
|
||||
: mContent(aContent), mDeselectMenu(aDeselectMenu) {}
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT NS_IMETHOD HandleEvent(Event* aEvent) override {
|
||||
mContent->RemoveSystemEventListener(u"transitionend"_ns, this, false);
|
||||
|
@ -1290,7 +1287,7 @@ class TransitionEnder final : public nsIDOMEventListener {
|
|||
// the first one ending.
|
||||
if (RefPtr<nsXULPopupManager> pm = nsXULPopupManager::GetInstance()) {
|
||||
pm->HidePopupCallback(mContent, popupFrame, nullptr, nullptr,
|
||||
popupFrame->PopupType(), mOptions);
|
||||
popupFrame->PopupType(), mDeselectMenu);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1307,7 +1304,7 @@ NS_INTERFACE_MAP_END
|
|||
NS_IMPL_CYCLE_COLLECTION(TransitionEnder, mContent);
|
||||
void nsXULPopupManager::HidePopupCallback(
|
||||
nsIContent* aPopup, nsMenuPopupFrame* aPopupFrame, nsIContent* aNextPopup,
|
||||
nsIContent* aLastPopup, nsPopupType aPopupType, HidePopupOptions aOptions) {
|
||||
nsIContent* aLastPopup, nsPopupType aPopupType, bool aDeselectMenu) {
|
||||
if (mCloseTimer && mTimerMenu == aPopupFrame) {
|
||||
mCloseTimer->Cancel();
|
||||
mCloseTimer = nullptr;
|
||||
|
@ -1328,8 +1325,7 @@ void nsXULPopupManager::HidePopupCallback(
|
|||
}
|
||||
|
||||
AutoWeakFrame weakFrame(aPopupFrame);
|
||||
aPopupFrame->HidePopup(aOptions.contains(HidePopupOption::DeselectMenu),
|
||||
ePopupClosed);
|
||||
aPopupFrame->HidePopup(aDeselectMenu, ePopupClosed);
|
||||
NS_ENSURE_TRUE_VOID(weakFrame.IsAlive());
|
||||
|
||||
// send the popuphidden event synchronously. This event has no default
|
||||
|
@ -1367,7 +1363,7 @@ void nsXULPopupManager::HidePopupCallback(
|
|||
|
||||
RefPtr<nsPresContext> presContext = popupFrame->PresContext();
|
||||
FirePopupHidingEvent(popupToHide, nextPopup, aLastPopup, presContext,
|
||||
foundMenu->PopupType(), aOptions);
|
||||
foundMenu->PopupType(), aDeselectMenu, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1624,12 +1620,10 @@ void nsXULPopupManager::BeginShowingPopup(const PendingPopup& aPendingPopup,
|
|||
}
|
||||
}
|
||||
|
||||
void nsXULPopupManager::FirePopupHidingEvent(nsIContent* aPopup,
|
||||
nsIContent* aNextPopup,
|
||||
nsIContent* aLastPopup,
|
||||
nsPresContext* aPresContext,
|
||||
nsPopupType aPopupType,
|
||||
HidePopupOptions aOptions) {
|
||||
void nsXULPopupManager::FirePopupHidingEvent(
|
||||
nsIContent* aPopup, nsIContent* aNextPopup, nsIContent* aLastPopup,
|
||||
nsPresContext* aPresContext, nsPopupType aPopupType, bool aDeselectMenu,
|
||||
bool aIsCancel) {
|
||||
nsCOMPtr<nsIContent> popup = aPopup;
|
||||
RefPtr<PresShell> presShell = aPresContext->PresShell();
|
||||
Unused << presShell; // This presShell may be keeping things alive
|
||||
|
@ -1700,8 +1694,7 @@ void nsXULPopupManager::FirePopupHidingEvent(nsIContent* aPopup,
|
|||
}
|
||||
// If animate="cancel", only show the transition if cancelling the popup
|
||||
// or rolling up.
|
||||
if (animate.EqualsLiteral("cancel") &&
|
||||
!aOptions.contains(HidePopupOption::IsRollup)) {
|
||||
if (animate.EqualsLiteral("cancel") && !aIsCancel) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1712,13 +1705,13 @@ void nsXULPopupManager::FirePopupHidingEvent(nsIContent* aPopup,
|
|||
// view will be hidden and you won't be able to see it.
|
||||
if (shouldAnimate && AnimationUtils::HasCurrentTransitions(
|
||||
aPopup->AsElement(), PseudoStyleType::NotPseudo)) {
|
||||
RefPtr<TransitionEnder> ender = new TransitionEnder(aPopup, aOptions);
|
||||
RefPtr<TransitionEnder> ender = new TransitionEnder(aPopup, aDeselectMenu);
|
||||
aPopup->AddSystemEventListener(u"transitionend"_ns, ender, false, false);
|
||||
return;
|
||||
}
|
||||
|
||||
HidePopupCallback(aPopup, popupFrame, aNextPopup, aLastPopup, aPopupType,
|
||||
aOptions);
|
||||
aDeselectMenu);
|
||||
}
|
||||
|
||||
bool nsXULPopupManager::IsPopupOpen(nsIContent* aPopup) {
|
||||
|
@ -1940,7 +1933,7 @@ void nsXULPopupManager::PopupDestroyed(nsMenuPopupFrame* aPopup) {
|
|||
} else {
|
||||
// HidePopup will take care of hiding any of its children, so
|
||||
// break out afterwards
|
||||
HidePopup(child->Content(), {HidePopupOption::Async});
|
||||
HidePopup(child->Content(), false, false, true, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2142,7 +2135,7 @@ void nsXULPopupManager::KillMenuTimer() {
|
|||
mCloseTimer = nullptr;
|
||||
|
||||
if (mTimerMenu->IsOpen()) {
|
||||
HidePopup(mTimerMenu->GetContent(), {HidePopupOption::Async});
|
||||
HidePopup(mTimerMenu->GetContent(), false, false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2379,7 +2372,9 @@ bool nsXULPopupManager::HandleKeyboardNavigationInPopup(
|
|||
// close a submenu when Left is pressed
|
||||
if (nsMenuPopupFrame* popupFrame =
|
||||
currentItem->GetMenuPopup(FlushType::None)) {
|
||||
HidePopup(popupFrame->GetContent(), {});
|
||||
HidePopup(popupFrame->GetContent(), /* aHideChain = */ false,
|
||||
/* aDeselectMenu = */ false, /* aAsynchronous = */ false,
|
||||
/* aIsCancel = */ false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2395,7 +2390,7 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
|||
if (aTopVisibleMenuItem &&
|
||||
aTopVisibleMenuItem->PopupType() != ePopupTypeMenu) {
|
||||
if (keyCode == KeyboardEvent_Binding::DOM_VK_ESCAPE) {
|
||||
HidePopup(aTopVisibleMenuItem->Content(), {HidePopupOption::IsRollup});
|
||||
HidePopup(aTopVisibleMenuItem->Content(), false, false, false, true);
|
||||
aKeyEvent->StopPropagation();
|
||||
aKeyEvent->StopCrossProcessForwarding();
|
||||
aKeyEvent->PreventDefault();
|
||||
|
@ -2411,7 +2406,7 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
|||
// roll up the popup when alt+up/down are pressed within a menulist.
|
||||
if (aKeyEvent->AltKey() && aTopVisibleMenuItem &&
|
||||
aTopVisibleMenuItem->Frame()->IsMenuList()) {
|
||||
Rollup({});
|
||||
Rollup(0, false, nullptr, nullptr);
|
||||
break;
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
@ -2438,7 +2433,7 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
|||
// though in this latter case, a menu didn't actually close, the effect
|
||||
// ends up being the same. Similar for the tab key below.
|
||||
if (aTopVisibleMenuItem) {
|
||||
HidePopup(aTopVisibleMenuItem->Content(), {HidePopupOption::IsRollup});
|
||||
HidePopup(aTopVisibleMenuItem->Content(), false, false, false, true);
|
||||
} else if (mActiveMenuBar) {
|
||||
mActiveMenuBar->MenuClosed();
|
||||
}
|
||||
|
@ -2453,7 +2448,7 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
|||
kNameSpaceID_None, nsGkAtoms::activateontab, nsGkAtoms::_true,
|
||||
eCaseMatters)) {
|
||||
// Close popups or deactivate menubar when Tab or F10 are pressed
|
||||
Rollup({});
|
||||
Rollup(0, false, nullptr, nullptr);
|
||||
break;
|
||||
} else if (mActiveMenuBar) {
|
||||
mActiveMenuBar->MenuClosed();
|
||||
|
@ -2599,7 +2594,7 @@ nsresult nsXULPopupManager::KeyDown(KeyboardEvent* aKeyEvent) {
|
|||
// modifiers are already down.
|
||||
nsMenuChainItem* item = GetTopVisibleMenu();
|
||||
if (item && !item->Frame()->IsMenuList()) {
|
||||
Rollup({});
|
||||
Rollup(0, false, nullptr, nullptr);
|
||||
} else if (mActiveMenuBar) {
|
||||
mActiveMenuBar->MenuClosed();
|
||||
}
|
||||
|
@ -2662,7 +2657,7 @@ nsXULPopupHidingEvent::Run() {
|
|||
nsCOMPtr<nsIContent> nextPopup = mNextPopup;
|
||||
nsCOMPtr<nsIContent> lastPopup = mLastPopup;
|
||||
pm->FirePopupHidingEvent(popup, nextPopup, lastPopup, presContext,
|
||||
mPopupType, mOptions);
|
||||
mPopupType, mDeselectMenu, mIsRollup);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -2815,11 +2810,8 @@ nsXULMenuCommandEvent::Run() {
|
|||
|
||||
if (mCloseMenuMode != CloseMenuMode_None) {
|
||||
if (RefPtr popup = menu->GetContainingPopupElement()) {
|
||||
HidePopupOptions options{HidePopupOption::DeselectMenu};
|
||||
if (mCloseMenuMode == CloseMenuMode_Auto) {
|
||||
options += HidePopupOption::HideChain;
|
||||
}
|
||||
pm->HidePopup(popup, options);
|
||||
pm->HidePopup(popup, mCloseMenuMode == CloseMenuMode_Auto, true, false,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,21 +161,6 @@ enum nsIgnoreKeys {
|
|||
eIgnoreKeys_Shortcuts,
|
||||
};
|
||||
|
||||
enum class HidePopupOption : uint8_t {
|
||||
// If the entire chain of menus should be closed.
|
||||
HideChain,
|
||||
// If the parent <menu> of the popup should not be deselected. This will not
|
||||
// be set when the menu is closed by pressing the Escape key.
|
||||
DeselectMenu,
|
||||
// If the first popuphiding event should be sent asynchrously. This should
|
||||
// be set if HidePopup is called from a frame.
|
||||
Async,
|
||||
// If this popup is hiding due to being cancelled.
|
||||
IsRollup,
|
||||
};
|
||||
|
||||
using HidePopupOptions = mozilla::EnumSet<HidePopupOption>;
|
||||
|
||||
#define NS_DIRECTION_IS_INLINE(dir) \
|
||||
(dir == eNavigationDirection_Start || dir == eNavigationDirection_End)
|
||||
#define NS_DIRECTION_IS_BLOCK(dir) \
|
||||
|
@ -292,13 +277,14 @@ class nsXULPopupHidingEvent : public mozilla::Runnable {
|
|||
public:
|
||||
nsXULPopupHidingEvent(nsIContent* aPopup, nsIContent* aNextPopup,
|
||||
nsIContent* aLastPopup, nsPopupType aPopupType,
|
||||
HidePopupOptions aOptions)
|
||||
bool aDeselectMenu, bool aIsCancel)
|
||||
: mozilla::Runnable("nsXULPopupHidingEvent"),
|
||||
mPopup(aPopup),
|
||||
mNextPopup(aNextPopup),
|
||||
mLastPopup(aLastPopup),
|
||||
mPopupType(aPopupType),
|
||||
mOptions(aOptions) {
|
||||
mDeselectMenu(aDeselectMenu),
|
||||
mIsRollup(aIsCancel) {
|
||||
NS_ASSERTION(aPopup,
|
||||
"null popup supplied to nsXULPopupHidingEvent constructor");
|
||||
// aNextPopup and aLastPopup may be null
|
||||
|
@ -311,7 +297,8 @@ class nsXULPopupHidingEvent : public mozilla::Runnable {
|
|||
nsCOMPtr<nsIContent> mNextPopup;
|
||||
nsCOMPtr<nsIContent> mLastPopup;
|
||||
nsPopupType mPopupType;
|
||||
HidePopupOptions mOptions;
|
||||
bool mDeselectMenu;
|
||||
bool mIsRollup;
|
||||
};
|
||||
|
||||
// this class is used for dispatching popuppositioned events asynchronously.
|
||||
|
@ -383,8 +370,9 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
|||
|
||||
// nsIRollupListener
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
bool Rollup(const RollupOptions&,
|
||||
nsIContent** aLastRolledUp = nullptr) override;
|
||||
bool Rollup(uint32_t aCount, bool aFlush,
|
||||
const mozilla::LayoutDeviceIntPoint* aPos,
|
||||
nsIContent** aLastRolledUp) override;
|
||||
bool ShouldRollupOnMouseWheelEvent() override;
|
||||
bool ShouldConsumeOnMouseWheelEvent() override;
|
||||
bool ShouldRollupOnMouseActivate() override;
|
||||
|
@ -396,7 +384,8 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
|||
|
||||
enum class RollupKind { Tooltip, Menu };
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
bool RollupInternal(RollupKind, const RollupOptions&,
|
||||
bool RollupInternal(RollupKind, uint32_t aCount, bool aFlush,
|
||||
const mozilla::LayoutDeviceIntPoint* pos,
|
||||
nsIContent** aLastRolledUp);
|
||||
|
||||
// NativeMenu::Observer
|
||||
|
@ -513,10 +502,21 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
|||
/*
|
||||
* Hide a popup aPopup. If the popup is in a <menu>, then also inform the
|
||||
* menu that the popup is being hidden.
|
||||
*
|
||||
* aHideChain - true if the entire chain of menus should be closed. If false,
|
||||
* only this popup is closed.
|
||||
* aDeselectMenu - true if the parent <menu> of the popup should be
|
||||
* deselected. This will be false when the menu is closed by
|
||||
* pressing the Escape key.
|
||||
* aAsynchronous - true if the first popuphiding event should be sent
|
||||
* asynchrously. This should be true if HidePopup is called
|
||||
* from a frame.
|
||||
* aIsCancel - true if this popup is hiding due to being cancelled.
|
||||
* aLastPopup - optional popup to close last when hiding a chain of menus.
|
||||
* If null, then all popups will be closed.
|
||||
*/
|
||||
void HidePopup(nsIContent* aPopup, HidePopupOptions,
|
||||
void HidePopup(nsIContent* aPopup, bool aHideChain, bool aDeselectMenu,
|
||||
bool aAsynchronous, bool aIsCancel,
|
||||
nsIContent* aLastPopup = nullptr);
|
||||
|
||||
/*
|
||||
|
@ -747,7 +747,7 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
|||
bool aSelectFirstItem);
|
||||
MOZ_CAN_RUN_SCRIPT void HidePopupCallback(
|
||||
nsIContent* aPopup, nsMenuPopupFrame* aPopupFrame, nsIContent* aNextPopup,
|
||||
nsIContent* aLastPopup, nsPopupType aPopupType, HidePopupOptions);
|
||||
nsIContent* aLastPopup, nsPopupType aPopupType, bool aDeselectMenu);
|
||||
|
||||
/**
|
||||
* Trigger frame construction and reflow in the popup, fire a popupshowing
|
||||
|
@ -779,13 +779,14 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
|||
* aLastPopup - the last popup in the chain to hide
|
||||
* aPresContext - nsPresContext for the popup's frame
|
||||
* aPopupType - the PopupType of the frame.
|
||||
* aOptions - the relevant options to hide the popup. Only a subset is looked
|
||||
* at.
|
||||
* aDeselectMenu - true to unhighlight the menu when hiding it
|
||||
* aIsCancel - true if this popup is hiding due to being cancelled.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
void FirePopupHidingEvent(nsIContent* aPopup, nsIContent* aNextPopup,
|
||||
nsIContent* aLastPopup, nsPresContext* aPresContext,
|
||||
nsPopupType aPopupType, HidePopupOptions aOptions);
|
||||
nsPopupType aPopupType, bool aDeselectMenu,
|
||||
bool aIsCancel);
|
||||
|
||||
/**
|
||||
* Handle keyboard navigation within a menu popup specified by aItem.
|
||||
|
|
|
@ -474,7 +474,7 @@ void nsXULTooltipListener::LaunchTooltip() {
|
|||
nsresult nsXULTooltipListener::HideTooltip() {
|
||||
if (nsCOMPtr<nsIContent> currentTooltip = do_QueryReferent(mCurrentTooltip)) {
|
||||
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
|
||||
pm->HidePopup(currentTooltip, {});
|
||||
pm->HidePopup(currentTooltip, false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1037,8 +1037,9 @@ void nsView::DynamicToolbarOffsetChanged(ScreenIntCoord aOffset) {
|
|||
|
||||
bool nsView::RequestWindowClose(nsIWidget* aWidget) {
|
||||
if (mFrame && IsPopupWidget(aWidget) && mFrame->IsMenuPopupFrame()) {
|
||||
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
|
||||
pm->HidePopup(mFrame->GetContent(), {HidePopupOption::DeselectMenu});
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm) {
|
||||
pm->HidePopup(mFrame->GetContent(), false, true, false, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2435,16 +2435,14 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
|
|||
}
|
||||
|
||||
if (shouldRollup) {
|
||||
LayoutDeviceIntPoint devPoint;
|
||||
nsIRollupListener::RollupOptions rollupOptions{popupsToRollup,
|
||||
nsIRollupListener::FlushViews::Yes};
|
||||
if ([theEvent type] == NSEventTypeLeftMouseDown) {
|
||||
NSPoint point = [NSEvent mouseLocation];
|
||||
FlipCocoaScreenCoordinate(point);
|
||||
devPoint = mGeckoChild->CocoaPointsToDevPixels(point);
|
||||
rollupOptions.mPoint = &devPoint;
|
||||
LayoutDeviceIntPoint devPoint = mGeckoChild->CocoaPointsToDevPixels(point);
|
||||
consumeEvent = (BOOL)rollupListener->Rollup(popupsToRollup, true, &devPoint, nullptr);
|
||||
} else {
|
||||
consumeEvent = (BOOL)rollupListener->Rollup(popupsToRollup, true, nullptr, nullptr);
|
||||
}
|
||||
consumeEvent = (BOOL)rollupListener->Rollup(rollupOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ static void RollUpPopups() {
|
|||
|
||||
nsCOMPtr<nsIWidget> rollupWidget = rollupListener->GetRollupWidget();
|
||||
if (!rollupWidget) return;
|
||||
rollupListener->Rollup({0, nsIRollupListener::FlushViews::Yes});
|
||||
rollupListener->Rollup(0, true, nullptr, nullptr);
|
||||
}
|
||||
|
||||
nsCocoaWindow::nsCocoaWindow()
|
||||
|
|
|
@ -1159,7 +1159,7 @@ void nsMenuX::Dump(uint32_t aIndent) const {
|
|||
if (rollupListener) {
|
||||
nsCOMPtr<nsIWidget> rollupWidget = rollupListener->GetRollupWidget();
|
||||
if (rollupWidget) {
|
||||
rollupListener->Rollup({0, nsIRollupListener::FlushViews::Yes});
|
||||
rollupListener->Rollup(0, true, nullptr, nullptr);
|
||||
[menu cancelTracking];
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ void nsToolkit::MonitorAllProcessMouseEvents() {
|
|||
return;
|
||||
}
|
||||
|
||||
rollupListener->Rollup({});
|
||||
rollupListener->Rollup(0, false, nullptr, nullptr);
|
||||
}];
|
||||
}
|
||||
|
||||
|
|
|
@ -625,7 +625,7 @@ void nsWindow::Destroy() {
|
|||
if (rollupListener) {
|
||||
nsCOMPtr<nsIWidget> rollupWidget = rollupListener->GetRollupWidget();
|
||||
if (static_cast<nsIWidget*>(this) == rollupWidget) {
|
||||
rollupListener->Rollup({});
|
||||
rollupListener->Rollup(0, false, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4017,7 +4017,7 @@ gboolean nsWindow::OnConfigureEvent(GtkWidget* aWidget,
|
|||
// This check avoids unwanted rollup on spurious configure events from
|
||||
// Cygwin/X (bug 672103).
|
||||
if (mBounds.x != screenBounds.x || mBounds.y != screenBounds.y) {
|
||||
RollupAllMenus();
|
||||
CheckForRollup(0, 0, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4782,7 +4782,7 @@ void nsWindow::OnContainerFocusOutEvent(GdkEventFocus* aEvent) {
|
|||
}();
|
||||
|
||||
if (shouldRollupMenus) {
|
||||
RollupAllMenus();
|
||||
CheckForRollup(0, 0, false, true);
|
||||
}
|
||||
|
||||
if (RefPtr pm = nsXULPopupManager::GetInstance()) {
|
||||
|
@ -7404,52 +7404,53 @@ bool nsWindow::CheckForRollup(gdouble aMouseX, gdouble aMouseY, bool aIsWheel,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool retVal = false;
|
||||
auto* currentPopup =
|
||||
(GdkWindow*)rollupWidget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
if (!aAlwaysRollup && is_mouse_in_window(currentPopup, aMouseX, aMouseY)) {
|
||||
return false;
|
||||
}
|
||||
bool retVal = false;
|
||||
if (aIsWheel) {
|
||||
retVal = rollupListener->ShouldConsumeOnMouseWheelEvent();
|
||||
if (!rollupListener->ShouldRollupOnMouseWheelEvent()) {
|
||||
return retVal;
|
||||
if (aAlwaysRollup || !is_mouse_in_window(currentPopup, aMouseX, aMouseY)) {
|
||||
bool rollup = true;
|
||||
if (aIsWheel) {
|
||||
rollup = rollupListener->ShouldRollupOnMouseWheelEvent();
|
||||
retVal = rollupListener->ShouldConsumeOnMouseWheelEvent();
|
||||
}
|
||||
}
|
||||
LayoutDeviceIntPoint point;
|
||||
nsIRollupListener::RollupOptions options{0,
|
||||
nsIRollupListener::FlushViews::Yes};
|
||||
// if we're dealing with menus, we probably have submenus and
|
||||
// we don't want to rollup if the click is in a parent menu of
|
||||
// the current submenu
|
||||
if (!aAlwaysRollup) {
|
||||
AutoTArray<nsIWidget*, 5> widgetChain;
|
||||
uint32_t sameTypeCount =
|
||||
rollupListener->GetSubmenuWidgetChain(&widgetChain);
|
||||
for (unsigned long i = 0; i < widgetChain.Length(); ++i) {
|
||||
nsIWidget* widget = widgetChain[i];
|
||||
auto* currWindow = (GdkWindow*)widget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
if (is_mouse_in_window(currWindow, aMouseX, aMouseY)) {
|
||||
// Don't roll up if the mouse event occurred within a menu of the same
|
||||
// type.
|
||||
// If the mouse event occurred in a menu higher than that, roll up, but
|
||||
// pass the number of popups to Rollup so that only those of the same
|
||||
// type close up.
|
||||
if (i < sameTypeCount) {
|
||||
return retVal;
|
||||
// if we're dealing with menus, we probably have submenus and
|
||||
// we don't want to rollup if the click is in a parent menu of
|
||||
// the current submenu
|
||||
uint32_t popupsToRollup = UINT32_MAX;
|
||||
if (!aAlwaysRollup) {
|
||||
AutoTArray<nsIWidget*, 5> widgetChain;
|
||||
uint32_t sameTypeCount =
|
||||
rollupListener->GetSubmenuWidgetChain(&widgetChain);
|
||||
for (unsigned long i = 0; i < widgetChain.Length(); ++i) {
|
||||
nsIWidget* widget = widgetChain[i];
|
||||
auto* currWindow = (GdkWindow*)widget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
if (is_mouse_in_window(currWindow, aMouseX, aMouseY)) {
|
||||
// don't roll up if the mouse event occurred within a
|
||||
// menu of the same type. If the mouse event occurred
|
||||
// in a menu higher than that, roll up, but pass the
|
||||
// number of popups to Rollup so that only those of the
|
||||
// same type close up.
|
||||
if (i < sameTypeCount) {
|
||||
rollup = false;
|
||||
} else {
|
||||
popupsToRollup = sameTypeCount;
|
||||
}
|
||||
break;
|
||||
}
|
||||
options.mCount = sameTypeCount;
|
||||
break;
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
if (!aIsWheel) {
|
||||
point = GdkEventCoordsToDevicePixels(aMouseX, aMouseY);
|
||||
options.mPoint = &point;
|
||||
}
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
} // if rollup listener knows about menus
|
||||
|
||||
if (rollupListener->Rollup(options)) {
|
||||
retVal = true;
|
||||
// if we've determined that we should still rollup, do it.
|
||||
bool usePoint = !aIsWheel && !aAlwaysRollup;
|
||||
LayoutDeviceIntPoint point;
|
||||
if (usePoint) {
|
||||
point = GdkEventCoordsToDevicePixels(aMouseX, aMouseY);
|
||||
}
|
||||
if (rollup &&
|
||||
rollupListener->Rollup(popupsToRollup, true,
|
||||
usePoint ? &point : nullptr, nullptr)) {
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -504,8 +504,7 @@ class nsWindow final : public nsBaseWidget {
|
|||
const mozilla::LayoutDeviceIntPoint& aRefPoint);
|
||||
bool CheckForRollup(gdouble aMouseX, gdouble aMouseY, bool aIsWheel,
|
||||
bool aAlwaysRollup);
|
||||
void RollupAllMenus() { CheckForRollup(0, 0, false, true); }
|
||||
void CheckForRollupDuringGrab() { RollupAllMenus(); }
|
||||
void CheckForRollupDuringGrab() { CheckForRollup(0, 0, false, true); }
|
||||
|
||||
bool GetDragInfo(mozilla::WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow,
|
||||
gint* aButton, gint* aRootX, gint* aRootY);
|
||||
|
|
|
@ -567,7 +567,7 @@ nsBaseDragService::EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) {
|
|||
if (mDragPopup) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm) {
|
||||
pm->HidePopup(mDragPopup, {HidePopupOption::DeselectMenu});
|
||||
pm->HidePopup(mDragPopup, false, true, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,29 +16,26 @@ class nsIWidget;
|
|||
|
||||
class nsIRollupListener {
|
||||
public:
|
||||
enum class FlushViews : bool { No, Yes };
|
||||
struct RollupOptions {
|
||||
// aCount is the number of popups in a chain to close. If this is
|
||||
// zero, then all popups are closed.
|
||||
uint32_t mCount = 0;
|
||||
// If this is true, then views should be flushed after the rollup.
|
||||
FlushViews mFlush = FlushViews::No;
|
||||
// This is the mouse pointer position where the event that triggered the
|
||||
// rollup occurred, which may be nullptr.
|
||||
const mozilla::LayoutDeviceIntPoint* mPoint = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Notifies the object to rollup, optionally returning the node that
|
||||
* was just rolled up in aLastRolledUp, if non-null.
|
||||
* was just rolled up.
|
||||
*
|
||||
* aLastRolledUp is not addrefed.
|
||||
* If aFlush is true, then views should be flushed after the rollup.
|
||||
*
|
||||
* aPoint is the mouse pointer position where the event that triggered the
|
||||
* rollup occurred, which may be nullptr.
|
||||
*
|
||||
* aCount is the number of popups in a chain to close. If this is
|
||||
* UINT32_MAX, then all popups are closed.
|
||||
* If aLastRolledUp is non-null, it will be set to the last rolled up popup,
|
||||
* if this is supported. aLastRolledUp is not addrefed.
|
||||
*
|
||||
* Returns true if the event that the caller is processing should be consumed.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
virtual bool Rollup(const RollupOptions&,
|
||||
nsIContent** aLastRolledUp = nullptr) = 0;
|
||||
virtual bool Rollup(uint32_t aCount, bool aFlush,
|
||||
const mozilla::LayoutDeviceIntPoint* aPoint,
|
||||
nsIContent** aLastRolledUp) = 0;
|
||||
|
||||
/**
|
||||
* Asks the RollupListener if it should rollup on mouse wheel events
|
||||
|
|
|
@ -7414,7 +7414,7 @@ void nsWindow::OnDestroy() {
|
|||
rollupWidget = rollupListener->GetRollupWidget();
|
||||
}
|
||||
if (this == rollupWidget) {
|
||||
rollupListener->Rollup({});
|
||||
if (rollupListener) rollupListener->Rollup(0, false, nullptr, nullptr);
|
||||
CaptureRollupEvents(false);
|
||||
}
|
||||
|
||||
|
@ -8408,11 +8408,6 @@ bool nsWindow::DealWithPopups(HWND aWnd, UINT aMessage, WPARAM aWParam,
|
|||
// Only need to deal with the last rollup for left mouse down events.
|
||||
NS_ASSERTION(!nsAutoRollup::GetLastRollup(), "last rollup is null");
|
||||
|
||||
nsIRollupListener::RollupOptions rollupOptions{
|
||||
popupsToRollup,
|
||||
nsIRollupListener::FlushViews::Yes,
|
||||
};
|
||||
|
||||
if (nativeMessage == WM_TOUCH || nativeMessage == WM_LBUTTONDOWN ||
|
||||
nativeMessage == WM_POINTERDOWN) {
|
||||
LayoutDeviceIntPoint pos;
|
||||
|
@ -8430,12 +8425,13 @@ bool nsWindow::DealWithPopups(HWND aWnd, UINT aMessage, WPARAM aWParam,
|
|||
pos = LayoutDeviceIntPoint(pt.x, pt.y);
|
||||
}
|
||||
|
||||
rollupOptions.mPoint = &pos;
|
||||
nsIContent* lastRollup = nullptr;
|
||||
consumeRollupEvent = rollupListener->Rollup(rollupOptions, &lastRollup);
|
||||
nsIContent* lastRollup;
|
||||
consumeRollupEvent =
|
||||
rollupListener->Rollup(popupsToRollup, true, &pos, &lastRollup);
|
||||
nsAutoRollup::SetLastRollup(lastRollup);
|
||||
} else {
|
||||
consumeRollupEvent = rollupListener->Rollup(rollupOptions);
|
||||
consumeRollupEvent =
|
||||
rollupListener->Rollup(popupsToRollup, true, nullptr, nullptr);
|
||||
}
|
||||
|
||||
// Tell hook to stop processing messages
|
||||
|
|
Загрузка…
Ссылка в новой задаче