Loading layout/xul/nsMenuPopupFrame.cpp +8 −18 Original line number Diff line number Diff line Loading @@ -301,7 +301,7 @@ nsPopupLevel nsMenuPopupFrame::PopupLevel(bool aIsNoAutoHide) const { return sDefaultLevelIsTop ? ePopupLevelTop : ePopupLevelParent; } void nsMenuPopupFrame::EnsureWidget(bool aRecreate) { void nsMenuPopupFrame::PrepareWidget(bool aRecreate) { nsView* ourView = GetView(); if (aRecreate) { if (auto* widget = GetWidget()) { Loading @@ -314,14 +314,11 @@ void nsMenuPopupFrame::EnsureWidget(bool aRecreate) { if (!ourView->HasWidget()) { CreateWidgetForView(ourView); } if (nsIWidget* widget = GetWidget()) { // This won't dynamically update the color scheme changes while the widget // is shown, but it's good enough. widget->SetColorScheme(Some(LookAndFeel::ColorSchemeForFrame(this))); } static Maybe<ColorScheme> GetWidgetColorScheme(const nsMenuPopupFrame* aFrame) { const auto& scheme = aFrame->StyleUI()->mColorScheme.bits; if (!scheme) { return Nothing(); } return Some(LookAndFeel::ColorSchemeForFrame(aFrame)); } nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) { Loading Loading @@ -397,7 +394,6 @@ nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) { widget->SetWindowShadowStyle(GetShadowStyle()); widget->SetWindowOpacity(StyleUIReset()->mWindowOpacity); widget->SetWindowTransform(ComputeWidgetTransform()); widget->SetColorScheme(GetWidgetColorScheme(this)); // most popups don't have a title so avoid setting the title if there isn't // one Loading Loading @@ -507,12 +503,6 @@ void nsMenuPopupFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) { } } if (StyleUI()->mColorScheme != aOldStyle->StyleUI()->mColorScheme) { if (nsIWidget* widget = GetWidget()) { widget->SetColorScheme(GetWidgetColorScheme(this)); } } auto oldRegion = ComputeInputRegion(*aOldStyle, *PresContext()); auto newRegion = ComputeInputRegion(*Style(), *PresContext()); if (oldRegion.mFullyTransparent != newRegion.mFullyTransparent || Loading Loading @@ -806,7 +796,7 @@ void nsMenuPopupFrame::InitializePopup(nsIContent* aAnchorContent, bool aAttributesOverride) { auto* widget = GetWidget(); bool recreateWidget = widget && widget->NeedsRecreateToReshow(); EnsureWidget(recreateWidget); PrepareWidget(recreateWidget); mPopupState = ePopupShowing; mAnchorContent = aAnchorContent; Loading Loading @@ -945,7 +935,7 @@ void nsMenuPopupFrame::InitializePopupAtScreen(nsIContent* aTriggerContent, bool aIsContextMenu) { auto* widget = GetWidget(); bool recreateWidget = widget && widget->NeedsRecreateToReshow(); EnsureWidget(recreateWidget); PrepareWidget(recreateWidget); mPopupState = ePopupShowing; mAnchorContent = nullptr; Loading Loading @@ -2319,7 +2309,7 @@ nsresult nsMenuPopupFrame::AttributeChanged(int32_t aNameSpaceID, // When the remote attribute changes, we need to create a new widget to // ensure that it has the correct compositor and transparency settings to // match the new value. EnsureWidget(true); PrepareWidget(true); } if (aAttribute == nsGkAtoms::followanchor) { Loading layout/xul/nsMenuPopupFrame.h +1 −1 Original line number Diff line number Diff line Loading @@ -205,7 +205,7 @@ class nsMenuPopupFrame final : public nsBoxFrame, // Ensure that a widget has already been created for this view, and create // one if it hasn't. If aRecreate is true, destroys any existing widget and // creates a new one, regardless of whether one has already been created. void EnsureWidget(bool aRecreate = false); void PrepareWidget(bool aRecreate = false); nsresult CreateWidgetForView(nsView* aView); mozilla::StyleWindowShadow GetShadowStyle(); Loading Loading
layout/xul/nsMenuPopupFrame.cpp +8 −18 Original line number Diff line number Diff line Loading @@ -301,7 +301,7 @@ nsPopupLevel nsMenuPopupFrame::PopupLevel(bool aIsNoAutoHide) const { return sDefaultLevelIsTop ? ePopupLevelTop : ePopupLevelParent; } void nsMenuPopupFrame::EnsureWidget(bool aRecreate) { void nsMenuPopupFrame::PrepareWidget(bool aRecreate) { nsView* ourView = GetView(); if (aRecreate) { if (auto* widget = GetWidget()) { Loading @@ -314,14 +314,11 @@ void nsMenuPopupFrame::EnsureWidget(bool aRecreate) { if (!ourView->HasWidget()) { CreateWidgetForView(ourView); } if (nsIWidget* widget = GetWidget()) { // This won't dynamically update the color scheme changes while the widget // is shown, but it's good enough. widget->SetColorScheme(Some(LookAndFeel::ColorSchemeForFrame(this))); } static Maybe<ColorScheme> GetWidgetColorScheme(const nsMenuPopupFrame* aFrame) { const auto& scheme = aFrame->StyleUI()->mColorScheme.bits; if (!scheme) { return Nothing(); } return Some(LookAndFeel::ColorSchemeForFrame(aFrame)); } nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) { Loading Loading @@ -397,7 +394,6 @@ nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) { widget->SetWindowShadowStyle(GetShadowStyle()); widget->SetWindowOpacity(StyleUIReset()->mWindowOpacity); widget->SetWindowTransform(ComputeWidgetTransform()); widget->SetColorScheme(GetWidgetColorScheme(this)); // most popups don't have a title so avoid setting the title if there isn't // one Loading Loading @@ -507,12 +503,6 @@ void nsMenuPopupFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) { } } if (StyleUI()->mColorScheme != aOldStyle->StyleUI()->mColorScheme) { if (nsIWidget* widget = GetWidget()) { widget->SetColorScheme(GetWidgetColorScheme(this)); } } auto oldRegion = ComputeInputRegion(*aOldStyle, *PresContext()); auto newRegion = ComputeInputRegion(*Style(), *PresContext()); if (oldRegion.mFullyTransparent != newRegion.mFullyTransparent || Loading Loading @@ -806,7 +796,7 @@ void nsMenuPopupFrame::InitializePopup(nsIContent* aAnchorContent, bool aAttributesOverride) { auto* widget = GetWidget(); bool recreateWidget = widget && widget->NeedsRecreateToReshow(); EnsureWidget(recreateWidget); PrepareWidget(recreateWidget); mPopupState = ePopupShowing; mAnchorContent = aAnchorContent; Loading Loading @@ -945,7 +935,7 @@ void nsMenuPopupFrame::InitializePopupAtScreen(nsIContent* aTriggerContent, bool aIsContextMenu) { auto* widget = GetWidget(); bool recreateWidget = widget && widget->NeedsRecreateToReshow(); EnsureWidget(recreateWidget); PrepareWidget(recreateWidget); mPopupState = ePopupShowing; mAnchorContent = nullptr; Loading Loading @@ -2319,7 +2309,7 @@ nsresult nsMenuPopupFrame::AttributeChanged(int32_t aNameSpaceID, // When the remote attribute changes, we need to create a new widget to // ensure that it has the correct compositor and transparency settings to // match the new value. EnsureWidget(true); PrepareWidget(true); } if (aAttribute == nsGkAtoms::followanchor) { Loading
layout/xul/nsMenuPopupFrame.h +1 −1 Original line number Diff line number Diff line Loading @@ -205,7 +205,7 @@ class nsMenuPopupFrame final : public nsBoxFrame, // Ensure that a widget has already been created for this view, and create // one if it hasn't. If aRecreate is true, destroys any existing widget and // creates a new one, regardless of whether one has already been created. void EnsureWidget(bool aRecreate = false); void PrepareWidget(bool aRecreate = false); nsresult CreateWidgetForView(nsView* aView); mozilla::StyleWindowShadow GetShadowStyle(); Loading