зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1824541 - Synchronously rollup popups when unfocused. r=mac-reviewers,mstange
Otherwise if we become fully occluded we'll throttle the refresh driver, which means that the panel transition won't end soon enough, and the popuphidden event won't fire soon enough. This blocks opening other downloads panels because of this: https://searchfox.org/mozilla-central/rev/98397ff4eac3d32b815fbb33bff147297fb972d7/browser/components/downloads/content/downloads.js#308-310,335-340 Alternative fixes could be: * On the front-end, remove the popup opening block on popuphiding rather than popuphidden. * Doing something like this from nsCocoaWindow::DispatchOcclusionEvent, when we're fully occluded. Let me know if you prefer any of those. Differential Revision: https://phabricator.services.mozilla.com/D174538
This commit is contained in:
Родитель
9c77a786fe
Коммит
c93f219d2e
|
@ -111,7 +111,8 @@ NS_IMPL_ISUPPORTS_INHERITED(nsCocoaWindow, Inherited, nsPIWidgetCocoa)
|
|||
// widget - whether or not the sheet is showing. |[mWindow isSheet]| will return
|
||||
// true *only when the sheet is actually showing*. Choose your test wisely.
|
||||
|
||||
static void RollUpPopups() {
|
||||
static void RollUpPopups(
|
||||
nsIRollupListener::AllowAnimations aAllowAnimations = nsIRollupListener::AllowAnimations::Yes) {
|
||||
nsIRollupListener* rollupListener = nsBaseWidget::GetActiveRollupListener();
|
||||
NS_ENSURE_TRUE_VOID(rollupListener);
|
||||
|
||||
|
@ -120,8 +121,12 @@ static void RollUpPopups() {
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> rollupWidget = rollupListener->GetRollupWidget();
|
||||
if (!rollupWidget) return;
|
||||
rollupListener->Rollup({0, nsIRollupListener::FlushViews::Yes});
|
||||
if (!rollupWidget) {
|
||||
return;
|
||||
}
|
||||
nsIRollupListener::RollupOptions options{0, nsIRollupListener::FlushViews::Yes, nullptr,
|
||||
aAllowAnimations};
|
||||
rollupListener->Rollup(options);
|
||||
}
|
||||
|
||||
nsCocoaWindow::nsCocoaWindow()
|
||||
|
@ -969,7 +974,9 @@ void nsCocoaWindow::Show(bool bState) {
|
|||
}
|
||||
} else {
|
||||
// roll up any popups if a top-level window is going away
|
||||
if (mWindowType == WindowType::TopLevel || mWindowType == WindowType::Dialog) RollUpPopups();
|
||||
if (mWindowType == WindowType::TopLevel || mWindowType == WindowType::Dialog) {
|
||||
RollUpPopups();
|
||||
}
|
||||
|
||||
// now get rid of the window/sheet
|
||||
if (mWindowType == WindowType::Sheet) {
|
||||
|
@ -3036,7 +3043,8 @@ void nsCocoaWindow::CocoaWindowDidResize() {
|
|||
- (void)windowDidResignKey:(NSNotification*)aNotification {
|
||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||
|
||||
RollUpPopups();
|
||||
RollUpPopups(nsIRollupListener::AllowAnimations::No);
|
||||
|
||||
ChildViewMouseTracker::ReEvaluateMouseEnterState();
|
||||
|
||||
// If a sheet just resigned key then we should paint the menu bar
|
||||
|
|
Загрузка…
Ссылка в новой задаче