From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- widget/windows/nsLookAndFeel.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'widget/windows/nsLookAndFeel.cpp') diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp index 6122000c9e..b6b6877857 100644 --- a/widget/windows/nsLookAndFeel.cpp +++ b/widget/windows/nsLookAndFeel.cpp @@ -36,6 +36,17 @@ static int32_t GetSystemParam(long flag, int32_t def) { return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def; } +static int32_t GetTooltipOffsetVertical() { + static constexpr DWORD kDefaultCursorSize = 32; + const DWORD cursorSize = + GetSystemParam(MOZ_SPI_CURSORSIZE, kDefaultCursorSize); + if (cursorSize == kDefaultCursorSize) { + return LookAndFeel::kDefaultTooltipOffset; + } + return std::ceilf(float(LookAndFeel::kDefaultTooltipOffset) * + float(cursorSize) / float(kDefaultCursorSize)); +} + static bool SystemWantsDarkTheme() { if (nsUXThemeData::IsHighContrastOn()) { return LookAndFeel::IsDarkColor( @@ -353,6 +364,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, case ColorID::Marktext: case ColorID::Mark: case ColorID::SpellCheckerUnderline: + case ColorID::MozAutofillBackground: aColor = GetStandinForNativeColor(aID, aScheme); return NS_OK; default: @@ -392,13 +404,9 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) { aResult = std::ceil(float(timeout) / (2.0f * float(blinkTime))); break; } - case IntID::CaretWidth: aResult = 1; break; - case IntID::ShowCaretDuringSelection: - aResult = 0; - break; case IntID::SelectTextfieldsOnKeyFocus: // Select textfield content when focused by kbd // used by EventStateManager::sTextfieldSelectModel @@ -523,6 +531,9 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) { case IntID::ContextMenuOffsetHorizontal: aResult = 2; break; + case IntID::TooltipOffsetVertical: + aResult = GetTooltipOffsetVertical(); + break; case IntID::SystemUsesDarkTheme: aResult = SystemWantsDarkTheme(); break; -- cgit v1.2.3