From 751ebae195278b35697b1b908e2a08cfb907e71b Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Tue, 21 Jun 2005 20:07:26 +0000 Subject: [PATCH] Bug 297927. Fix accessible focus events on program launch. r=timeless, sr=tor, a=mkaply --- accessible/src/base/nsDocAccessible.cpp | 1 + accessible/src/base/nsRootAccessible.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index 60b834205af..367fd34ca84 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -429,6 +429,7 @@ NS_IMETHODIMP nsDocAccessible::Init() if (mRoleMapEntry && mRoleMapEntry->role != ROLE_DIALOG && mRoleMapEntry->role != ROLE_APPLICATION && + mRoleMapEntry->role != ROLE_ALERT && mRoleMapEntry->role != ROLE_DOCUMENT) { // Document accessible can only have certain roles // This was set in nsAccessible::Init() based on xhtml2:role attribute diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 0dec640b243..041581d7c91 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -587,6 +587,11 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent) } } } + if (accessible == this) { + // Top level window focus events already automatically fired by MSAA + // based on HWND activities. Don't fire the extra focus event. + return NS_OK; + } FireAccessibleFocusEvent(accessible, targetNode); } else if (eventType.EqualsLiteral("ValueChange")) { @@ -862,7 +867,7 @@ NS_IMETHODIMP nsRootAccessible::Shutdown() } mCaretAccessible = nsnull; mAccService = nsnull; - if (mFireEventTimer) { + if (mFireFocusTimer) { mFireFocusTimer->Cancel(); mFireFocusTimer = nsnull; }