Bug 386978 - get rid FireToolkitEvent, r=aaronlev, sr=benjamin

This commit is contained in:
Alexander Surkov 2008-11-04 11:36:36 +08:00
parent 48f41d8587
commit c05ee390bf
5 changed files with 33 additions and 37 deletions

View File

@ -46,7 +46,7 @@ interface nsObjectFrame;
interface nsIContent;
interface nsITimer;
[uuid(27386cf1-f27e-4d2d-9bf4-c4621d50d299)]
[uuid(44685af8-18be-494a-8e64-16c7d4296dd1)]
interface nsIAccessibilityService : nsIAccessibleRetrieval
{
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
@ -112,6 +112,13 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
*/
void processDocLoadEvent(in nsITimer aTimer, in voidPtr aClosure, in PRUint32 aEventType);
/**
* Fire accessible event of the given type for the given target.
*
* @param aEvent [in] accessible event type
* @param aTarget [in] target of accessible event
*/
void fireAccessibleEvent(in unsigned long aEvent, in nsIAccessible aTarget);
};

View File

@ -45,7 +45,7 @@ interface nsIAccessibleEvent;
%}
[ptr] native nsRoleMapEntryPtr(nsRoleMapEntry);
[uuid(893ee16d-c157-4d5f-b236-60b3b2bef6a5)]
[uuid(ed61e5cd-283a-42df-9599-765e0e27f4d9)]
interface nsPIAccessible : nsISupports
{
/**
@ -78,16 +78,6 @@ interface nsPIAccessible : nsISupports
*/
void invalidateChildren();
/**
* Fire accessible event.
*
* @param aEvent - DOM event
* @param aTarget - target of DOM event
*
* XXX: eventually this method will be removed (see bug 377022)
*/
void fireToolkitEvent(in unsigned long aEvent, in nsIAccessible aTarget);
/**
* Fire accessible event.
*/

View File

@ -248,6 +248,13 @@ NS_IMETHODIMP nsAccessibilityService::ProcessDocLoadEvent(nsITimer *aTimer, void
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::FireAccessibleEvent(PRUint32 aEvent,
nsIAccessible *aTarget)
{
return nsAccUtils::FireAccEvent(aEvent, aTarget);
}
void nsAccessibilityService::StartLoadCallback(nsITimer *aTimer, void *aClosure)
{
nsIAccessibilityService *accService = nsAccessNode::GetAccService();

View File

@ -1859,20 +1859,6 @@ nsresult nsAccessible::GetXULName(nsAString& aLabel, PRBool aCanAggregateSubtree
AppendFlatStringFromSubtree(content, &aLabel) : NS_OK;
}
NS_IMETHODIMP
nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget)
{
// Don't fire event for accessible that has been shut down.
if (!mWeakShell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessibleEvent> accEvent =
new nsAccEvent(aEvent, aTarget);
NS_ENSURE_TRUE(accEvent, NS_ERROR_OUT_OF_MEMORY);
return FireAccessibleEvent(accEvent);
}
NS_IMETHODIMP
nsAccessible::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
{

View File

@ -83,8 +83,8 @@
#include "nsGfxCIID.h"
#ifdef ACCESSIBILITY
#include "nsIAccessibilityService.h"
#include "nsIAccessibleRole.h"
#include "nsPIAccessible.h"
#include "nsIAccessibleEvent.h"
#include "prenv.h"
#include "stdlib.h"
@ -6018,11 +6018,14 @@ nsWindow::DispatchActivateEventAccessible(void)
if (sAccessibilityEnabled) {
nsCOMPtr<nsIAccessible> rootAcc;
GetRootAccessible(getter_AddRefs(rootAcc));
nsCOMPtr<nsPIAccessible> privAcc(do_QueryInterface(rootAcc));
if (privAcc) {
privAcc->FireToolkitEvent(
nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE,
rootAcc);
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
accService->FireAccessibleEvent(
nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE,
rootAcc);
}
}
}
@ -6033,11 +6036,14 @@ nsWindow::DispatchDeactivateEventAccessible(void)
if (sAccessibilityEnabled) {
nsCOMPtr<nsIAccessible> rootAcc;
GetRootAccessible(getter_AddRefs(rootAcc));
nsCOMPtr<nsPIAccessible> privAcc(do_QueryInterface(rootAcc));
if (privAcc) {
privAcc->FireToolkitEvent(
nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE,
rootAcc);
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
accService->FireAccessibleEvent(
nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE,
rootAcc);
}
}
}