Bug 1807482 - Remove gRollupListener. r=stransky

This is just preliminary clean-up.

Differential Revision: https://phabricator.services.mozilla.com/D165734
This commit is contained in:
Emilio Cobos Álvarez 2023-01-03 13:39:43 +00:00
Родитель 2e5132f48e
Коммит f62fac0678
10 изменённых файлов: 13 добавлений и 33 удалений

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

@ -293,7 +293,7 @@ bool nsXULPopupManager::Rollup(uint32_t aCount, bool aFlush,
if (StaticPrefs::ui_popup_disable_autohide()) {
// Required on linux to allow events to work on other targets.
if (mWidget) {
mWidget->CaptureRollupEvents(nullptr, false);
mWidget->CaptureRollupEvents(false);
}
return false;
}
@ -1955,7 +1955,7 @@ void nsXULPopupManager::SetCaptureState(nsIContent* aOldPopup) {
if (item && aOldPopup == item->Content()) return;
if (mWidget) {
mWidget->CaptureRollupEvents(nullptr, false);
mWidget->CaptureRollupEvents(false);
mWidget = nullptr;
}
@ -1963,7 +1963,7 @@ void nsXULPopupManager::SetCaptureState(nsIContent* aOldPopup) {
nsMenuPopupFrame* popup = item->Frame();
mWidget = popup->GetWidget();
if (mWidget) {
mWidget->CaptureRollupEvents(nullptr, true);
mWidget->CaptureRollupEvents(true);
}
}

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

@ -301,7 +301,7 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
virtual void Invalidate(const LayoutDeviceIntRect& aRect) override;
virtual WindowRenderer* GetWindowRenderer() override;
virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
virtual void CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCapture) override;
virtual void CaptureRollupEvents(bool aDoCapture) override;
[[nodiscard]] virtual nsresult GetAttention(int32_t aCycleCount) override;
virtual bool HasPendingInputEvent() override;
virtual nsTransparencyMode GetTransparencyMode() override;

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

@ -2253,11 +2253,9 @@ LayoutDeviceIntSize nsCocoaWindow::ClientToWindowSize(const LayoutDeviceIntSize&
nsMenuBarX* nsCocoaWindow::GetMenuBar() { return mMenuBar; }
void nsCocoaWindow::CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCapture) {
void nsCocoaWindow::CaptureRollupEvents(bool aDoCapture) {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
gRollupListener = nullptr;
if (aDoCapture) {
if (![NSApp isActive]) {
// We need to capture mouse event if we aren't
@ -2266,7 +2264,6 @@ void nsCocoaWindow::CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCa
// and gdb sessions. See bug 699538.
nsToolkit::GetToolkit()->MonitorAllProcessMouseEvents();
}
gRollupListener = aListener;
// Sometimes more than one popup window can be visible at the same time
// (e.g. nested non-native context menus, or the test case (attachment

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

@ -3692,8 +3692,7 @@ void nsWindow::CaptureMouse(bool aCapture) {
}
}
void nsWindow::CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) {
void nsWindow::CaptureRollupEvents(bool aDoCapture) {
LOG("CaptureRollupEvents() %i\n", int(aDoCapture));
if (mIsDestroyed) {
@ -3701,7 +3700,6 @@ void nsWindow::CaptureRollupEvents(nsIRollupListener* aListener,
}
if (aDoCapture) {
gRollupListener = aListener;
// Don't add a grab if a drag is in progress, or if the widget is a drag
// feedback popup. (panels with type="drag").
if (!GdkIsWaylandDisplay() && !mIsDragPopup &&
@ -3714,7 +3712,6 @@ void nsWindow::CaptureRollupEvents(nsIRollupListener* aListener,
// was not added to this widget.
LOG(" remove mContainer grab [%p]\n", this);
gtk_grab_remove(GTK_WIDGET(mContainer));
gRollupListener = nullptr;
}
}
@ -7432,7 +7429,6 @@ bool nsWindow::CheckForRollup(gdouble aMouseX, gdouble aMouseY, bool aIsWheel,
rollupWidget = rollupListener->GetRollupWidget();
}
if (!rollupWidget) {
nsBaseWidget::gRollupListener = nullptr;
return false;
}

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

@ -190,8 +190,7 @@ class nsWindow final : public nsBaseWidget {
void SetWindowClass(const nsAString& xulWinType) override;
LayoutDeviceIntPoint WidgetToScreenOffset() override;
void CaptureMouse(bool aCapture) override;
void CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) override;
void CaptureRollupEvents(bool aDoCapture) override;
[[nodiscard]] nsresult GetAttention(int32_t aCycleCount) override;
bool HasPendingInputEvent() override;

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

@ -105,8 +105,6 @@ static int32_t gNumWidgets;
# include "nsCocoaFeatures.h"
#endif
nsIRollupListener* nsBaseWidget::gRollupListener = nullptr;
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::ipc;
@ -1805,9 +1803,7 @@ const widget::SizeConstraints nsBaseWidget::GetSizeConstraints() {
// static
nsIRollupListener* nsBaseWidget::GetActiveRollupListener() {
// If set, then this is likely an <html:select> dropdown.
if (gRollupListener) return gRollupListener;
// TODO: Simplify this.
return nsXULPopupManager::GetInstance();
}

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

@ -165,8 +165,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
// nsIWidget interface
void CaptureMouse(bool aCapture) override {}
void CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) override {}
void CaptureRollupEvents(bool aDoCapture) override {}
nsIWidgetListener* GetWidgetListener() const override;
void SetWidgetListener(nsIWidgetListener* alistener) override;
void Destroy() override;
@ -730,8 +729,6 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
// a PANGESTURE_(MAY)START event).
bool mCurrentPanGestureBelongsToSwipe;
static nsIRollupListener* gRollupListener;
struct InitialZoomConstraints {
InitialZoomConstraints(const uint32_t& aPresShellID,
const ScrollableLayerGuid::ViewID& aViewID,

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

@ -1413,8 +1413,7 @@ class nsIWidget : public nsISupports {
* @param aDoCapture true enables capture, false disables capture
*
*/
virtual void CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) = 0;
virtual void CaptureRollupEvents(bool aDoCapture) = 0;
/**
* Bring this window to the user's attention. This is intended to be a more

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

@ -3969,16 +3969,13 @@ void nsWindow::CaptureMouse(bool aCapture) {
*
**************************************************************/
void nsWindow::CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) {
void nsWindow::CaptureRollupEvents(bool aDoCapture) {
if (aDoCapture) {
gRollupListener = aListener;
if (!sMsgFilterHook && !sCallProcHook && !sCallMouseHook) {
RegisterSpecialDropdownHooks();
}
sProcessHook = true;
} else {
gRollupListener = nullptr;
sProcessHook = false;
UnregisterSpecialDropdownHooks();
}
@ -7483,7 +7480,7 @@ void nsWindow::OnDestroy() {
}
if (this == rollupWidget) {
if (rollupListener) rollupListener->Rollup(0, false, nullptr, nullptr);
CaptureRollupEvents(nullptr, false);
CaptureRollupEvents(false);
}
IMEHandler::OnDestroyWindow(this);

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

@ -229,8 +229,7 @@ class nsWindow final : public nsBaseWidget {
nsEventStatus& aStatus) override;
void EnableDragDrop(bool aEnable) override;
void CaptureMouse(bool aCapture) override;
void CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) override;
void CaptureRollupEvents(bool aDoCapture) override;
[[nodiscard]] nsresult GetAttention(int32_t aCycleCount) override;
bool HasPendingInputEvent() override;
WindowRenderer* GetWindowRenderer() override;