suppress processing of blur events with filepicker showing. bug 68454 r=bryner,kmcclusk,jst
git-svn-id: svn://10.0.0.236/trunk@138365 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
69aa964c1b
commit
40817df1c4
@ -797,7 +797,8 @@ GlobalWindowImpl::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Local handling stage
|
||||
if (mListenerManager &&
|
||||
if ((aEvent->message != NS_BLUR_CONTENT || !GetBlurSuppression()) &&
|
||||
mListenerManager &&
|
||||
!(NS_EVENT_FLAG_CANT_BUBBLE & aEvent->flags && NS_EVENT_FLAG_BUBBLE & aFlags && !(NS_EVENT_FLAG_INIT & aFlags))) {
|
||||
aEvent->flags |= aFlags;
|
||||
mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, this,
|
||||
@ -3347,6 +3348,17 @@ GlobalWindowImpl::ConvertCharset(const nsAString& aStr,
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool
|
||||
GlobalWindowImpl::GetBlurSuppression()
|
||||
{
|
||||
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin;
|
||||
GetTreeOwner(getter_AddRefs(treeOwnerAsWin));
|
||||
PRBool suppress = PR_FALSE;
|
||||
if (treeOwnerAsWin)
|
||||
treeOwnerAsWin->GetBlurSuppression(&suppress);
|
||||
return suppress;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GlobalWindowImpl::Escape(const nsAString& aStr,
|
||||
nsAString& aReturn)
|
||||
|
||||
@ -260,6 +260,8 @@ protected:
|
||||
|
||||
nsresult ConvertCharset(const nsAString& aStr, char** aDest);
|
||||
|
||||
PRBool GetBlurSuppression();
|
||||
|
||||
protected:
|
||||
// When adding new member variables, be careful not to create cycles
|
||||
// through JavaScript. If there is any chance that a member variable
|
||||
|
||||
@ -862,6 +862,7 @@ nsWindow::nsWindow() : nsBaseWidget()
|
||||
mIMECompClauseStringLength = 0;
|
||||
mIMEReconvertUnicode = NULL;
|
||||
mLeadByte = '\0';
|
||||
mBlurEventSuppressionLevel = 0;
|
||||
mIMECompCharPos = nsnull;
|
||||
|
||||
static BOOL gbInitGlobalValue = FALSE;
|
||||
@ -953,7 +954,6 @@ nsWindow::~nsWindow()
|
||||
nsMemory::Free(mIMEReconvertUnicode);
|
||||
|
||||
NS_IF_RELEASE(mNativeDragTarget);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1091,6 +1091,35 @@ void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint
|
||||
mLastPoint.y = event.point.y;
|
||||
}
|
||||
|
||||
/* In some circumstances (opening dependent windows) it makes more sense
|
||||
(and fixes a crash bug) to not blur the parent window. */
|
||||
void nsWindow::SuppressBlurEvents(PRBool aSuppress)
|
||||
{
|
||||
if (aSuppress)
|
||||
++mBlurEventSuppressionLevel; // for this widget
|
||||
else {
|
||||
NS_ASSERTION(mBlurEventSuppressionLevel > 0, "unbalanced blur event suppression");
|
||||
if (mBlurEventSuppressionLevel > 0)
|
||||
--mBlurEventSuppressionLevel;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsWindow::BlurEventsSuppressed()
|
||||
{
|
||||
// are they suppressed in this window?
|
||||
if (mBlurEventSuppressionLevel > 0)
|
||||
return PR_TRUE;
|
||||
|
||||
// are they suppressed by any container widget?
|
||||
HWND parentWnd = ::GetParent(mWnd);
|
||||
if (parentWnd) {
|
||||
nsWindow *parent = GetNSWindowPtr(parentWnd);
|
||||
if (parent)
|
||||
return parent->BlurEventsSuppressed();
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Invokes callback and ProcessEvent method on Event Listener object
|
||||
@ -1108,7 +1137,12 @@ NS_IMETHODIMP nsWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus
|
||||
#endif // NS_DEBUG
|
||||
|
||||
aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
|
||||
// skip processing of suppressed blur events
|
||||
if ((event->message == NS_DEACTIVATE || event->message == NS_LOSTFOCUS) &&
|
||||
BlurEventsSuppressed())
|
||||
return NS_OK;
|
||||
|
||||
if (nsnull != mEventCallback) {
|
||||
aStatus = (*mEventCallback)(event);
|
||||
}
|
||||
|
||||
@ -401,6 +401,9 @@ public:
|
||||
|
||||
void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull);
|
||||
|
||||
void SuppressBlurEvents(PRBool aSuppress);
|
||||
PRBool BlurEventsSuppressed();
|
||||
|
||||
protected:
|
||||
// special callback hook methods for pop ups
|
||||
static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam);
|
||||
@ -525,6 +528,7 @@ protected:
|
||||
PRPackedBool mUnicodeWidget;
|
||||
|
||||
char mLeadByte;
|
||||
PRUint32 mBlurEventSuppressionLevel;
|
||||
|
||||
// XXX Temporary, should not be caching the font
|
||||
nsFont * mFont;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user