3065
3068
void nsAccessible::DoCommandCallback(nsITimer *aTimer, void *aClosure)
3067
NS_ASSERTION(gDoCommandTimer, "How did we get here if there was no gDoCommandTimer?");
3070
NS_ASSERTION(gDoCommandTimer,
3071
"How did we get here if there was no gDoCommandTimer?");
3068
3072
NS_RELEASE(gDoCommandTimer);
3070
nsIContent *content = reinterpret_cast<nsIContent*>(aClosure);
3071
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(content));
3073
xulElement->Click();
3076
nsIDocument *doc = content->GetDocument();
3080
nsCOMPtr<nsIPresShell> presShell = doc->GetPrimaryShell();
3081
nsPIDOMWindow *outerWindow = doc->GetWindow();
3082
if (presShell && outerWindow) {
3083
nsAutoPopupStatePusher popupStatePusher(outerWindow, openAllowed);
3085
nsMouseEvent downEvent(PR_TRUE, NS_MOUSE_BUTTON_DOWN, nsnull,
3086
nsMouseEvent::eSynthesized);
3087
nsMouseEvent upEvent(PR_TRUE, NS_MOUSE_BUTTON_UP, nsnull,
3088
nsMouseEvent::eSynthesized);
3089
nsMouseEvent clickEvent(PR_TRUE, NS_MOUSE_CLICK, nsnull,
3090
nsMouseEvent::eSynthesized);
3092
nsEventStatus eventStatus = nsEventStatus_eIgnore;
3093
content->DispatchDOMEvent(&downEvent, nsnull,
3094
presShell->GetPresContext(), &eventStatus);
3095
content->DispatchDOMEvent(&upEvent, nsnull,
3096
presShell->GetPresContext(), &eventStatus);
3097
content->DispatchDOMEvent(&clickEvent, nsnull,
3098
presShell->GetPresContext(), &eventStatus);
3074
nsCOMPtr<nsIContent> content =
3075
reinterpret_cast<nsIContent*>(aClosure);
3077
nsIDocument *doc = content->GetDocument();
3081
nsCOMPtr<nsIPresShell> presShell = doc->GetPrimaryShell();
3083
// Scroll into view.
3084
presShell->ScrollContentIntoView(content, NS_PRESSHELL_SCROLL_ANYWHERE,
3085
NS_PRESSHELL_SCROLL_ANYWHERE);
3087
// Fire mouse down and mouse up events.
3088
PRBool res = nsAccUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,
3093
nsAccUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, content);