From def92d1b8e9d373e2f6f27c366d578d97d8960c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:50 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- layout/xul/nsMenuPopupFrame.cpp | 20 ++++++++++---------- layout/xul/nsXULPopupManager.cpp | 1 + layout/xul/tree/nsTreeBodyFrame.cpp | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'layout/xul') diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index 8ebb8b01d5..17993c8466 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -491,19 +491,13 @@ void nsMenuPopupFrame::TweakMinPrefISize(nscoord& aSize) { } nscoord nsMenuPopupFrame::GetMinISize(gfxContext* aRC) { - nscoord result; - DISPLAY_PREF_INLINE_SIZE(this, result); - - result = nsBlockFrame::GetMinISize(aRC); + nscoord result = nsBlockFrame::GetMinISize(aRC); TweakMinPrefISize(result); return result; } nscoord nsMenuPopupFrame::GetPrefISize(gfxContext* aRC) { - nscoord result; - DISPLAY_PREF_INLINE_SIZE(this, result); - - result = nsBlockFrame::GetPrefISize(aRC); + nscoord result = nsBlockFrame::GetPrefISize(aRC); TweakMinPrefISize(result); return result; } @@ -514,7 +508,6 @@ void nsMenuPopupFrame::Reflow(nsPresContext* aPresContext, nsReflowStatus& aStatus) { MarkInReflow(); DO_GLOBAL_REFLOW_COUNT("nsMenuPopupFrame"); - DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus); MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!"); const auto wm = GetWritingMode(); @@ -2186,6 +2179,12 @@ nsMargin nsMenuPopupFrame::GetMargin() const { margin.left += auOffset.x; margin.right += auOffset.x; } + if (mPopupType == PopupType::Tooltip && !IsAnchored()) { + const auto auOffset = + CSSPixel::ToAppUnits(LookAndFeel::TooltipOffsetVertical()); + margin.top += auOffset; + margin.bottom += auOffset; + } return margin; } @@ -2246,7 +2245,8 @@ void nsMenuPopupFrame::MoveTo(const CSSPoint& aPos, bool aUpdateAttrs, void nsMenuPopupFrame::MoveToAnchor(nsIContent* aAnchorContent, const nsAString& aPosition, int32_t aXPos, int32_t aYPos, bool aAttributesOverride) { - NS_ASSERTION(IsVisible(), "popup must be visible to move it"); + NS_ASSERTION(IsVisibleOrShowing(), + "popup must be visible or showing to move it"); nsPopupState oldstate = mPopupState; InitializePopup(aAnchorContent, mTriggerContent, aPosition, aXPos, aYPos, diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index 332d60d363..a6dbeadca7 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -49,6 +49,7 @@ #include "mozilla/dom/XULMenuElement.h" #include "mozilla/dom/XULMenuBarElement.h" #include "mozilla/dom/XULPopupElement.h" +#include "mozilla/AutoRestore.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventStateManager.h" #include "mozilla/LookAndFeel.h" diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 5ccc1468cc..f585009600 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -3895,7 +3895,7 @@ void nsTreeBodyFrame::RemoveImageCacheEntry(int32_t aRowIndex, nsTreeColumn* aCol) { nsAutoString imageSrc; nsCOMPtr view = GetExistingView(); - if (NS_FAILED(view->GetImageSrc(aRowIndex, aCol, imageSrc))) { + if (!view || NS_FAILED(view->GetImageSrc(aRowIndex, aCol, imageSrc))) { return; } nsTreeImageCacheEntry entry; -- cgit v1.2.3