summaryrefslogtreecommitdiffstats
path: root/widget/windows
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /widget/windows
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/windows')
-rw-r--r--widget/windows/GfxInfo.cpp2
-rw-r--r--widget/windows/ScreenHelperWin.cpp31
-rw-r--r--widget/windows/WindowsSMTCProvider.cpp6
-rw-r--r--widget/windows/moz.build1
-rw-r--r--widget/windows/nsFilePicker.cpp8
-rw-r--r--widget/windows/nsLookAndFeel.cpp19
-rw-r--r--widget/windows/nsLookAndFeel.h4
-rw-r--r--widget/windows/nsNativeThemeWin.cpp47
-rw-r--r--widget/windows/nsUXThemeData.cpp2
-rw-r--r--widget/windows/nsUXThemeData.h1
-rw-r--r--widget/windows/nsWindow.cpp128
-rw-r--r--widget/windows/nsWindow.h9
12 files changed, 152 insertions, 106 deletions
diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp
index 0e1b4002d3..6d8429f1cc 100644
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -310,7 +310,7 @@ uint32_t ParseIDFromDeviceID(const nsAString& key, const nsAString& prefix,
return 0x5143;
}
nsresult err;
- return id.ToInteger(&err, 16);
+ return id.ToUnsignedInteger(&err, 16);
}
// OS version in 16.16 major/minor form
diff --git a/widget/windows/ScreenHelperWin.cpp b/widget/windows/ScreenHelperWin.cpp
index 8a0ec3b608..945b8d1895 100644
--- a/widget/windows/ScreenHelperWin.cpp
+++ b/widget/windows/ScreenHelperWin.cpp
@@ -7,9 +7,12 @@
#include "ScreenHelperWin.h"
#include "mozilla/Logging.h"
+#include "mozilla/gfx/DeviceManagerDx.h"
#include "nsTArray.h"
#include "WinUtils.h"
+#include <dxgi.h>
+
static mozilla::LazyLogModule sScreenLog("WidgetScreen");
namespace mozilla {
@@ -74,8 +77,13 @@ static void GetDisplayInfo(const char16ptr_t aName,
}
}
+struct CollectMonitorsParam {
+ nsTArray<RefPtr<Screen>> screens;
+};
+
BOOL CALLBACK CollectMonitors(HMONITOR aMon, HDC, LPRECT, LPARAM ioParam) {
- auto screens = reinterpret_cast<nsTArray<RefPtr<Screen>>*>(ioParam);
+ CollectMonitorsParam* cmParam =
+ reinterpret_cast<CollectMonitorsParam*>(ioParam);
BOOL success = FALSE;
MONITORINFOEX info;
info.cbSize = sizeof(MONITORINFOEX);
@@ -123,6 +131,9 @@ BOOL CALLBACK CollectMonitors(HMONITOR aMon, HDC, LPRECT, LPARAM ioParam) {
GetDisplayInfo(info.szDevice, orientation, angle, isPseudoDisplay,
refreshRate);
+ auto* manager = gfx::DeviceManagerDx::Get();
+ bool isHDR = manager ? manager->MonitorHDREnabled(aMon) : false;
+
MOZ_LOG(sScreenLog, LogLevel::Debug,
("New screen [%s (%s) %d %u %f %f %f %d %d %d]",
ToString(rect).c_str(), ToString(availRect).c_str(), pixelDepth,
@@ -131,26 +142,32 @@ BOOL CALLBACK CollectMonitors(HMONITOR aMon, HDC, LPRECT, LPARAM ioParam) {
auto screen = MakeRefPtr<Screen>(
rect, availRect, pixelDepth, pixelDepth, refreshRate, contentsScaleFactor,
defaultCssScaleFactor, dpi, Screen::IsPseudoDisplay(isPseudoDisplay),
- orientation, angle);
+ Screen::IsHDR(isHDR), orientation, angle);
if (info.dwFlags & MONITORINFOF_PRIMARY) {
// The primary monitor must be the first element of the screen list.
- screens->InsertElementAt(0, std::move(screen));
+ cmParam->screens.InsertElementAt(0, std::move(screen));
} else {
- screens->AppendElement(std::move(screen));
+ cmParam->screens.AppendElement(std::move(screen));
}
return TRUE;
}
+/* static */
void ScreenHelperWin::RefreshScreens() {
MOZ_LOG(sScreenLog, LogLevel::Debug, ("Refreshing screens"));
- AutoTArray<RefPtr<Screen>, 4> screens;
+ auto* manager = gfx::DeviceManagerDx::Get();
+ if (XRE_IsParentProcess() && manager) {
+ manager->UpdateMonitorInfo();
+ }
+
+ CollectMonitorsParam cmParam;
BOOL result = ::EnumDisplayMonitors(
- nullptr, nullptr, (MONITORENUMPROC)CollectMonitors, (LPARAM)&screens);
+ nullptr, nullptr, (MONITORENUMPROC)CollectMonitors, (LPARAM)&cmParam);
if (!result) {
NS_WARNING("Unable to EnumDisplayMonitors");
}
- ScreenManager::Refresh(std::move(screens));
+ ScreenManager::Refresh(std::move(cmParam.screens));
}
} // namespace widget
diff --git a/widget/windows/WindowsSMTCProvider.cpp b/widget/windows/WindowsSMTCProvider.cpp
index 69915cafd8..3ddd26b6cc 100644
--- a/widget/windows/WindowsSMTCProvider.cpp
+++ b/widget/windows/WindowsSMTCProvider.cpp
@@ -356,7 +356,7 @@ bool WindowsSMTCProvider::RegisterEvents() {
void WindowsSMTCProvider::OnButtonPressed(
mozilla::dom::MediaControlKey aKey) const {
if (!IsKeySupported(aKey)) {
- LOG("key: %s is not supported", ToMediaControlKeyStr(aKey));
+ LOG("key: %s is not supported", dom::GetEnumString(aKey).get());
return;
}
@@ -383,7 +383,7 @@ bool WindowsSMTCProvider::UpdateButtons() {
for (const mozilla::dom::MediaControlKey& key : kKeys) {
if (!EnableKey(key, IsKeySupported(key))) {
success = false;
- LOG("Failed to set %s=%s", ToMediaControlKeyStr(key),
+ LOG("Failed to set %s=%s", dom::GetEnumString(key).get(),
IsKeySupported(key) ? "true" : "false");
}
}
@@ -414,7 +414,7 @@ bool WindowsSMTCProvider::EnableKey(mozilla::dom::MediaControlKey aKey,
// The callback for the event checks if the key is supported
return mSeekRegistrationToken.value != 0;
default:
- LOG("No button for %s", ToMediaControlKeyStr(aKey));
+ LOG("No button for %s", dom::GetEnumString(aKey).get());
return false;
}
}
diff --git a/widget/windows/moz.build b/widget/windows/moz.build
index f19a46caf1..eeda8d1257 100644
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -39,6 +39,7 @@ EXPORTS += [
]
EXPORTS.mozilla += [
+ "ScreenHelperWin.h",
"ShellHeaderOnlyUtils.h",
"ToastNotificationHeaderOnlyUtils.h",
"UrlmonHeaderOnlyUtils.h",
diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp
index fb4c6e80b5..2a45937988 100644
--- a/widget/windows/nsFilePicker.cpp
+++ b/widget/windows/nsFilePicker.cpp
@@ -735,7 +735,11 @@ nsFilePicker::CheckContentAnalysisService() {
auto contentAnalysisCallback =
mozilla::MakeRefPtr<mozilla::contentanalysis::ContentAnalysisCallback>(
[promise](nsIContentAnalysisResponse* aResponse) {
- promise->Resolve(aResponse->GetShouldAllowContent(), __func__);
+ bool shouldAllow = false;
+ mozilla::DebugOnly<nsresult> rv =
+ aResponse->GetShouldAllowContent(&shouldAllow);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ promise->Resolve(shouldAllow, __func__);
},
[promise](nsresult aError) { promise->Reject(aError, __func__); });
@@ -840,7 +844,7 @@ nsresult nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
auto promise = mMode == modeGetFolder ? ShowFolderPicker(initialDir)
: ShowFilePicker(initialDir);
- auto p2 = promise->Then(
+ promise->Then(
mozilla::GetMainThreadSerialEventTarget(), __PRETTY_FUNCTION__,
[self = RefPtr(this),
callback = RefPtr(aCallback)](bool selectionMade) -> void {
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;
diff --git a/widget/windows/nsLookAndFeel.h b/widget/windows/nsLookAndFeel.h
index d19aa91329..0ef38bfda5 100644
--- a/widget/windows/nsLookAndFeel.h
+++ b/widget/windows/nsLookAndFeel.h
@@ -40,6 +40,10 @@
#define SYS_COLOR_MAX 30
#define SYS_COLOR_COUNT (SYS_COLOR_MAX - SYS_COLOR_MIN + 1)
+// Undocumented SPI, see bug 1712669 comment 4.
+#define MOZ_SPI_CURSORSIZE 0x2028
+#define MOZ_SPI_SETCURSORSIZE 0x2029
+
namespace mozilla::widget::WinRegistry {
class KeyWatcher;
}
diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp
index 04883a833f..7ef968baf6 100644
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -484,9 +484,6 @@ mozilla::Maybe<nsUXThemeClass> nsNativeThemeWin::GetThemeClass(
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
return Some(eUXEdit);
- case StyleAppearance::Toolbox:
- return Some(eUXRebar);
- case StyleAppearance::Toolbar:
case StyleAppearance::Toolbarbutton:
case StyleAppearance::Separator:
return Some(eUXToolbar);
@@ -719,27 +716,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
}
return NS_OK;
}
- case StyleAppearance::Toolbox: {
- aState = 0;
- aPart = RP_BACKGROUND;
- return NS_OK;
- }
- case StyleAppearance::Toolbar: {
- // Use -1 to indicate we don't wish to have the theme background drawn
- // for this item. We will pass any nessessary information via aState,
- // and will render the item using separate code.
- aPart = -1;
- aState = 0;
- if (aFrame) {
- nsIContent* content = aFrame->GetContent();
- nsIContent* parent = content->GetParent();
- // XXXzeniko hiding the first toolbar will result in an unwanted margin
- if (parent && parent->GetFirstChild() == content) {
- aState = 1;
- }
- }
- return NS_OK;
- }
case StyleAppearance::Treeview:
case StyleAppearance::Listbox: {
aPart = TREEVIEW_BODY;
@@ -1031,16 +1007,6 @@ RENDER_AGAIN:
::DeleteObject(hPen);
}
}
- } else if (aAppearance == StyleAppearance::Toolbar && state == 0) {
- // Draw toolbar separator lines above all toolbars except the first one.
- // The lines are part of the Rebar theme, which is loaded for
- // StyleAppearance::Toolbox.
- theme = GetTheme(StyleAppearance::Toolbox);
- if (!theme) return NS_ERROR_FAILURE;
-
- widgetRect.bottom = widgetRect.top + TB_SEPARATOR_HEIGHT;
- DrawThemeEdge(theme, hdc, RP_BAND, 0, &widgetRect, EDGE_ETCHED, BF_TOP,
- nullptr);
}
nativeDrawing.EndNativeDrawing();
@@ -1101,7 +1067,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::GetWidgetBorder(
}
if (!WidgetIsContainer(aAppearance) ||
- aAppearance == StyleAppearance::Toolbox ||
aAppearance == StyleAppearance::Tabpanel)
return result; // Don't worry about it.
@@ -1109,12 +1074,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::GetWidgetBorder(
nsresult rv = GetThemePartAndState(aFrame, aAppearance, part, state);
if (NS_FAILED(rv)) return result;
- if (aAppearance == StyleAppearance::Toolbar) {
- // make space for the separator line above all toolbars but the first
- if (state == 0) result.top = TB_SEPARATOR_HEIGHT;
- return result;
- }
-
result = GetCachedWidgetBorder(theme, themeClass.value(), aAppearance, part,
state);
@@ -1278,8 +1237,6 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
switch (aAppearance) {
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
- case StyleAppearance::Toolbox:
- case StyleAppearance::Toolbar:
case StyleAppearance::Progresschunk:
case StyleAppearance::Tabpanels:
case StyleAppearance::Tabpanel:
@@ -1352,9 +1309,7 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame,
nsAtom* aAttribute, bool* aShouldRepaint,
const nsAttrValue* aOldValue) {
// Some widget types just never change state.
- if (aAppearance == StyleAppearance::Toolbox ||
- aAppearance == StyleAppearance::Toolbar ||
- aAppearance == StyleAppearance::Progresschunk ||
+ if (aAppearance == StyleAppearance::Progresschunk ||
aAppearance == StyleAppearance::ProgressBar ||
aAppearance == StyleAppearance::Tabpanels ||
aAppearance == StyleAppearance::Tabpanel ||
diff --git a/widget/windows/nsUXThemeData.cpp b/widget/windows/nsUXThemeData.cpp
index b3f9e6fce9..ce8b0f3479 100644
--- a/widget/windows/nsUXThemeData.cpp
+++ b/widget/windows/nsUXThemeData.cpp
@@ -62,8 +62,6 @@ const wchar_t* nsUXThemeData::GetClassName(nsUXThemeClass cls) {
return L"Button";
case eUXEdit:
return L"Edit";
- case eUXRebar:
- return L"Rebar";
case eUXToolbar:
return L"Toolbar";
case eUXProgress:
diff --git a/widget/windows/nsUXThemeData.h b/widget/windows/nsUXThemeData.h
index 38be8b4484..24fe07d128 100644
--- a/widget/windows/nsUXThemeData.h
+++ b/widget/windows/nsUXThemeData.h
@@ -19,7 +19,6 @@
enum nsUXThemeClass {
eUXButton = 0,
eUXEdit,
- eUXRebar,
eUXToolbar,
eUXProgress,
eUXTab,
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index b304d2efac..22d20d099e 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -78,6 +78,7 @@
#include <limits>
#include "mozilla/widget/WinMessages.h"
+#include "nsLookAndFeel.h"
#include "nsWindow.h"
#include "nsWindowTaskbarConcealer.h"
#include "nsAppRunner.h"
@@ -181,11 +182,13 @@
# endif
# include "mozilla/a11y/Compatibility.h"
# include "oleidl.h"
+# include <uiautomation.h>
# include <winuser.h>
# include "nsAccessibilityService.h"
# include "mozilla/a11y/DocAccessible.h"
# include "mozilla/a11y/LazyInstantiator.h"
# include "mozilla/a11y/Platform.h"
+# include "mozilla/StaticPrefs_accessibility.h"
# if !defined(WINABLEAPI)
# include <winable.h>
# endif // !defined(WINABLEAPI)
@@ -1335,8 +1338,6 @@ DWORD nsWindow::WindowExStyle() {
}
return extendedStyle;
}
- case WindowType::Sheet:
- MOZ_FALLTHROUGH_ASSERT("Sheets are macOS specific");
case WindowType::Dialog:
case WindowType::TopLevel:
case WindowType::Invisible:
@@ -1583,13 +1584,6 @@ void nsWindow::Show(bool bState) {
// SetWindowPos would get the correct answer.
mIsVisible = bState;
- // We may have cached an out of date visible state. This can happen
- // when session restore sets the full screen mode.
- if (mIsVisible)
- mOldStyle |= WS_VISIBLE;
- else
- mOldStyle &= ~WS_VISIBLE;
-
if (mWnd) {
if (bState) {
if (!wasVisible && mWindowType == WindowType::TopLevel) {
@@ -2043,13 +2037,6 @@ void nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
if (aRepaint) Invalidate();
}
-mozilla::Maybe<bool> nsWindow::IsResizingNativeWidget() {
- if (mResizeState == RESIZING) {
- return Some(true);
- }
- return Some(false);
-}
-
/**************************************************************
*
* SECTION: Window Z-order and state.
@@ -3070,34 +3057,85 @@ void nsWindow::HideWindowChrome(bool aShouldHide) {
if (mHideChrome == aShouldHide) return;
- DWORD_PTR style, exStyle;
- mHideChrome = aShouldHide;
- if (aShouldHide) {
- DWORD_PTR tempStyle = ::GetWindowLongPtrW(hwnd, GWL_STYLE);
- DWORD_PTR tempExStyle = ::GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
+ // Data manipulation: styles + ex-styles, and bitmasking operations thereupon.
+ struct Styles {
+ LONG_PTR style, ex;
+ constexpr Styles operator|(Styles const& that) const {
+ return Styles{.style = style | that.style, .ex = ex | that.ex};
+ }
+ constexpr Styles operator&(Styles const& that) const {
+ return Styles{.style = style & that.style, .ex = ex & that.ex};
+ }
+ constexpr Styles operator~() const {
+ return Styles{.style = ~style, .ex = ~ex};
+ }
- style = tempStyle & ~(WS_CAPTION | WS_THICKFRAME);
- exStyle = tempExStyle & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE |
- WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
+ // Compute a style-set which matches `zero` where the bits of `this` are 0
+ // and `one` where the bits of `this` are 1.
+ constexpr Styles merge(Styles zero, Styles one) const {
+ Styles const& mask = *this;
+ return (~mask & zero) | (mask & one);
+ }
- mOldStyle = tempStyle;
- mOldExStyle = tempExStyle;
- } else {
- if (!mOldStyle || !mOldExStyle) {
- mOldStyle = ::GetWindowLongPtrW(hwnd, GWL_STYLE);
- mOldExStyle = ::GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
+ // The dual of `merge`, above: returns a pair [zero, one] satisfying
+ // `a.merge(a.split(b)...) == b`. (Or its equivalent in valid C++.)
+ constexpr std::tuple<Styles, Styles> split(Styles data) const {
+ Styles const& mask = *this;
+ return {~mask & data, mask & data};
}
+ };
- style = mOldStyle;
- exStyle = mOldExStyle;
+ // Get styles from an HWND.
+ constexpr auto const GetStyles = [](HWND hwnd) {
+ return Styles{.style = ::GetWindowLongPtrW(hwnd, GWL_STYLE),
+ .ex = ::GetWindowLongPtrW(hwnd, GWL_EXSTYLE)};
+ };
+ constexpr auto const SetStyles = [](HWND hwnd, Styles styles) {
+ VERIFY_WINDOW_STYLE(styles.style);
+ ::SetWindowLongPtrW(hwnd, GWL_STYLE, styles.style);
+ ::SetWindowLongPtrW(hwnd, GWL_EXSTYLE, styles.ex);
+ };
+
+ // Get styles from *this.
+ auto const GetCachedStyles = [&]() {
+ return mOldStyles.map([](auto const& m) {
+ return Styles{.style = m.style, .ex = m.exStyle};
+ });
+ };
+ auto const SetCachedStyles = [&](Styles styles) {
+ using WStyles = nsWindow::WindowStyles;
+ mOldStyles = Some(WStyles{.style = styles.style, .exStyle = styles.ex});
+ };
+
+ // The mask describing the "chrome" which this function is supposed to remove
+ // (or restore, as the case may be). Other style-flags will be left untouched.
+ constexpr static const Styles kChromeMask{
+ .style = WS_CAPTION | WS_THICKFRAME,
+ .ex = WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE |
+ WS_EX_STATICEDGE};
+
+ // The desired style-flagset for fullscreen windows. (This happens to be all
+ // zeroes, but we don't need to rely on that.)
+ constexpr static const Styles kFullscreenChrome{.style = 0, .ex = 0};
+
+ auto const [chromeless, currentChrome] = kChromeMask.split(GetStyles(hwnd));
+ Styles newChrome{}, oldChrome{};
+
+ mHideChrome = aShouldHide;
+ if (aShouldHide) {
+ newChrome = kFullscreenChrome;
+ oldChrome = currentChrome;
+ } else {
+ // if there's nothing to "restore" it to, just use what's there now
+ oldChrome = GetCachedStyles().refOr(currentChrome);
+ newChrome = oldChrome;
if (mFutureMarginsToUse) {
SetNonClientMargins(mFutureMarginsOnceChromeShows);
}
}
- VERIFY_WINDOW_STYLE(style);
- ::SetWindowLongPtrW(hwnd, GWL_STYLE, style);
- ::SetWindowLongPtrW(hwnd, GWL_EXSTYLE, exStyle);
+ SetCachedStyles(oldChrome);
+ SetStyles(hwnd, kChromeMask.merge(chromeless, newChrome));
}
/**************************************************************
@@ -4941,10 +4979,12 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
case WM_SETTINGCHANGE: {
if (wParam == SPI_SETCLIENTAREAANIMATION ||
- wParam == SPI_SETKEYBOARDDELAY || wParam == SPI_SETMOUSEVANISH) {
+ wParam == SPI_SETKEYBOARDDELAY || wParam == SPI_SETMOUSEVANISH ||
+ wParam == MOZ_SPI_SETCURSORSIZE) {
// These need to update LookAndFeel cached values.
// They affect reduced motion settings / caret blink count / show
- // pointer while typing, so no need to invalidate style / layout.
+ // pointer while typing / tooltip offset, so no need to invalidate style
+ // / layout.
NotifyThemeChanged(widget::ThemeChangeKind::MediaQueriesOnly);
break;
}
@@ -5885,6 +5925,20 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
a11y::LazyInstantiator::EnableBlindAggregation(mWnd);
result = true;
}
+ } else if (objId == UiaRootObjectId &&
+ StaticPrefs::accessibility_uia_enable()) {
+ if (a11y::LocalAccessible* acc = GetAccessible()) {
+ RefPtr<IAccessible> ia;
+ acc->GetNativeInterface(getter_AddRefs(ia));
+ MOZ_ASSERT(ia);
+ RefPtr<IRawElementProviderSimple> uia;
+ ia->QueryInterface(IID_IRawElementProviderSimple,
+ getter_AddRefs(uia));
+ if (uia) {
+ *aRetValue = UiaReturnRawElementProvider(mWnd, wParam, lParam, uia);
+ result = true;
+ }
+ }
}
} break;
#endif
diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h
index 3a521fb978..a2b2a701bd 100644
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -175,7 +175,6 @@ class nsWindow final : public nsBaseWidget {
void Resize(double aWidth, double aHeight, bool aRepaint) override;
void Resize(double aX, double aY, double aWidth, double aHeight,
bool aRepaint) override;
- mozilla::Maybe<bool> IsResizingNativeWidget() override;
void PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget* aWidget,
bool aActivate) override;
void SetSizeMode(nsSizeMode aMode) override;
@@ -755,8 +754,12 @@ class nsWindow final : public nsBaseWidget {
bool mIsAlert = false;
bool mIsPerformingDwmFlushHack = false;
bool mDraggingWindowWithMouse = false;
- DWORD_PTR mOldStyle = 0;
- DWORD_PTR mOldExStyle = 0;
+ // Partial cached window-styles, for when going fullscreen. (Only window-
+ // decoration-related flags are saved here.)
+ struct WindowStyles {
+ LONG_PTR style, exStyle;
+ };
+ mozilla::Maybe<WindowStyles> mOldStyles;
nsNativeDragTarget* mNativeDragTarget = nullptr;
HKL mLastKeyboardLayout = 0;
mozilla::CheckInvariantWrapper<FrameState> mFrameState;