Bug 1336230 - Add suppressanimation support to Windows backend. r?jimm
MozReview-Commit-ID: C8aKimUBKJx
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -772,16 +772,17 @@ nsWindow::Create(nsIWidget* aParent,
mParent = aParent;
} else { // has a nsNative parent
parent = (HWND)aNativeParent;
mParent = aNativeParent ?
WinUtils::GetNSWindowPtr((HWND)aNativeParent) : nullptr;
}
mIsRTL = aInitData->mRTL;
+ mOpeningAnimationSuppressed = aInitData->mIsAnimationSuppressed;
DWORD style = WindowStyle();
DWORD extendedStyle = WindowExStyle();
if (mWindowType == eWindowType_popup) {
if (!aParent) {
parent = nullptr;
}
@@ -843,16 +844,22 @@ nsWindow::Create(nsIWidget* aParent,
return NS_ERROR_FAILURE;
}
if (mIsRTL && WinUtils::dwmSetWindowAttributePtr) {
DWORD dwAttribute = TRUE;
WinUtils::dwmSetWindowAttributePtr(mWnd, DWMWA_NONCLIENT_RTL_LAYOUT, &dwAttribute, sizeof dwAttribute);
}
+ if (mOpeningAnimationSuppressed && WinUtils::dwmSetWindowAttributePtr) {
+ DWORD dwAttribute = TRUE;
+ WinUtils::dwmSetWindowAttributePtr(mWnd, DWMWA_TRANSITIONS_FORCEDISABLED,
+ &dwAttribute, sizeof dwAttribute);
+ }
+
if (!IsPlugin() &&
mWindowType != eWindowType_invisible &&
MouseScrollHandler::Device::IsFakeScrollableWindowNeeded()) {
// Ugly Thinkpad Driver Hack (Bugs 507222 and 594977)
//
// We create two zero-sized windows as descendants of the top-level window,
// like so:
//
@@ -1617,16 +1624,22 @@ nsWindow::Show(bool bState)
#ifdef MOZ_XUL
if (!wasVisible && bState) {
Invalidate();
if (syncInvalidate && !mInDtor && !mOnDestroyCalled) {
::UpdateWindow(mWnd);
}
}
#endif
+
+ if (mOpeningAnimationSuppressed && WinUtils::dwmSetWindowAttributePtr) {
+ DWORD dwAttribute = FALSE;
+ WinUtils::dwmSetWindowAttributePtr(mWnd, DWMWA_TRANSITIONS_FORCEDISABLED,
+ &dwAttribute, sizeof dwAttribute);
+ }
}
/**************************************************************
*
* SECTION: nsIWidget::IsVisible
*
* Returns the visibility state.
*
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -527,16 +527,17 @@ protected:
bool mPainting;
bool mTouchWindow;
bool mDisplayPanFeedback;
bool mHideChrome;
bool mIsRTL;
bool mFullscreenMode;
bool mMousePresent;
bool mDestroyCalled;
+ bool mOpeningAnimationSuppressed;
uint32_t mBlurSuppressLevel;
DWORD_PTR mOldStyle;
DWORD_PTR mOldExStyle;
nsNativeDragTarget* mNativeDragTarget;
HKL mLastKeyboardLayout;
nsSizeMode mOldSizeMode;
nsSizeMode mLastSizeMode;
WindowHook mWindowHook;