Bug 1936325 - Miscellaneous windows widget clean-ups. r=win-reviewers,rkraesig

Did these while debugging bug 1936164. No behavior change intended.

Differential Revision: https://phabricator.services.mozilla.com/D231706
This commit is contained in:
Emilio Cobos Álvarez
2024-12-10 18:31:43 +00:00
parent faab93bf15
commit 450f3b396e
2 changed files with 109 additions and 107 deletions

View File

@@ -306,7 +306,7 @@ class WinUtils {
* | | TRUE | FALSE |
+ +-----------------+-------+-----------------------+-----------------------+
* | | | * an independent top level window |
* | | TRUE | * a pupup window (WS_POPUP) |
* | | TRUE | * a popup window (WS_POPUP) |
* | | | * an owned top level window (like dialog) |
* | aStopIfNotChild +-------+-----------------------+-----------------------+
* | | | * independent window | * only an independent |

View File

@@ -515,14 +515,10 @@ class TIPMessageHandler {
}
}
class MOZ_RAII A11yInstantiationBlocker {
public:
A11yInstantiationBlocker() {
if (!TIPMessageHandler::sInstance) {
return;
}
++TIPMessageHandler::sInstance->mA11yBlockCount;
}
class MOZ_RAII A11yInstantiationBlocker{public : A11yInstantiationBlocker(){
if (!TIPMessageHandler::sInstance){return;
} ++TIPMessageHandler::sInstance->mA11yBlockCount;
} // namespace mozilla
~A11yInstantiationBlocker() {
if (!TIPMessageHandler::sInstance) {
@@ -531,7 +527,8 @@ class TIPMessageHandler {
MOZ_ASSERT(TIPMessageHandler::sInstance->mA11yBlockCount > 0);
--TIPMessageHandler::sInstance->mA11yBlockCount;
}
};
}
;
friend class A11yInstantiationBlocker;
@@ -583,7 +580,8 @@ class TIPMessageHandler {
HHOOK mHook;
UINT mMessages[7];
uint32_t mA11yBlockCount;
};
}
;
WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
TIPMessageHandler::sSendMessageTimeoutWStub;
@@ -1202,7 +1200,7 @@ void nsWindow::Destroy() {
// Our windows can be subclassed which may prevent us receiving WM_DESTROY. If
// OnDestroy() didn't get called, call it now.
if (false == mOnDestroyCalled) {
if (!mOnDestroyCalled) {
MSGResult msgResult;
mWindowHook.Notify(mWnd, WM_DESTROY, 0, 0, msgResult);
OnDestroy();
@@ -2324,7 +2322,9 @@ bool nsWindow::IsEnabled() const {
**************************************************************/
void nsWindow::SetFocus(Raise aRaise, mozilla::dom::CallerType aCallerType) {
if (mWnd) {
if (!mWnd) {
return;
}
#ifdef WINSTATE_DEBUG_OUTPUT
if (mWnd == WinUtils::GetTopLevelHWND(mWnd)) {
MOZ_LOG(gWindowsLog, LogLevel::Info,
@@ -2341,7 +2341,6 @@ void nsWindow::SetFocus(Raise aRaise, mozilla::dom::CallerType aCallerType) {
}
::SetFocus(mWnd);
}
}
/**************************************************************
*
@@ -4631,8 +4630,9 @@ LRESULT CALLBACK nsWindow::WindowProcInternal(HWND hWnd, UINT msg,
nsAutoRollup autoRollup;
LRESULT popupHandlingResult;
if (DealWithPopups(hWnd, msg, wParam, lParam, &popupHandlingResult))
if (DealWithPopups(hWnd, msg, wParam, lParam, &popupHandlingResult)) {
return popupHandlingResult;
}
// Call ProcessMessage
LRESULT retValue;
@@ -5559,7 +5559,9 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
// events arrive.
case WM_ACTIVATE: {
int32_t fActive = LOWORD(wParam);
if (mWidgetListener) {
if (!mWidgetListener) {
break;
}
if (WA_INACTIVE == fActive) {
// when minimizing a window, the deactivation and focus events will
// be fired in the reverse order. Instead, just deactivate right away.
@@ -5586,14 +5588,14 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
ModifierKeyState modifierKeyState;
modifierKeyState.InitInputEvent(event);
DispatchInputEvent(&event);
if (sSwitchKeyboardLayout && mLastKeyboardLayout)
if (sSwitchKeyboardLayout && mLastKeyboardLayout) {
ActivateKeyboardLayout(mLastKeyboardLayout, 0);
}
#ifdef ACCESSIBILITY
a11y::LazyInstantiator::ResetUiaDetectionCache();
#endif
}
}
} break;
case WM_ACTIVATEAPP: {