mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 524696 Use nsTArray<nsRefPtr<nsAccEvent> > for mEventsToFire r=surkov.alexander sr=bzbarsky
This commit is contained in:
parent
b06f4eb4a0
commit
446a9c10f9
@ -307,17 +307,17 @@ nsAccEvent::GetAccessibleByNode()
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire)
|
||||
nsAccEvent::ApplyEventRules(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire)
|
||||
{
|
||||
PRUint32 numQueuedEvents = aEventsToFire.Length();
|
||||
PRInt32 tail = numQueuedEvents - 1;
|
||||
|
||||
nsRefPtr<nsAccEvent> tailEvent = GetAccEventPtr(aEventsToFire[tail]);
|
||||
nsAccEvent* tailEvent = aEventsToFire[tail];
|
||||
switch(tailEvent->mEventRule) {
|
||||
case nsAccEvent::eCoalesceFromSameSubtree:
|
||||
{
|
||||
for (PRInt32 index = 0; index < tail; index ++) {
|
||||
nsRefPtr<nsAccEvent> thisEvent = GetAccEventPtr(aEventsToFire[index]);
|
||||
nsAccEvent* thisEvent = aEventsToFire[index];
|
||||
if (thisEvent->mEventType != tailEvent->mEventType)
|
||||
continue; // Different type
|
||||
|
||||
@ -381,7 +381,7 @@ nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFi
|
||||
{
|
||||
// Check for repeat events.
|
||||
for (PRInt32 index = 0; index < tail; index ++) {
|
||||
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aEventsToFire[index]);
|
||||
nsAccEvent* accEvent = aEventsToFire[index];
|
||||
if (accEvent->mEventType == tailEvent->mEventType &&
|
||||
accEvent->mEventRule == tailEvent->mEventRule &&
|
||||
accEvent->mDOMNode == tailEvent->mDOMNode) {
|
||||
@ -397,13 +397,13 @@ nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFi
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsAccEvent::ApplyToSiblings(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire,
|
||||
nsAccEvent::ApplyToSiblings(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
PRUint32 aEventType, nsIDOMNode* aDOMNode,
|
||||
EEventRule aEventRule)
|
||||
PRUint32 aEventType, nsIDOMNode* aDOMNode,
|
||||
EEventRule aEventRule)
|
||||
{
|
||||
for (PRUint32 index = aStart; index < aEnd; index ++) {
|
||||
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aEventsToFire[index]);
|
||||
nsAccEvent* accEvent = aEventsToFire[index];
|
||||
if (accEvent->mEventType == aEventType &&
|
||||
accEvent->mEventRule != nsAccEvent::eDoNotEmit &&
|
||||
nsCoreUtils::AreSiblings(accEvent->mDOMNode, aDOMNode)) {
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
class nsIPresShell;
|
||||
|
||||
@ -126,11 +127,13 @@ public:
|
||||
return eventType;
|
||||
}
|
||||
static EEventRule EventRule(nsIAccessibleEvent *aAccEvent) {
|
||||
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aAccEvent);
|
||||
nsRefPtr<nsAccEvent> accEvent =
|
||||
nsAccUtils::QueryObject<nsAccEvent>(aAccEvent);
|
||||
return accEvent->mEventRule;
|
||||
}
|
||||
static PRBool IsAsyncEvent(nsIAccessibleEvent *aAccEvent) {
|
||||
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aAccEvent);
|
||||
nsRefPtr<nsAccEvent> accEvent =
|
||||
nsAccUtils::QueryObject<nsAccEvent>(aAccEvent);
|
||||
return accEvent->mIsAsync;
|
||||
}
|
||||
static PRBool IsFromUserInput(nsIAccessibleEvent *aAccEvent) {
|
||||
@ -169,15 +172,9 @@ public:
|
||||
* Event rule of filtered events will be set to eDoNotEmit.
|
||||
* Events with other event rule are good to emit.
|
||||
*/
|
||||
static void ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire);
|
||||
static void ApplyEventRules(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire);
|
||||
|
||||
private:
|
||||
static already_AddRefed<nsAccEvent> GetAccEventPtr(nsIAccessibleEvent *aAccEvent) {
|
||||
nsAccEvent* accEvent = nsnull;
|
||||
aAccEvent->QueryInterface(NS_GET_IID(nsAccEvent), (void**)&accEvent);
|
||||
return accEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply aEventRule to same type event that from sibling nodes of aDOMNode.
|
||||
* @param aEventsToFire array of pending events
|
||||
@ -188,7 +185,7 @@ private:
|
||||
* @param aEventRule the event rule to be applied
|
||||
* (should be eDoNotEmit or eAllowDupes)
|
||||
*/
|
||||
static void ApplyToSiblings(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire,
|
||||
static void ApplyToSiblings(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
PRUint32 aEventType, nsIDOMNode* aDOMNode,
|
||||
EEventRule aEventRule);
|
||||
|
@ -1590,7 +1590,8 @@ nsDocAccessible::FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG(aEvent);
|
||||
|
||||
mEventsToFire.AppendElement(aEvent);
|
||||
nsRefPtr<nsAccEvent> accEvent = nsAccUtils::QueryObject<nsAccEvent>(aEvent);
|
||||
mEventsToFire.AppendElement(accEvent);
|
||||
|
||||
// Filter events.
|
||||
nsAccEvent::ApplyEventRules(mEventsToFire);
|
||||
|
@ -296,7 +296,7 @@ protected:
|
||||
|
||||
PRBool mInFlushPendingEvents;
|
||||
PRBool mFireEventTimerStarted;
|
||||
nsTArray<nsCOMPtr<nsIAccessibleEvent> > mEventsToFire;
|
||||
nsTArray<nsRefPtr<nsAccEvent> > mEventsToFire;
|
||||
|
||||
static PRUint32 gLastFocusedAccessiblesState;
|
||||
static nsIAtom *gLastFocusedFrameType;
|
||||
|
Loading…
Reference in New Issue
Block a user