Backing out 399852 due to mac mochitest failures

git-svn-id: svn://10.0.0.236/trunk@243161 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dholbert%cs.stanford.edu
2008-01-16 00:56:43 +00:00
parent cba81ff52d
commit d9bd33e144
6 changed files with 1 additions and 163 deletions

View File

@@ -935,62 +935,6 @@ void nsViewManager::UpdateViews(nsView *aView, PRUint32 aUpdateFlags)
}
}
PRBool nsViewManager::sSuppressFocusEvents = PR_FALSE;
nsView *nsViewManager::sCurrentlyFocusView = nsnull;
nsView *nsViewManager::sViewFocusedBeforeSuppression = nsnull;
// Enables/disables focus/blur event suppression. When suppression
// is disabled, we "reboot" the focus by sending a blur to what was
// focused before suppression began, and by sending a focus event to
// what should be currently focused. The suppression should be enabled
// when we're messing with the frame tree, so focus/blur handlers
// don't mess with stuff while we're trying too. See Bug 399852.
void nsViewManager::SetSuppressFocusEvents(PRBool aSuppress)
{
if (sSuppressFocusEvents && !aSuppress) {
// We're turning off suppression, synthesize LOSTFOCUS/GOTFOCUS.
// Turn off suppresion before we send blur/focus events.
sSuppressFocusEvents = PR_FALSE;
if (GetCurrentlyFocusedView() != GetViewFocusedBeforeSuppression()) {
nsIWidget *widget = nsnull;
nsEventStatus status;
// Backup what is focused before we send the blur. If the
// blur causes a focus change, keep that new focus change,
// don't overwrite with the old "currently focused view".
nsIView *currentFocusBeforeBlur = GetCurrentlyFocusedView();
// Send NS_LOSTFOCUS to widget that was focused before
// focus/blur suppression.
if (GetViewFocusedBeforeSuppression()) {
widget = GetViewFocusedBeforeSuppression()->GetWidget();
if (widget) {
nsGUIEvent event(PR_TRUE, NS_LOSTFOCUS, widget);
widget->DispatchEvent(&event, status);
}
}
// Send NS_GOTFOCUS to the widget that we think should be focused.
if (GetCurrentlyFocusedView() &&
currentFocusBeforeBlur == GetCurrentlyFocusedView())
{
widget = GetCurrentlyFocusedView()->GetWidget();
if (widget) {
nsGUIEvent event(PR_TRUE, NS_GOTFOCUS, widget);
widget->DispatchEvent(&event, status);
}
}
}
} else if (!sSuppressFocusEvents && aSuppress) {
// We're turning on focus/blur suppression, remember what had
// the focus.
SetViewFocusedBeforeSuppression(GetCurrentlyFocusedView());
sSuppressFocusEvents = PR_TRUE;
}
}
NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aStatus)
{
*aStatus = nsEventStatus_eIgnore;
@@ -1194,12 +1138,6 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
default:
{
if (aEvent->message == NS_GOTFOCUS)
SetCurrentlyFocusedView(nsView::GetViewFor(aEvent->widget));
if ((aEvent->message == NS_GOTFOCUS || aEvent->message == NS_LOSTFOCUS) &&
nsViewManager::GetSuppressFocusEvents())
break;
if ((NS_IS_MOUSE_EVENT(aEvent) &&
// Ignore moves that we synthesize.
static_cast<nsMouseEvent*>(aEvent)->reason ==