Bug 327918. Setting role='wairole:application' dynamically is not successful. r=ginn.chen, sr=roc

This commit is contained in:
aaronleventhal%moonset.net 2006-04-24 20:19:44 +00:00
Родитель cc75ab1cb9
Коммит abc7b32084
4 изменённых файлов: 26 добавлений и 14 удалений

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

@ -151,4 +151,6 @@ interface nsIAccessibleEvent : nsISupports
const unsigned long EVENT_ATK_WINDOW_MINIMIZE = 0x0123;
const unsigned long EVENT_ATK_WINDOW_RESIZE = 0x0124;
const unsigned long EVENT_ATK_WINDOW_RESTORE = 0x0125;
const unsigned long EVENT_INTERNAL_LOAD = 0xffff;
};

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

@ -443,7 +443,7 @@ NS_IMETHODIMP nsDocAccessible::Init()
mRoleMapEntry->role != ROLE_DOCUMENT) {
// Document accessible can only have certain roles
// This was set in nsAccessible::Init() based on xhtml2:role attribute
mRoleMapEntry->role = nsnull;
mRoleMapEntry = nsnull; // xhtml2:role is not valid
}
return rv;
@ -968,7 +968,17 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents()
if (accessible) {
PRUint32 eventType;
accessibleEvent->GetEventType(&eventType);
FireToolkitEvent(eventType, accessible, nsnull);
if (eventType == nsIAccessibleEvent::EVENT_INTERNAL_LOAD) {
nsCOMPtr<nsPIAccessibleDocument> docAccessible =
do_QueryInterface(accessible);
NS_ASSERTION(docAccessible, "No doc accessible for doc load event");
if (docAccessible) {
docAccessible->FireDocLoadingEvent(PR_TRUE);
}
}
else {
FireToolkitEvent(eventType, accessible, nsnull);
}
}
}
mEventsToFire.Clear(); // Clear out array

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

@ -328,7 +328,7 @@ NS_IMETHODIMP nsRootAccessible::GetCaretAccessible(nsIAccessible **aCaretAccessi
return NS_OK;
}
void nsRootAccessible::TryFireEarlyLoadEvent(nsIAccessible *aAccessible, nsIDOMNode *aDocNode)
void nsRootAccessible::TryFireEarlyLoadEvent(nsIDOMNode *aDocNode)
{
// We can fire an early load event based on DOMContentLoaded unless we
// have subdocuments. For that we wait until WebProgressListener
@ -382,12 +382,8 @@ void nsRootAccessible::TryFireEarlyLoadEvent(nsIAccessible *aAccessible, nsIDOMN
}
// No frames or iframes, so we can fire the doc load finished event early
nsCOMPtr<nsPIAccessibleDocument> docAccessible =
do_QueryInterface(aAccessible);
NS_ASSERTION(docAccessible, "No doc aAccessible for DOMContentLoaded");
if (docAccessible) {
docAccessible->FireDocLoadingEvent(PR_TRUE);
}
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_INTERNAL_LOAD, aDocNode,
nsnull, PR_FALSE);
}
void nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
@ -562,6 +558,14 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
}
}
if (eventType.LowerCaseEqualsLiteral("domcontentloaded")) {
// Don't create the doc accessible until load scripts have a chance to set
// xhtml2:role for <body> or <html> element, because the value of
// xhtml2:role will be cached when the doc accessible is Init()'d
TryFireEarlyLoadEvent(targetNode);
return NS_OK;
}
nsCOMPtr<nsIAccessible> accessible;
if (NS_FAILED(mAccService->GetAccessibleInShell(targetNode, eventShell,
getter_AddRefs(accessible))))
@ -750,9 +754,6 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
// Focus was inside of popup that's being hidden
FireCurrentFocusEvent();
}
else if (eventType.LowerCaseEqualsLiteral("domcontentloaded")) {
TryFireEarlyLoadEvent(accessible, targetNode);
}
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(targetNode));
if (popup) {

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

@ -86,8 +86,7 @@ class nsRootAccessible : public nsDocAccessibleWrap,
nsresult AddEventListeners();
nsresult RemoveEventListeners();
static void GetTargetNode(nsIDOMEvent *aEvent, nsIDOMNode **aTargetNode);
void TryFireEarlyLoadEvent(nsIAccessible *focusAccessible,
nsIDOMNode *focusNode);
void TryFireEarlyLoadEvent(nsIDOMNode *aDocNode);
void FireAccessibleFocusEvent(nsIAccessible *focusAccessible,
nsIDOMNode *focusNode,
nsIDOMEvent *aFocusEvent,