Bug 613146 - amazon.de isn't read by NVDA, r=marcoz, davidb, a=final+

This commit is contained in:
Alexander Surkov 2010-11-22 16:22:04 +08:00
Родитель 104ca33723
Коммит 82d84e9639
8 изменённых файлов: 26 добавлений и 31 удалений

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

@ -214,6 +214,10 @@ nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress,
nsEventShell::FireEvent(reloadEvent);
}
// Mark the document accessible as loading, if it stays alive then we'll mark
// it as loaded when we receive proper notification.
docAcc->MarkAsLoading();
// Fire state busy change event. Use delayed event since we don't care
// actually if event isn't delivered when the document goes away like a shot.
nsRefPtr<AccEvent> stateEvent =
@ -310,8 +314,7 @@ nsAccDocManager::HandleEvent(nsIDOMEvent *aEvent)
nsCoreUtils::IsErrorPage(document)) {
NS_LOG_ACCDOCLOAD2("handled 'DOMContentLoaded' event", document)
HandleDOMDocumentLoad(document,
nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE,
PR_TRUE);
nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE);
}
return NS_OK;
@ -322,8 +325,7 @@ nsAccDocManager::HandleEvent(nsIDOMEvent *aEvent)
void
nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
PRUint32 aLoadEventType,
PRBool aMarkAsLoaded)
PRUint32 aLoadEventType)
{
// Document accessible can be created before we were notified the DOM document
// was loaded completely. However if it's not created yet then create it.
@ -335,8 +337,8 @@ nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
return;
}
if (aMarkAsLoaded)
docAcc->MarkAsLoaded();
// Mark the document as loaded to drop off the busy state flag on it.
docAcc->MarkAsLoaded();
// Do not fire document complete/stop events for root chrome document
// accessibles and for frame/iframe documents because

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

@ -116,13 +116,9 @@ private:
* @param aDocument [in] loaded DOM document
* @param aLoadEventType [in] specifies the event type to fire load event,
* if 0 then no event is fired
* @param aMarkAsLoaded [in] indicates whether we should mark forcedly
* an accessible document as loaded (used for error
* pages only which do not get 'pageshow' event)
*/
void HandleDOMDocumentLoad(nsIDocument *aDocument,
PRUint32 aLoadEventType,
PRBool aMarkAsLoaded = PR_FALSE);
PRUint32 aLoadEventType);
/**
* Return true if accessibility events accompanying document accessible

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

@ -460,19 +460,6 @@ nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
return docShellTreeItem;
}
PRBool
nsCoreUtils::IsDocumentBusy(nsIDocument *aDocument)
{
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (!docShell)
return PR_TRUE;
PRUint32 busyFlags = 0;
docShell->GetBusyFlags(&busyFlags);
return (busyFlags != nsIDocShell::BUSY_FLAGS_NONE);
}
PRBool
nsCoreUtils::IsRootDocument(nsIDocument *aDocument)
{

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

@ -223,11 +223,6 @@ public:
static already_AddRefed<nsIDocShellTreeItem>
GetDocShellTreeItemFor(nsINode *aNode);
/**
* Return true if document is loading.
*/
static PRBool IsDocumentBusy(nsIDocument *aDocument);
/**
* Return true if the given document is root document.
*/

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

@ -319,7 +319,7 @@ nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
*aState |= nsIAccessibleStates::STATE_FOCUSED;
}
if (nsCoreUtils::IsDocumentBusy(mDocument)) {
if (!mIsLoaded) {
*aState |= nsIAccessibleStates::STATE_BUSY;
if (aExtraState) {
*aExtraState |= nsIAccessibleStates::EXT_STATE_STALE;

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

@ -138,11 +138,14 @@ public:
}
/**
* Marks as loaded, used for error pages as workaround since they do not
* Marks this document as loaded or loading, used to expose busy state.
* The loaded flag has special meaning for error pages and used as workaround
* to make IsContentLoaded() return correct result since these pages do not
* receive pageshow event and as consequence nsIDocument::IsShowing() returns
* false.
*/
void MarkAsLoaded() { mIsLoaded = PR_TRUE; }
void MarkAsLoading() { mIsLoaded = PR_FALSE; }
/**
* Return a native window handler or pointer depending on platform.

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

@ -28,6 +28,13 @@
gOpenerWnd.SimpleTest.is(aExpected, aActual, aMsg);
}
function testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState,
aAbsentExtraState)
{
gOpenerWnd.testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState,
aAbsentExtraState);
}
var invokerChecker = gOpenerWnd.invokerChecker;
const STATE_BUSY = gOpenerWnd.STATE_BUSY;
@ -91,6 +98,9 @@
is(event.state, STATE_BUSY, "Wrong state of statechange event.");
is(event.isEnabled(), aIsEnabled,
"Wrong value of state of statechange event");
testStates(event.accessible, (aIsEnabled ? STATE_BUSY : 0), 0,
(aIsEnabled ? 0 : STATE_BUSY), 0);
}
}

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

@ -17,6 +17,8 @@
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>