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:
@@ -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 |
|
||||
|
||||
@@ -515,27 +515,24 @@ 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() {
|
||||
~A11yInstantiationBlocker() {
|
||||
if (!TIPMessageHandler::sInstance) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(TIPMessageHandler::sInstance->mA11yBlockCount > 0);
|
||||
--TIPMessageHandler::sInstance->mA11yBlockCount;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
friend class A11yInstantiationBlocker;
|
||||
friend class A11yInstantiationBlocker;
|
||||
|
||||
static LRESULT CALLBACK TIPHook(int aCode, WPARAM aWParam, LPARAM aLParam) {
|
||||
static LRESULT CALLBACK TIPHook(int aCode, WPARAM aWParam, LPARAM aLParam) {
|
||||
if (aCode < 0 || !sInstance) {
|
||||
return ::CallNextHookEx(nullptr, aCode, aWParam, aLParam);
|
||||
}
|
||||
@@ -551,9 +548,9 @@ class TIPMessageHandler {
|
||||
}
|
||||
|
||||
return ::CallNextHookEx(nullptr, aCode, aWParam, aLParam);
|
||||
}
|
||||
}
|
||||
|
||||
static LRESULT WINAPI SendMessageTimeoutWHook(HWND aHwnd, UINT aMsgCode,
|
||||
static LRESULT WINAPI SendMessageTimeoutWHook(HWND aHwnd, UINT aMsgCode,
|
||||
WPARAM aWParam, LPARAM aLParam,
|
||||
UINT aFlags, UINT aTimeout,
|
||||
PDWORD_PTR aMsgResult) {
|
||||
@@ -574,16 +571,17 @@ class TIPMessageHandler {
|
||||
::DefWindowProcW(aHwnd, aMsgCode, aWParam, aLParam));
|
||||
|
||||
return static_cast<LRESULT>(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
||||
static WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
||||
sSendMessageTimeoutWStub;
|
||||
static StaticAutoPtr<TIPMessageHandler> sInstance;
|
||||
static StaticAutoPtr<TIPMessageHandler> sInstance;
|
||||
|
||||
HHOOK mHook;
|
||||
UINT mMessages[7];
|
||||
uint32_t mA11yBlockCount;
|
||||
};
|
||||
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,
|
||||
@@ -2340,7 +2340,6 @@ void nsWindow::SetFocus(Raise aRaise, mozilla::dom::CallerType aCallerType) {
|
||||
::ShowWindow(toplevelWnd, SW_RESTORE);
|
||||
}
|
||||
::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: {
|
||||
|
||||
Reference in New Issue
Block a user