зеркало из https://github.com/mozilla/pjs.git
Bug 561932 - Make text events async/safe
This commit is contained in:
Родитель
8e1c7edd21
Коммит
b3be573039
|
@ -384,12 +384,20 @@ nsAccStateChangeEvent::IsEnabled(PRBool *aIsEnabled)
|
|||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
|
||||
nsIAccessibleTextChangeEvent)
|
||||
|
||||
// Note: we pass in eAllowDupes to the base class because we don't support text
|
||||
// events coalescence. We fire delayed text change events in nsDocAccessible but
|
||||
// we continue to base the event off the accessible object rather than just the
|
||||
// node. This means we won't try to create an accessible based on the node when
|
||||
// we are ready to fire the event and so we will no longer assert at that point
|
||||
// if the node was removed from the document. Either way, the AT won't work with
|
||||
// a defunct accessible so the behaviour should be equivalent.
|
||||
// XXX revisit this when coalescence is faster (eCoalesceFromSameSubtree)
|
||||
nsAccTextChangeEvent::
|
||||
nsAccTextChangeEvent(nsIAccessible *aAccessible,
|
||||
PRInt32 aStart, PRUint32 aLength, PRBool aIsInserted,
|
||||
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput) :
|
||||
nsAccEvent(aIsInserted ? nsIAccessibleEvent::EVENT_TEXT_INSERTED : nsIAccessibleEvent::EVENT_TEXT_REMOVED,
|
||||
aAccessible, aIsAsynch, aIsFromUserInput),
|
||||
aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes),
|
||||
mStart(aStart), mLength(aLength), mIsInserted(aIsInserted)
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
|
|
|
@ -1492,11 +1492,14 @@ nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// Normally we only fire delayed events created from the node, not an
|
||||
// accessible object. See the nsAccTextChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccTextChangeEvent(accessible, offset,
|
||||
renderedEndOffset - renderedStartOffset,
|
||||
aIsInserted, PR_FALSE);
|
||||
nsEventShell::FireEvent(event);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
|
||||
FireValueChangeForTextFields(accessible);
|
||||
}
|
||||
|
@ -1994,11 +1997,14 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
// XXX Collate events when a range is deleted
|
||||
// XXX We need a way to ignore SplitNode and JoinNode() when they
|
||||
// do not affect the text within the hypertext
|
||||
// Normally we only fire delayed events created from the node, not an
|
||||
// accessible object. See the nsAccTextChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<nsAccEvent> textChangeEvent =
|
||||
CreateTextChangeEventForNode(containerAccessible, childNode, childAccessible,
|
||||
PR_FALSE, isAsynch);
|
||||
if (textChangeEvent) {
|
||||
nsEventShell::FireEvent(textChangeEvent);
|
||||
FireDelayedAccessibleEvent(textChangeEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче