diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index 44ebbe88fbea..9c4f80679b03 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -1832,18 +1832,6 @@ nsBaseWidget::NotifyWindowDestroyed() } } -void -nsBaseWidget::NotifySizeMoveDone() -{ - if (!mWidgetListener || mWidgetListener->GetXULWindow()) - return; - - nsIPresShell* presShell = mWidgetListener->GetPresShell(); - if (presShell) { - presShell->WindowSizeMoveDone(); - } -} - void nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY) { @@ -1857,27 +1845,34 @@ nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY) } void -nsBaseWidget::NotifySysColorChanged() +nsBaseWidget::NotifyPresShell(NotificationFunc aNotificationFunc) { - if (!mWidgetListener || mWidgetListener->GetXULWindow()) + if (!mWidgetListener || mWidgetListener->GetXULWindow()) { return; + } nsIPresShell* presShell = mWidgetListener->GetPresShell(); if (presShell) { - presShell->SysColorChanged(); + (presShell->*aNotificationFunc)(); } } +void +nsBaseWidget::NotifySizeMoveDone() +{ + NotifyPresShell(&nsIPresShell::WindowSizeMoveDone); +} + +void +nsBaseWidget::NotifySysColorChanged() +{ + NotifyPresShell(&nsIPresShell::SysColorChanged); +} + void nsBaseWidget::NotifyThemeChanged() { - if (!mWidgetListener || mWidgetListener->GetXULWindow()) - return; - - nsIPresShell* presShell = mWidgetListener->GetPresShell(); - if (presShell) { - presShell->ThemeChanged(); - } + NotifyPresShell(&nsIPresShell::ThemeChanged); } void diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index d9ebdb8bf2a1..f5b193bb0493 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -319,6 +319,9 @@ public: bool AsyncPanZoomEnabled() const override; + typedef void (nsIPresShell::*NotificationFunc)(void); + void NotifyPresShell(NotificationFunc aNotificationFunc); + void NotifyWindowDestroyed(); void NotifySizeMoveDone(); void NotifyWindowMoved(int32_t aX, int32_t aY);