mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 18:31:08 +00:00
Backout b6089a8b78d3 (bug 782547) to see if it fixes Flash hangs.
This commit is contained in:
parent
1476015e2a
commit
0e22196909
@ -829,6 +829,8 @@ protected:
|
|||||||
|
|
||||||
bool CanMoveResizeWindows();
|
bool CanMoveResizeWindows();
|
||||||
|
|
||||||
|
bool GetBlurSuppression();
|
||||||
|
|
||||||
// If aDoFlush is true, we'll flush our own layout; otherwise we'll try to
|
// If aDoFlush is true, we'll flush our own layout; otherwise we'll try to
|
||||||
// just flush our parent and only flush ourselves if we think we need to.
|
// just flush our parent and only flush ourselves if we think we need to.
|
||||||
nsresult GetScrollXY(int32_t* aScrollX, int32_t* aScrollY,
|
nsresult GetScrollXY(int32_t* aScrollX, int32_t* aScrollY,
|
||||||
|
@ -44,6 +44,27 @@ typedef DWORD FILEOPENDIALOGOPTIONS;
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Helper classes
|
// Helper classes
|
||||||
|
|
||||||
|
// Manages matching SuppressBlurEvents calls on the parent widget.
|
||||||
|
class AutoSuppressEvents
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit AutoSuppressEvents(nsIWidget* aWidget) :
|
||||||
|
mWindow(static_cast<nsWindow *>(aWidget)) {
|
||||||
|
SuppressWidgetEvents(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
~AutoSuppressEvents() {
|
||||||
|
SuppressWidgetEvents(false);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
void SuppressWidgetEvents(bool aFlag) {
|
||||||
|
if (mWindow) {
|
||||||
|
mWindow->SuppressBlurEvents(aFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nsRefPtr<nsWindow> mWindow;
|
||||||
|
};
|
||||||
|
|
||||||
// Manages the current working path.
|
// Manages the current working path.
|
||||||
class AutoRestoreWorkingPath
|
class AutoRestoreWorkingPath
|
||||||
{
|
{
|
||||||
@ -1006,6 +1027,8 @@ nsFilePicker::ShowW(int16_t *aReturnVal)
|
|||||||
|
|
||||||
*aReturnVal = returnCancel;
|
*aReturnVal = returnCancel;
|
||||||
|
|
||||||
|
AutoSuppressEvents supress(mParentWidget);
|
||||||
|
|
||||||
nsAutoString initialDir;
|
nsAutoString initialDir;
|
||||||
if (mDisplayDirectory)
|
if (mDisplayDirectory)
|
||||||
mDisplayDirectory->GetPath(initialDir);
|
mDisplayDirectory->GetPath(initialDir);
|
||||||
|
@ -164,7 +164,7 @@
|
|||||||
|
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
|
|
||||||
#include "mozilla/HangMonitor.h"
|
#include "mozilla/HangMonitor.h"
|
||||||
#include "nsIMM32Handler.h"
|
#include "nsIMM32Handler.h"
|
||||||
|
|
||||||
using namespace mozilla::widget;
|
using namespace mozilla::widget;
|
||||||
@ -338,6 +338,7 @@ nsWindow::nsWindow() : nsBaseWidget()
|
|||||||
mOldExStyle = 0;
|
mOldExStyle = 0;
|
||||||
mPainting = 0;
|
mPainting = 0;
|
||||||
mLastKeyboardLayout = 0;
|
mLastKeyboardLayout = 0;
|
||||||
|
mBlurSuppressLevel = 0;
|
||||||
mLastPaintEndTime = TimeStamp::Now();
|
mLastPaintEndTime = TimeStamp::Now();
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
mTransparentSurface = nullptr;
|
mTransparentSurface = nullptr;
|
||||||
@ -4007,14 +4008,25 @@ bool nsWindow::DispatchMouseEvent(uint32_t aEventType, WPARAM wParam,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND nsWindow::GetTopLevelForFocus(HWND aCurWnd)
|
void nsWindow::DispatchFocusToTopLevelWindow(bool aIsActivate)
|
||||||
{
|
{
|
||||||
// retrieve the toplevel window or dialog
|
if (aIsActivate)
|
||||||
HWND toplevelWnd = NULL;
|
sJustGotActivate = false;
|
||||||
while (aCurWnd) {
|
sJustGotDeactivate = false;
|
||||||
toplevelWnd = aCurWnd;
|
|
||||||
|
|
||||||
nsWindow *win = WinUtils::GetNSWindowPtr(aCurWnd);
|
if (!aIsActivate && BlurEventsSuppressed())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!mWidgetListener)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// retrive the toplevel window or dialog
|
||||||
|
HWND curWnd = mWnd;
|
||||||
|
HWND toplevelWnd = NULL;
|
||||||
|
while (curWnd) {
|
||||||
|
toplevelWnd = curWnd;
|
||||||
|
|
||||||
|
nsWindow *win = WinUtils::GetNSWindowPtr(curWnd);
|
||||||
if (win) {
|
if (win) {
|
||||||
nsWindowType wintype;
|
nsWindowType wintype;
|
||||||
win->GetWindowType(wintype);
|
win->GetWindowType(wintype);
|
||||||
@ -4022,23 +4034,9 @@ HWND nsWindow::GetTopLevelForFocus(HWND aCurWnd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
aCurWnd = ::GetParent(aCurWnd); // Parent or owner (if has no parent)
|
curWnd = ::GetParent(curWnd); // Parent or owner (if has no parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
return toplevelWnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsWindow::DispatchFocusToTopLevelWindow(bool aIsActivate)
|
|
||||||
{
|
|
||||||
if (aIsActivate)
|
|
||||||
sJustGotActivate = false;
|
|
||||||
sJustGotDeactivate = false;
|
|
||||||
mLastKillFocusWindow = NULL;
|
|
||||||
|
|
||||||
if (!mWidgetListener)
|
|
||||||
return;
|
|
||||||
|
|
||||||
HWND toplevelWnd = GetTopLevelForFocus(mWnd);
|
|
||||||
if (toplevelWnd) {
|
if (toplevelWnd) {
|
||||||
nsWindow *win = WinUtils::GetNSWindowPtr(toplevelWnd);
|
nsWindow *win = WinUtils::GetNSWindowPtr(toplevelWnd);
|
||||||
if (win) {
|
if (win) {
|
||||||
@ -4068,6 +4066,36 @@ bool nsWindow::IsTopLevelMouseExit(HWND aWnd)
|
|||||||
return WinUtils::GetTopLevelHWND(aWnd) != mouseTopLevel;
|
return WinUtils::GetTopLevelHWND(aWnd) != mouseTopLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool nsWindow::BlurEventsSuppressed()
|
||||||
|
{
|
||||||
|
// are they suppressed in this window?
|
||||||
|
if (mBlurSuppressLevel > 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// are they suppressed by any container widget?
|
||||||
|
HWND parentWnd = ::GetParent(mWnd);
|
||||||
|
if (parentWnd) {
|
||||||
|
nsWindow *parent = WinUtils::GetNSWindowPtr(parentWnd);
|
||||||
|
if (parent)
|
||||||
|
return parent->BlurEventsSuppressed();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In some circumstances (opening dependent windows) it makes more sense
|
||||||
|
// (and fixes a crash bug) to not blur the parent window. Called from
|
||||||
|
// nsFilePicker.
|
||||||
|
void nsWindow::SuppressBlurEvents(bool aSuppress)
|
||||||
|
{
|
||||||
|
if (aSuppress)
|
||||||
|
++mBlurSuppressLevel; // for this widget
|
||||||
|
else {
|
||||||
|
NS_ASSERTION(mBlurSuppressLevel > 0, "unbalanced blur event suppression");
|
||||||
|
if (mBlurSuppressLevel > 0)
|
||||||
|
--mBlurSuppressLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool nsWindow::ConvertStatus(nsEventStatus aStatus)
|
bool nsWindow::ConvertStatus(nsEventStatus aStatus)
|
||||||
{
|
{
|
||||||
return aStatus == nsEventStatus_eConsumeNoDefault;
|
return aStatus == nsEventStatus_eConsumeNoDefault;
|
||||||
@ -4998,13 +5026,9 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||||||
int32_t fActive = LOWORD(wParam);
|
int32_t fActive = LOWORD(wParam);
|
||||||
|
|
||||||
if (WA_INACTIVE == fActive) {
|
if (WA_INACTIVE == fActive) {
|
||||||
// When minimizing a window, the deactivation and focus events will
|
// when minimizing a window, the deactivation and focus events will
|
||||||
// be fired in the reverse order. Instead, just deactivate right away.
|
// be fired in the reverse order. Instead, just deactivate right away.
|
||||||
// This can also happen when a modal file dialog is opened, so check
|
if (HIWORD(wParam))
|
||||||
// if the last window to receive the WM_KILLFOCUS message was this one
|
|
||||||
// or a child of this one.
|
|
||||||
if (HIWORD(wParam) ||
|
|
||||||
(mLastKillFocusWindow && (GetTopLevelForFocus(mLastKillFocusWindow) == mWnd)))
|
|
||||||
DispatchFocusToTopLevelWindow(false);
|
DispatchFocusToTopLevelWindow(false);
|
||||||
else
|
else
|
||||||
sJustGotDeactivate = true;
|
sJustGotDeactivate = true;
|
||||||
@ -5080,9 +5104,6 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||||||
if (sJustGotDeactivate) {
|
if (sJustGotDeactivate) {
|
||||||
DispatchFocusToTopLevelWindow(false);
|
DispatchFocusToTopLevelWindow(false);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
mLastKillFocusWindow = mWnd;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGED:
|
case WM_WINDOWPOSCHANGED:
|
||||||
@ -7056,9 +7077,6 @@ void nsWindow::OnDestroy()
|
|||||||
mWidgetListener = nullptr;
|
mWidgetListener = nullptr;
|
||||||
mAttachedWidgetListener = nullptr;
|
mAttachedWidgetListener = nullptr;
|
||||||
|
|
||||||
if (mWnd == mLastKillFocusWindow)
|
|
||||||
mLastKillFocusWindow = NULL;
|
|
||||||
|
|
||||||
// Free our subclass and clear |this| stored in the window props. We will no longer
|
// Free our subclass and clear |this| stored in the window props. We will no longer
|
||||||
// receive events from Windows after this point.
|
// receive events from Windows after this point.
|
||||||
SubclassWindow(FALSE);
|
SubclassWindow(FALSE);
|
||||||
@ -7073,7 +7091,7 @@ void nsWindow::OnDestroy()
|
|||||||
|
|
||||||
// Release references to children, device context, toolkit, and app shell.
|
// Release references to children, device context, toolkit, and app shell.
|
||||||
nsBaseWidget::OnDestroy();
|
nsBaseWidget::OnDestroy();
|
||||||
|
|
||||||
// Clear our native parent handle.
|
// Clear our native parent handle.
|
||||||
// XXX Windows will take care of this in the proper order, and SetParent(nullptr)'s
|
// XXX Windows will take care of this in the proper order, and SetParent(nullptr)'s
|
||||||
// remove child on the parent already took place in nsBaseWidget's Destroy call above.
|
// remove child on the parent already took place in nsBaseWidget's Destroy call above.
|
||||||
|
@ -203,6 +203,8 @@ public:
|
|||||||
LPARAM aLParam,
|
LPARAM aLParam,
|
||||||
bool aDispatchPendingEvents);
|
bool aDispatchPendingEvents);
|
||||||
|
|
||||||
|
void SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker
|
||||||
|
bool BlurEventsSuppressed();
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
Accessible* GetRootAccessible();
|
Accessible* GetRootAccessible();
|
||||||
#endif // ACCESSIBILITY
|
#endif // ACCESSIBILITY
|
||||||
@ -327,7 +329,6 @@ protected:
|
|||||||
* Event processing helpers
|
* Event processing helpers
|
||||||
*/
|
*/
|
||||||
bool DispatchPluginEvent(const MSG &aMsg);
|
bool DispatchPluginEvent(const MSG &aMsg);
|
||||||
HWND GetTopLevelForFocus(HWND aCurWnd);
|
|
||||||
void DispatchFocusToTopLevelWindow(bool aIsActivate);
|
void DispatchFocusToTopLevelWindow(bool aIsActivate);
|
||||||
bool DispatchStandardEvent(uint32_t aMsg);
|
bool DispatchStandardEvent(uint32_t aMsg);
|
||||||
bool DispatchCommandEvent(uint32_t aEventCommand);
|
bool DispatchCommandEvent(uint32_t aEventCommand);
|
||||||
@ -469,6 +470,7 @@ protected:
|
|||||||
bool mFullscreenMode;
|
bool mFullscreenMode;
|
||||||
bool mMousePresent;
|
bool mMousePresent;
|
||||||
bool mDestroyCalled;
|
bool mDestroyCalled;
|
||||||
|
uint32_t mBlurSuppressLevel;
|
||||||
DWORD_PTR mOldStyle;
|
DWORD_PTR mOldStyle;
|
||||||
DWORD_PTR mOldExStyle;
|
DWORD_PTR mOldExStyle;
|
||||||
InputContext mInputContext;
|
InputContext mInputContext;
|
||||||
@ -481,7 +483,6 @@ protected:
|
|||||||
uint32_t mPickerDisplayCount;
|
uint32_t mPickerDisplayCount;
|
||||||
HICON mIconSmall;
|
HICON mIconSmall;
|
||||||
HICON mIconBig;
|
HICON mIconBig;
|
||||||
HWND mLastKillFocusWindow;
|
|
||||||
static bool sDropShadowEnabled;
|
static bool sDropShadowEnabled;
|
||||||
static uint32_t sInstanceCount;
|
static uint32_t sInstanceCount;
|
||||||
static TriStateBool sCanQuit;
|
static TriStateBool sCanQuit;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user