This commit is contained in:
tor%cs.brown.edu 2006-07-01 07:44:49 +00:00
Родитель 1f76ae7ee9
Коммит 89f98824f7
9 изменённых файлов: 13 добавлений и 53 удалений

Просмотреть файл

@ -104,7 +104,6 @@ ACCESSIBILITY_ATOM(label, "label")
ACCESSIBILITY_ATOM(li, "li")
ACCESSIBILITY_ATOM(link, "link")
ACCESSIBILITY_ATOM(math, "math")
ACCESSIBILITY_ATOM(menu, "menu") // XUL
ACCESSIBILITY_ATOM(object, "object")
ACCESSIBILITY_ATOM(ol, "ol")
ACCESSIBILITY_ATOM(optgroup, "optgroup")

Просмотреть файл

@ -1192,26 +1192,10 @@ nsAccessibilityService::CreateXULMenuitemAccessible(nsIDOMNode *aNode, nsIAccess
NS_IMETHODIMP
nsAccessibilityService::CreateXULMenupopupAccessible(nsIDOMNode *aNode, nsIAccessible **_retval)
{
*_retval = nsnull;
#ifdef MOZ_XUL
nsCOMPtr<nsIWeakReference> weakShell;
GetShellFromNode(aNode, getter_AddRefs(weakShell));
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
#ifdef MOZ_ACCESSIBILITY_ATK
// ATK considers this node to be redundant when within menubars, and it makes menu
// navigation with assistive technologies more difficult
// XXX In the future we will should this for consistency across the nsIAccessible
// implementations on each platform for a consistent scripting environment, but
// then strip out redundant accessibles in the nsAccessibleWrap class for each platform.
if (content) {
nsIContent *parent = content->GetParent();
if (parent && parent->Tag() == nsAccessibilityAtoms::menu &&
parent->GetNameSpaceID() == kNameSpaceID_XUL) {
return NS_OK;
}
}
#endif
*_retval = new nsXULMenupopupAccessible(aNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;

Просмотреть файл

@ -2208,30 +2208,6 @@ nsBoxFrame::RegUnregAccessKey(PRBool aDoReg)
return rv;
}
void
nsBoxFrame::FireDOMEventSynch(const nsAString& aDOMEventName, nsIContent *aContent)
{
// XXX This will be deprecated, because it is not good to fire synchronous DOM events
// from layout. It's better to use nsFrame::FireDOMEvent() which is asynchronous.
nsPresContext *presContext = GetPresContext();
nsIContent *content = aContent ? aContent : mContent;
if (content && presContext) {
// Fire a DOM event
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIEventListenerManager> manager;
content->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
if (manager && NS_SUCCEEDED(manager->CreateEvent(presContext, nsnull,
NS_LITERAL_STRING("Events"),
getter_AddRefs(event)))) {
event->InitEvent(aDOMEventName, PR_TRUE, PR_TRUE);
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
privateEvent->SetTrusted(PR_TRUE);
nsEventDispatcher::Dispatch(content, presContext, nsnull, event);
}
}
}
void
nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState)

Просмотреть файл

@ -199,11 +199,6 @@ public:
static nsresult LayoutChildAt(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect);
// Fire DOM event. If no aContent argument use frame's mContent.
// XXX This will be deprecated, because it is not good to fire synchronous DOM events
// from layout. It's better to use nsFrame::FireDOMEvent() which is asynchronous.
void FireDOMEventSynch(const nsAString& aDOMEventName, nsIContent *aContent = nsnull);
/**
* Utility method to redirect events on descendants to this frame.
* Supports 'allowevents' attribute on descendant elements to allow those

Просмотреть файл

@ -241,7 +241,7 @@ nsMenuBarFrame::SetActive(PRBool aActiveFlag)
NS_NAMED_LITERAL_STRING(active, "DOMMenuBarActive");
NS_NAMED_LITERAL_STRING(inactive, "DOMMenuBarInactive");
FireDOMEventSynch(mIsActive ? active : inactive);
FireDOMEvent(mIsActive ? active : inactive);
return NS_OK;
}

Просмотреть файл

@ -588,7 +588,7 @@ nsMenuFrame::SelectMenu(PRBool aActivateFlag)
domEventToFire.AssignLiteral("DOMMenuItemInactive");
}
FireDOMEventSynch(domEventToFire);
FireDOMEvent(domEventToFire);
return NS_OK;
}
@ -675,7 +675,7 @@ nsMenuFrame::ActivateMenu(PRBool aActivateFlag)
} else {
if (mMenuOpen) {
FireDOMEventSynch(NS_LITERAL_STRING("DOMMenuInactive"), menuPopup->GetContent());
FireDOMEvent(NS_LITERAL_STRING("DOMMenuInactive"), menuPopup->GetContent());
}
nsIView* view = menuPopup->GetView();
NS_ASSERTION(view, "View is gone, looks like someone forgot to rollup the popup!");

Просмотреть файл

@ -549,7 +549,7 @@ nsPopupSetFrame::ActivatePopup(nsPopupFrameList* aEntry, PRBool aActivateFlag)
viewManager->ResizeView(view, r);
if (aEntry->mIsOpen) {
aEntry->mIsOpen = PR_FALSE;
FireDOMEventSynch(NS_LITERAL_STRING("DOMMenuInactive"), aEntry->mPopupContent);
FireDOMEvent(NS_LITERAL_STRING("DOMMenuInactive"), aEntry->mPopupContent);
}
}
}

Просмотреть файл

@ -23,8 +23,11 @@
<getter>
<![CDATA[
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
// Won't create accessible for (menu)popup if parent node is menu
// to avoid redundant accessible for menu
if (this.localName == "popup" || this.localName == "menupopup")
return accService.createXULMenupopupAccessible(this);
return (this.parentNode.localName != "menu") ?
accService.createXULMenupopupAccessible(this): null;
else if (this.localName == "tooltip")
return accService.createXULTooltipAccessible(this);
return null;

Просмотреть файл

@ -23,8 +23,11 @@
<getter>
<![CDATA[
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
// Won't create accessible for (menu)popup if parent node is menu
// to avoid redundant accessible for menu
if (this.localName == "popup" || this.localName == "menupopup")
return accService.createXULMenupopupAccessible(this);
return (this.parentNode.localName != "menu") ?
accService.createXULMenupopupAccessible(this): null;
else if (this.localName == "tooltip")
return accService.createXULTooltipAccessible(this);
return null;