From fd674e7edb5308bc9c04dfa0e526b214750d34d6 Mon Sep 17 00:00:00 2001 From: David Bolter Date: Tue, 15 Jun 2010 10:53:32 -0400 Subject: [PATCH] Bug 569653 - Investigate and fix unsafe selection changes. r=surkov --- accessible/src/html/nsHTMLSelectAccessible.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/accessible/src/html/nsHTMLSelectAccessible.cpp b/accessible/src/html/nsHTMLSelectAccessible.cpp index baaefe869d13..339365232629 100644 --- a/accessible/src/html/nsHTMLSelectAccessible.cpp +++ b/accessible/src/html/nsHTMLSelectAccessible.cpp @@ -40,6 +40,7 @@ #include "nsAccessibilityService.h" #include "nsAccUtils.h" +#include "nsDocAccessible.h" #include "nsEventShell.h" #include "nsIAccessibleEvent.h" #include "nsTextEquivUtils.h" @@ -780,8 +781,14 @@ nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOpti if (!option) return; - nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, - multiSelect); + + nsRefPtr selWithinEvent = + new nsAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, multiSelect); + + if (!selWithinEvent) + return; + + option->GetDocAccessible()->FireDelayedAccessibleEvent(selWithinEvent); PRUint32 state = nsAccUtils::State(option); PRUint32 eventType; @@ -792,7 +799,11 @@ nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOpti eventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE; } - nsEventShell::FireEvent(eventType, option); + nsRefPtr setAddRemoveEvent = + new nsAccEvent(eventType, option); + + if (setAddRemoveEvent) + option->GetDocAccessible()->FireDelayedAccessibleEvent(setAddRemoveEvent); } ////////////////////////////////////////////////////////////////////////////////