mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Merge m-c to fx-team.
This commit is contained in:
commit
b4af68ab55
1
.hgtags
1
.hgtags
@ -88,3 +88,4 @@ b6627f28b7ec17e1b46a594df0f780d3a40847e4 FIREFOX_AURORA_13_BASE
|
||||
6fdf9985acfe6f939da584b2559464ab22264fe7 FIREFOX_AURORA_16_BASE
|
||||
fd72dbbd692012224145be1bf13df1d7675fd277 FIREFOX_AURORA_17_BASE
|
||||
2704e441363fe2a48e992dfac694482dfd82664a FIREFOX_AURORA_18_BASE
|
||||
cf8750abee06cde395c659f8ecd8ae019d7512e3 FIREFOX_AURORA_19_BASE
|
||||
|
@ -12,7 +12,14 @@
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
class nsINode;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
@ -37,15 +44,17 @@ public:
|
||||
* @param aCanCreate [in] points whether the root document accessible
|
||||
* should be returned from the cache or can be created
|
||||
*/
|
||||
virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
|
||||
bool aCanCreate) = 0;
|
||||
virtual mozilla::a11y::Accessible*
|
||||
GetRootDocumentAccessible(nsIPresShell* aPresShell, bool aCanCreate) = 0;
|
||||
|
||||
/**
|
||||
* Adds/remove ATK root accessible for gtk+ native window to/from children
|
||||
* of the application accessible.
|
||||
*/
|
||||
virtual Accessible* AddNativeRootAccessible(void* aAtkAccessible) = 0;
|
||||
virtual void RemoveNativeRootAccessible(Accessible* aRootAccessible) = 0;
|
||||
virtual mozilla::a11y::Accessible*
|
||||
AddNativeRootAccessible(void* aAtkAccessible) = 0;
|
||||
virtual void
|
||||
RemoveNativeRootAccessible(mozilla::a11y::Accessible* aRootAccessible) = 0;
|
||||
|
||||
/**
|
||||
* Fire accessible event of the given type for the given target.
|
||||
@ -53,7 +62,8 @@ public:
|
||||
* @param aEvent [in] accessible event type
|
||||
* @param aTarget [in] target of accessible event
|
||||
*/
|
||||
virtual void FireAccessibleEvent(uint32_t aEvent, Accessible* aTarget) = 0;
|
||||
virtual void FireAccessibleEvent(uint32_t aEvent,
|
||||
mozilla::a11y::Accessible* aTarget) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIAccessibilityService,
|
||||
|
@ -41,6 +41,9 @@ struct AtkPropertyChange {
|
||||
void *newvalue;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class MaiHyperlink;
|
||||
|
||||
/**
|
||||
@ -110,4 +113,7 @@ private:
|
||||
uint16_t CreateMaiInterfaces(void);
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* __NS_ACCESSIBLE_WRAP_H__ */
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "nsMai.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
AtkSocketEmbedType AtkSocketAccessible::g_atk_socket_embed = NULL;
|
||||
GType AtkSocketAccessible::g_atk_socket_type = G_TYPE_INVALID;
|
||||
const char* AtkSocketAccessible::sATKSocketEmbedSymbol = "atk_socket_embed";
|
||||
|
@ -17,6 +17,9 @@ extern "C" typedef void (*AtkSocketEmbedType) (AtkSocket*, gchar*);
|
||||
extern "C" typedef void (*AtkSocketEmbedType) (void*, void*);
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Provides a AccessibleWrap wrapper around AtkSocket for out-of-process
|
||||
* accessibles.
|
||||
@ -49,4 +52,7 @@ public:
|
||||
NS_IMETHODIMP GetNativeInterface(void** aOutAccessible);
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "nsMai.h"
|
||||
#include "DocAccessibleWrap.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DocAccessibleWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -13,6 +13,9 @@
|
||||
|
||||
#include "DocAccessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class DocAccessibleWrap : public DocAccessible
|
||||
{
|
||||
public:
|
||||
@ -23,4 +26,7 @@ public:
|
||||
bool mActivated;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -9,7 +9,13 @@
|
||||
|
||||
#include "HyperTextAccessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
typedef class HyperTextAccessible HyperTextAccessibleWrap;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -9,8 +9,14 @@
|
||||
|
||||
#include <atk/atk.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccessibleWrap;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
extern "C" {
|
||||
void actionInterfaceInitCB(AtkActionIface* aIface);
|
||||
void componentInterfaceInitCB(AtkComponentIface* aIface);
|
||||
@ -28,9 +34,9 @@ void valueInterfaceInitCB(AtkValueIface *aIface);
|
||||
/**
|
||||
* XXX these should live in a file of utils for atk.
|
||||
*/
|
||||
AtkObject* refAccessibleAtPointHelper(AccessibleWrap* aAccWrap,
|
||||
AtkObject* refAccessibleAtPointHelper(mozilla::a11y::AccessibleWrap* aAccWrap,
|
||||
gint aX, gint aY, AtkCoordType aCoordType);
|
||||
void getExtentsHelper(AccessibleWrap* aAccWrap,
|
||||
void getExtentsHelper(mozilla::a11y::AccessibleWrap* aAccWrap,
|
||||
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
|
||||
AtkCoordType aCoordType);
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNodeWrap
|
||||
|
@ -13,7 +13,10 @@
|
||||
|
||||
#include "nsAccessNode.h"
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);
|
||||
@ -23,4 +26,7 @@ public: // construction, destruction
|
||||
static void ShutdownAccessibility();
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -46,6 +46,6 @@ PR_END_MACRO
|
||||
MAI_TYPE_ATK_OBJECT, \
|
||||
MaiAtkObjectClass))
|
||||
GType mai_atk_object_get_type(void);
|
||||
AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
|
||||
mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
|
||||
|
||||
#endif /* __NS_MAI_H__ */
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsMaiHyperlink.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
/* MaiAtkHyperlink */
|
||||
|
||||
#define MAI_TYPE_ATK_HYPERLINK (mai_atk_hyperlink_get_type ())
|
||||
|
@ -13,6 +13,9 @@
|
||||
struct _AtkHyperlink;
|
||||
typedef struct _AtkHyperlink AtkHyperlink;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/*
|
||||
* MaiHyperlink is a auxiliary class for MaiInterfaceHyperText.
|
||||
*/
|
||||
@ -34,4 +37,8 @@ protected:
|
||||
public:
|
||||
static nsresult Initialize(AtkHyperlink *aObj, MaiHyperlink *aClass);
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* __MAI_HYPERLINK_H__ */
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "nsMai.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
extern "C" {
|
||||
|
||||
static AtkObject*
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "nsMai.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
static const char* const kDocTypeName = "W3C-doctype";
|
||||
static const char* const kDocUrlName = "DocURL";
|
||||
static const char* const kMimeTypeName = "MimeType";
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "nsString.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
extern "C" {
|
||||
static void
|
||||
setTextContentsCB(AtkEditableText *aText, const gchar *aString)
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "nsMaiHyperlink.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
extern "C" {
|
||||
static AtkHyperlink*
|
||||
getHyperlinkCB(AtkHyperlinkImpl* aImpl)
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "nsMaiHyperlink.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
extern "C" {
|
||||
|
||||
static AtkHyperlink*
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#include <atk/atk.h>
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
extern "C" {
|
||||
|
||||
static gboolean
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "AccessibleWrap.h"
|
||||
#include "nsMai.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
extern "C" {
|
||||
|
||||
static void
|
||||
|
@ -9,11 +9,11 @@
|
||||
|
||||
#include "nsTArray.h"
|
||||
|
||||
class Accessible;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
|
||||
/**
|
||||
* Collect accessible children complying with filter function. Provides quick
|
||||
* access to accessible by index.
|
||||
@ -86,7 +86,7 @@ protected:
|
||||
|
||||
virtual void AppendObject(Accessible* aAccessible);
|
||||
|
||||
friend class ::Accessible;
|
||||
friend class Accessible;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
@ -32,50 +32,15 @@ AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
EIsFromUserInput aIsFromUserInput, EEventRule aEventRule) :
|
||||
mEventType(aEventType), mEventRule(aEventRule), mAccessible(aAccessible)
|
||||
{
|
||||
CaptureIsFromUserInput(aIsFromUserInput);
|
||||
}
|
||||
|
||||
AccEvent::AccEvent(uint32_t aEventType, nsINode* aNode,
|
||||
EIsFromUserInput aIsFromUserInput, EEventRule aEventRule) :
|
||||
mEventType(aEventType), mEventRule(aEventRule), mNode(aNode)
|
||||
{
|
||||
CaptureIsFromUserInput(aIsFromUserInput);
|
||||
if (aIsFromUserInput == eAutoDetect)
|
||||
mIsFromUserInput = nsEventStateManager::IsHandlingUserInput();
|
||||
else
|
||||
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccEvent public methods
|
||||
|
||||
Accessible*
|
||||
AccEvent::GetAccessible()
|
||||
{
|
||||
if (!mAccessible)
|
||||
mAccessible = GetAccessibleForNode();
|
||||
|
||||
return mAccessible;
|
||||
}
|
||||
|
||||
nsINode*
|
||||
AccEvent::GetNode()
|
||||
{
|
||||
if (!mNode && mAccessible)
|
||||
mNode = mAccessible->GetNode();
|
||||
|
||||
return mNode;
|
||||
}
|
||||
|
||||
DocAccessible*
|
||||
AccEvent::GetDocAccessible()
|
||||
{
|
||||
if (mAccessible)
|
||||
return mAccessible->Document();
|
||||
|
||||
nsINode* node = GetNode();
|
||||
if (node)
|
||||
return GetAccService()->GetDocAccessible(node->OwnerDoc());
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccEvent::CreateXPCOMObject()
|
||||
{
|
||||
@ -101,99 +66,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccEvent protected methods
|
||||
|
||||
Accessible*
|
||||
AccEvent::GetAccessibleForNode() const
|
||||
{
|
||||
if (mNode) {
|
||||
DocAccessible* document =
|
||||
GetAccService()->GetDocAccessible(mNode->OwnerDoc());
|
||||
if (document)
|
||||
return document->GetAccessible(mNode);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
nsINode *targetNode = GetNode();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!targetNode) {
|
||||
// XXX: remove this hack during reorganization of 506907. Meanwhile we
|
||||
// want to get rid an assertion for application accessible events which
|
||||
// don't have DOM node (see bug 506206).
|
||||
|
||||
if (mAccessible != static_cast<nsIAccessible*>(ApplicationAcc()))
|
||||
NS_ASSERTION(targetNode, "There should always be a DOM node for an event");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aIsFromUserInput != eAutoDetect) {
|
||||
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!targetNode)
|
||||
return;
|
||||
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(targetNode);
|
||||
if (!presShell) {
|
||||
NS_NOTREACHED("Threre should always be an pres shell for an event");
|
||||
return;
|
||||
}
|
||||
|
||||
nsEventStateManager *esm = presShell->GetPresContext()->EventStateManager();
|
||||
if (!esm) {
|
||||
NS_NOTREACHED("There should always be an ESM for an event");
|
||||
return;
|
||||
}
|
||||
|
||||
mIsFromUserInput = esm->IsHandlingUserInputExternal();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccStateChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Note: we pass in eAllowDupes to the base class because we don't currently
|
||||
// support correct state change coalescence (XXX Bug 569356). Also we need to
|
||||
// decide how to coalesce events created via accessible (instead of node).
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(Accessible* aAccessible, uint64_t aState,
|
||||
bool aIsEnabled, EIsFromUserInput aIsFromUserInput):
|
||||
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
mState(aState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, uint64_t aState, bool aIsEnabled):
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode,
|
||||
eAutoDetect, eAllowDupes),
|
||||
mState(aState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, uint64_t aState) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode,
|
||||
eAutoDetect, eAllowDupes),
|
||||
mState(aState)
|
||||
{
|
||||
// Use GetAccessibleForNode() because we do not want to store an accessible
|
||||
// since it leads to problems with delayed events in the case when
|
||||
// an accessible gets reorder event before delayed event is processed.
|
||||
Accessible* accessible = GetAccessibleForNode();
|
||||
mIsEnabled = accessible && ((accessible->State() & mState) != 0);
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccStateChangeEvent::CreateXPCOMObject()
|
||||
{
|
||||
@ -296,20 +172,6 @@ AccShowEvent::
|
||||
// AccCaretMoveEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AccCaretMoveEvent::
|
||||
AccCaretMoveEvent(Accessible* aAccessible, int32_t aCaretOffset) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible),
|
||||
mCaretOffset(aCaretOffset)
|
||||
{
|
||||
}
|
||||
|
||||
AccCaretMoveEvent::
|
||||
AccCaretMoveEvent(nsINode* aNode) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode),
|
||||
mCaretOffset(-1)
|
||||
{
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccCaretMoveEvent::CreateXPCOMObject()
|
||||
{
|
||||
|
@ -10,9 +10,13 @@
|
||||
|
||||
#include "mozilla/a11y/Accessible.h"
|
||||
|
||||
class nsAccEvent;
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class DocAccessible;
|
||||
|
||||
class nsAccEvent;
|
||||
|
||||
// Constants used to point whether the event is from user input.
|
||||
enum EIsFromUserInput
|
||||
{
|
||||
@ -34,17 +38,18 @@ public:
|
||||
// Rule for accessible events.
|
||||
// The rule will be applied when flushing pending events.
|
||||
enum EEventRule {
|
||||
// eAllowDupes : More than one event of the same type is allowed.
|
||||
// This event will always be emitted.
|
||||
eAllowDupes,
|
||||
// eAllowDupes : More than one event of the same type is allowed.
|
||||
// This event will always be emitted. This flag is used for events that
|
||||
// don't support coalescence.
|
||||
eAllowDupes,
|
||||
|
||||
// eCoalesceReorder : For reorder events from the same subtree or the same
|
||||
// node, only the umbrella event on the ancestor will be emitted.
|
||||
eCoalesceReorder,
|
||||
eCoalesceReorder,
|
||||
|
||||
// eCoalesceMutationTextChange : coalesce text change events caused by
|
||||
// tree mutations of the same tree level.
|
||||
eCoalesceMutationTextChange,
|
||||
eCoalesceMutationTextChange,
|
||||
|
||||
// eCoalesceOfSameType : For events of the same type, only the newest event
|
||||
// will be processed.
|
||||
@ -55,20 +60,16 @@ public:
|
||||
|
||||
// eRemoveDupes : For repeat events, only the newest event in queue
|
||||
// will be emitted.
|
||||
eRemoveDupes,
|
||||
eRemoveDupes,
|
||||
|
||||
// eDoNotEmit : This event is confirmed as a duplicate, do not emit it.
|
||||
eDoNotEmit
|
||||
eDoNotEmit
|
||||
};
|
||||
|
||||
// Initialize with an nsIAccessible
|
||||
AccEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
// Initialize with an nsINode
|
||||
AccEvent(uint32_t aEventType, nsINode* aNode,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
virtual ~AccEvent() {}
|
||||
|
||||
// AccEvent
|
||||
@ -76,9 +77,8 @@ public:
|
||||
EEventRule GetEventRule() const { return mEventRule; }
|
||||
bool IsFromUserInput() const { return mIsFromUserInput; }
|
||||
|
||||
Accessible* GetAccessible();
|
||||
DocAccessible* GetDocAccessible();
|
||||
nsINode* GetNode();
|
||||
Accessible* GetAccessible() const { return mAccessible; }
|
||||
DocAccessible* GetDocAccessible() const { return mAccessible->Document(); }
|
||||
|
||||
/**
|
||||
* Create and return an XPCOM object for accessible event object.
|
||||
@ -115,22 +115,10 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AccEvent)
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Get an accessible from event target node.
|
||||
*/
|
||||
Accessible* GetAccessibleForNode() const;
|
||||
|
||||
/**
|
||||
* Determine whether the event is from user input by event state manager if
|
||||
* it's not pointed explicetly.
|
||||
*/
|
||||
void CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput);
|
||||
|
||||
bool mIsFromUserInput;
|
||||
uint32_t mEventType;
|
||||
EEventRule mEventRule;
|
||||
nsRefPtr<Accessible> mAccessible;
|
||||
nsCOMPtr<nsINode> mNode;
|
||||
|
||||
friend class NotificationController;
|
||||
friend class AccReorderEvent;
|
||||
@ -145,11 +133,15 @@ class AccStateChangeEvent: public AccEvent
|
||||
public:
|
||||
AccStateChangeEvent(Accessible* aAccessible, uint64_t aState,
|
||||
bool aIsEnabled,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect) :
|
||||
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
mState(aState), mIsEnabled(aIsEnabled) { }
|
||||
|
||||
AccStateChangeEvent(nsINode* aNode, uint64_t aState, bool aIsEnabled);
|
||||
|
||||
AccStateChangeEvent(nsINode* aNode, uint64_t aState);
|
||||
AccStateChangeEvent(Accessible* aAccessible, uint64_t aState) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
||||
eAutoDetect, eAllowDupes), mState(aState)
|
||||
{ mIsEnabled = (mAccessible->State() & mState) != 0; }
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
@ -235,6 +227,7 @@ public:
|
||||
bool IsHide() const { return mEventType == nsIAccessibleEvent::EVENT_HIDE; }
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsINode> mNode;
|
||||
nsRefPtr<Accessible> mParent;
|
||||
nsRefPtr<AccTextChangeEvent> mTextChangeEvent;
|
||||
|
||||
@ -346,8 +339,10 @@ protected:
|
||||
class AccCaretMoveEvent: public AccEvent
|
||||
{
|
||||
public:
|
||||
AccCaretMoveEvent(Accessible* aAccessible, int32_t aCaretOffset);
|
||||
AccCaretMoveEvent(nsINode* aNode);
|
||||
AccCaretMoveEvent(Accessible* aAccessible) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible),
|
||||
mCaretOffset(-1) { }
|
||||
virtual ~AccCaretMoveEvent() { }
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
@ -363,6 +358,8 @@ public:
|
||||
|
||||
private:
|
||||
int32_t mCaretOffset;
|
||||
|
||||
friend class NotificationController;
|
||||
};
|
||||
|
||||
|
||||
@ -486,5 +483,8 @@ private:
|
||||
AccEvent* mRawPtr;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -8,6 +8,9 @@
|
||||
#include "Accessible-inl.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Calculate and store group information.
|
||||
*/
|
||||
@ -76,4 +79,7 @@ private:
|
||||
Accessible* mParent;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
} // namespace a11y
|
||||
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
virtual Accessible* Next() = 0;
|
||||
|
||||
private:
|
||||
friend class mozilla::a11y::Relation;
|
||||
friend class Relation;
|
||||
nsAutoPtr<AccIterable> mNextIter;
|
||||
};
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsAccDocManager.h"
|
||||
#include "DocManager.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "ApplicationAccessible.h"
|
||||
@ -33,14 +33,14 @@
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccDocManager
|
||||
// DocManager
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccDocManager public
|
||||
// DocManager public
|
||||
|
||||
DocAccessible*
|
||||
nsAccDocManager::GetDocAccessible(nsIDocument *aDocument)
|
||||
DocManager::GetDocAccessible(nsIDocument* aDocument)
|
||||
{
|
||||
if (!aDocument)
|
||||
return nullptr;
|
||||
@ -56,7 +56,7 @@ nsAccDocManager::GetDocAccessible(nsIDocument *aDocument)
|
||||
}
|
||||
|
||||
Accessible*
|
||||
nsAccDocManager::FindAccessibleInCache(nsINode* aNode) const
|
||||
DocManager::FindAccessibleInCache(nsINode* aNode) const
|
||||
{
|
||||
nsSearchAccessibleInCacheArg arg;
|
||||
arg.mNode = aNode;
|
||||
@ -69,7 +69,7 @@ nsAccDocManager::FindAccessibleInCache(nsINode* aNode) const
|
||||
|
||||
#ifdef DEBUG
|
||||
bool
|
||||
nsAccDocManager::IsProcessingRefreshDriverNotification() const
|
||||
DocManager::IsProcessingRefreshDriverNotification() const
|
||||
{
|
||||
bool isDocRefreshing = false;
|
||||
mDocAccessibleCache.EnumerateRead(SearchIfDocIsRefreshing,
|
||||
@ -81,10 +81,10 @@ nsAccDocManager::IsProcessingRefreshDriverNotification() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccDocManager protected
|
||||
// DocManager protected
|
||||
|
||||
bool
|
||||
nsAccDocManager::Init()
|
||||
DocManager::Init()
|
||||
{
|
||||
mDocAccessibleCache.Init(4);
|
||||
|
||||
@ -101,7 +101,7 @@ nsAccDocManager::Init()
|
||||
}
|
||||
|
||||
void
|
||||
nsAccDocManager::Shutdown()
|
||||
DocManager::Shutdown()
|
||||
{
|
||||
nsCOMPtr<nsIWebProgress> progress =
|
||||
do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID);
|
||||
@ -115,7 +115,7 @@ nsAccDocManager::Shutdown()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS3(nsAccDocManager,
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS3(DocManager,
|
||||
nsIWebProgressListener,
|
||||
nsIDOMEventListener,
|
||||
nsISupportsWeakReference)
|
||||
@ -124,9 +124,9 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsAccDocManager,
|
||||
// nsIWebProgressListener
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, uint32_t aStateFlags,
|
||||
nsresult aStatus)
|
||||
DocManager::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest, uint32_t aStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
NS_ASSERTION(aStateFlags & STATE_IS_DOCUMENT, "Other notifications excluded");
|
||||
|
||||
@ -203,39 +203,39 @@ nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccDocManager::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
int32_t aCurSelfProgress,
|
||||
int32_t aMaxSelfProgress,
|
||||
int32_t aCurTotalProgress,
|
||||
int32_t aMaxTotalProgress)
|
||||
DocManager::OnProgressChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
int32_t aCurSelfProgress,
|
||||
int32_t aMaxSelfProgress,
|
||||
int32_t aCurTotalProgress,
|
||||
int32_t aMaxTotalProgress)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccDocManager::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsIURI *aLocation,
|
||||
uint32_t aFlags)
|
||||
DocManager::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest, nsIURI* aLocation,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccDocManager::OnStatusChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsresult aStatus,
|
||||
const PRUnichar *aMessage)
|
||||
DocManager::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest, nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccDocManager::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
uint32_t aState)
|
||||
DocManager::OnSecurityChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
uint32_t aState)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
@ -245,7 +245,7 @@ nsAccDocManager::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
// nsIDOMEventListener
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccDocManager::HandleEvent(nsIDOMEvent *aEvent)
|
||||
DocManager::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsAutoString type;
|
||||
aEvent->GetType(type);
|
||||
@ -303,11 +303,11 @@ nsAccDocManager::HandleEvent(nsIDOMEvent *aEvent)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccDocManager private
|
||||
// DocManager private
|
||||
|
||||
void
|
||||
nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
|
||||
uint32_t aLoadEventType)
|
||||
DocManager::HandleDOMDocumentLoad(nsIDocument* aDocument,
|
||||
uint32_t 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.
|
||||
@ -322,8 +322,8 @@ nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
|
||||
}
|
||||
|
||||
void
|
||||
nsAccDocManager::AddListeners(nsIDocument *aDocument,
|
||||
bool aAddDOMContentLoadedListener)
|
||||
DocManager::AddListeners(nsIDocument* aDocument,
|
||||
bool aAddDOMContentLoadedListener)
|
||||
{
|
||||
nsPIDOMWindow *window = aDocument->GetWindow();
|
||||
nsIDOMEventTarget *target = window->GetChromeEventHandler();
|
||||
@ -347,7 +347,7 @@ nsAccDocManager::AddListeners(nsIDocument *aDocument,
|
||||
}
|
||||
|
||||
DocAccessible*
|
||||
nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
||||
DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
||||
{
|
||||
// Ignore temporary, hiding, resource documents and documents without
|
||||
// docshell.
|
||||
@ -400,9 +400,8 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
||||
// the same document.
|
||||
// Note: don't use AccReorderEvent to avoid coalsecense and special reorder
|
||||
// events processing.
|
||||
nsRefPtr<AccEvent> reorderEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_REORDER, ApplicationAcc());
|
||||
docAcc->FireDelayedAccessibleEvent(reorderEvent);
|
||||
docAcc->FireDelayedEvent(nsIAccessibleEvent::EVENT_REORDER,
|
||||
ApplicationAcc());
|
||||
|
||||
} else {
|
||||
parentDocAcc->BindChildDocument(docAcc);
|
||||
@ -420,12 +419,12 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccDocManager static
|
||||
// DocManager static
|
||||
|
||||
PLDHashOperator
|
||||
nsAccDocManager::GetFirstEntryInDocCache(const nsIDocument* aKey,
|
||||
DocAccessible* aDocAccessible,
|
||||
void* aUserArg)
|
||||
DocManager::GetFirstEntryInDocCache(const nsIDocument* aKey,
|
||||
DocAccessible* aDocAccessible,
|
||||
void* aUserArg)
|
||||
{
|
||||
NS_ASSERTION(aDocAccessible,
|
||||
"No doc accessible for the object in doc accessible cache!");
|
||||
@ -435,7 +434,7 @@ nsAccDocManager::GetFirstEntryInDocCache(const nsIDocument* aKey,
|
||||
}
|
||||
|
||||
void
|
||||
nsAccDocManager::ClearDocCache()
|
||||
DocManager::ClearDocCache()
|
||||
{
|
||||
DocAccessible* docAcc = nullptr;
|
||||
while (mDocAccessibleCache.EnumerateRead(GetFirstEntryInDocCache, static_cast<void*>(&docAcc))) {
|
||||
@ -445,9 +444,9 @@ nsAccDocManager::ClearDocCache()
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
nsAccDocManager::SearchAccessibleInDocCache(const nsIDocument* aKey,
|
||||
DocAccessible* aDocAccessible,
|
||||
void* aUserArg)
|
||||
DocManager::SearchAccessibleInDocCache(const nsIDocument* aKey,
|
||||
DocAccessible* aDocAccessible,
|
||||
void* aUserArg)
|
||||
{
|
||||
NS_ASSERTION(aDocAccessible,
|
||||
"No doc accessible for the object in doc accessible cache!");
|
||||
@ -465,9 +464,9 @@ nsAccDocManager::SearchAccessibleInDocCache(const nsIDocument* aKey,
|
||||
|
||||
#ifdef DEBUG
|
||||
PLDHashOperator
|
||||
nsAccDocManager::SearchIfDocIsRefreshing(const nsIDocument* aKey,
|
||||
DocAccessible* aDocAccessible,
|
||||
void* aUserArg)
|
||||
DocManager::SearchIfDocIsRefreshing(const nsIDocument* aKey,
|
||||
DocAccessible* aDocAccessible,
|
||||
void* aUserArg)
|
||||
{
|
||||
NS_ASSERTION(aDocAccessible,
|
||||
"No doc accessible for the object in doc accessible cache!");
|
@ -2,8 +2,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsAccDocManager_h_
|
||||
#define nsAccDocManager_h_
|
||||
#ifndef mozilla_a11_DocManager_h_
|
||||
#define mozilla_a11_DocManager_h_
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
@ -13,18 +13,21 @@
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
class DocAccessible;
|
||||
|
||||
/**
|
||||
* Manage the document accessible life cycle.
|
||||
*/
|
||||
class nsAccDocManager : public nsIWebProgressListener,
|
||||
public nsIDOMEventListener,
|
||||
public nsSupportsWeakReference
|
||||
class DocManager : public nsIWebProgressListener,
|
||||
public nsIDOMEventListener,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
virtual ~nsAccDocManager() { }
|
||||
virtual ~DocManager() { }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
@ -77,7 +80,7 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsAccDocManager() { }
|
||||
DocManager() { }
|
||||
|
||||
/**
|
||||
* Initialize the manager.
|
||||
@ -90,8 +93,8 @@ protected:
|
||||
void Shutdown();
|
||||
|
||||
private:
|
||||
nsAccDocManager(const nsAccDocManager&);
|
||||
nsAccDocManager& operator =(const nsAccDocManager&);
|
||||
DocManager(const DocManager&);
|
||||
DocManager& operator =(const DocManager&);
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -151,4 +154,7 @@ private:
|
||||
DocAccessibleHashtable mDocAccessibleCache;
|
||||
};
|
||||
|
||||
#endif // nsAccDocManager_h_
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_a11_DocManager_h_
|
@ -7,13 +7,14 @@
|
||||
|
||||
#include "mozilla/StandardInteger.h"
|
||||
|
||||
class Accessible;
|
||||
|
||||
/**
|
||||
* Predefined filters used for nsAccIterator and nsAccCollector.
|
||||
*/
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
|
||||
namespace filters {
|
||||
|
||||
enum EResult {
|
||||
|
@ -219,7 +219,7 @@ FocusManager::DispatchFocusEvent(DocAccessible* aDocument,
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget,
|
||||
eAutoDetect, AccEvent::eCoalesceOfSameType);
|
||||
aDocument->FireDelayedAccessibleEvent(event);
|
||||
aDocument->FireDelayedEvent(event);
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
|
@ -8,13 +8,13 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccEvent;
|
||||
class Accessible;
|
||||
class DocAccessible;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Manage the accessible focus. Used to fire and process accessible events.
|
||||
*/
|
||||
|
@ -471,12 +471,9 @@ logging::DocLoadEventHandled(AccEvent* aEvent)
|
||||
|
||||
MsgBegin(sDocEventTitle, "handled '%s' event", strEventType.get());
|
||||
|
||||
nsINode* node = aEvent->GetNode();
|
||||
if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
|
||||
nsIDocument* documentNode = static_cast<nsIDocument*>(node);
|
||||
DocAccessible* document = aEvent->GetDocAccessible();
|
||||
LogDocInfo(documentNode, document);
|
||||
}
|
||||
DocAccessible* document = aEvent->GetAccessible()->AsDoc();
|
||||
if (document)
|
||||
LogDocInfo(document->DocumentNode(), document);
|
||||
|
||||
MsgEnd();
|
||||
}
|
||||
|
@ -10,10 +10,6 @@
|
||||
#include "nscore.h"
|
||||
#include "nsAString.h"
|
||||
|
||||
class AccEvent;
|
||||
class Accessible;
|
||||
class DocAccessible;
|
||||
|
||||
class nsIDocument;
|
||||
class nsINode;
|
||||
class nsIRequest;
|
||||
@ -23,6 +19,9 @@ class nsIWebProgress;
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccEvent;
|
||||
class Accessible;
|
||||
class DocAccessible;
|
||||
class OuterDocAccessible;
|
||||
|
||||
namespace logging {
|
||||
|
@ -21,16 +21,15 @@ CPPSRCS = \
|
||||
AccIterator.cpp \
|
||||
Filters.cpp \
|
||||
ARIAStateMap.cpp \
|
||||
DocManager.cpp \
|
||||
FocusManager.cpp \
|
||||
NotificationController.cpp \
|
||||
nsAccDocManager.cpp \
|
||||
nsAccessNode.cpp \
|
||||
nsARIAMap.cpp \
|
||||
nsCoreUtils.cpp \
|
||||
nsAccUtils.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsAccessiblePivot.cpp \
|
||||
nsAccTreeWalker.cpp \
|
||||
nsEventShell.cpp \
|
||||
nsCaretAccessible.cpp \
|
||||
nsTextEquivUtils.cpp \
|
||||
@ -38,6 +37,7 @@ CPPSRCS = \
|
||||
StyleInfo.cpp \
|
||||
TextAttrs.cpp \
|
||||
TextUpdater.cpp \
|
||||
TreeWalker.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifneq ($(A11Y_LOG),0)
|
||||
@ -48,7 +48,6 @@ endif
|
||||
|
||||
EXPORTS = \
|
||||
AccEvent.h \
|
||||
nsAccDocManager.h \
|
||||
nsAccessibilityService.h \
|
||||
nsAccessNode.h \
|
||||
$(NULL)
|
||||
@ -56,6 +55,7 @@ EXPORTS = \
|
||||
EXPORTS_NAMESPACES = mozilla/a11y
|
||||
|
||||
EXPORTS_mozilla/a11y = \
|
||||
DocManager.h \
|
||||
FocusManager.h \
|
||||
AccTypes.h \
|
||||
States.h \
|
||||
|
@ -385,7 +385,7 @@ NotificationController::CoalesceEvents()
|
||||
AccEvent* accEvent = mEvents[index];
|
||||
if (accEvent->mEventType == tailEvent->mEventType &&
|
||||
accEvent->mEventRule == tailEvent->mEventRule &&
|
||||
accEvent->mNode == tailEvent->mNode) {
|
||||
accEvent->mAccessible == tailEvent->mAccessible) {
|
||||
tailEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
@ -705,12 +705,11 @@ NotificationController::ProcessEventQueue()
|
||||
|
||||
// Dispatch caret moved and text selection change events.
|
||||
if (event->mEventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) {
|
||||
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(event);
|
||||
HyperTextAccessible* hyperText = target->AsHyperText();
|
||||
int32_t caretOffset = -1;
|
||||
if (hyperText &&
|
||||
NS_SUCCEEDED(hyperText->GetCaretOffset(&caretOffset))) {
|
||||
nsRefPtr<AccEvent> caretMoveEvent =
|
||||
new AccCaretMoveEvent(hyperText, caretOffset);
|
||||
NS_SUCCEEDED(hyperText->GetCaretOffset(&caretMoveEvent->mCaretOffset))) {
|
||||
|
||||
nsEventShell::FireEvent(caretMoveEvent);
|
||||
|
||||
// There's a selection so fire selection change as well.
|
||||
|
@ -14,9 +14,13 @@
|
||||
#include "Logging.h"
|
||||
#endif
|
||||
|
||||
class nsIContent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
class DocAccessible;
|
||||
class nsIContent;
|
||||
|
||||
/**
|
||||
* Notification interface.
|
||||
@ -74,7 +78,7 @@ private:
|
||||
|
||||
Class* mInstance;
|
||||
Callback mCallback;
|
||||
nsCOMPtr<Arg> mArg;
|
||||
nsRefPtr<Arg> mArg;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -347,4 +351,7 @@ private:
|
||||
nsTArray<nsRefPtr<AccEvent> > mEvents;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -37,7 +37,7 @@ ROLE(SCROLLBAR,
|
||||
NSAccessibilityScrollBarRole, //We might need to make this its own mozAccessible, to support the children objects (valueindicator, down/up buttons).
|
||||
ROLE_SYSTEM_SCROLLBAR,
|
||||
ROLE_SYSTEM_SCROLLBAR,
|
||||
eNoNameRule)
|
||||
eNameFromValueRule)
|
||||
|
||||
ROLE(GRIP,
|
||||
"grip",
|
||||
@ -430,7 +430,7 @@ ROLE(SLIDER,
|
||||
NSAccessibilitySliderRole,
|
||||
ROLE_SYSTEM_SLIDER,
|
||||
ROLE_SYSTEM_SLIDER,
|
||||
eNoNameRule)
|
||||
eNameFromValueRule)
|
||||
|
||||
ROLE(SPINBUTTON,
|
||||
"spinbutton",
|
||||
@ -438,7 +438,7 @@ ROLE(SPINBUTTON,
|
||||
NSAccessibilityIncrementorRole, //Subroles: Increment/Decrement.
|
||||
ROLE_SYSTEM_SPINBUTTON,
|
||||
ROLE_SYSTEM_SPINBUTTON,
|
||||
eNoNameRule)
|
||||
eNameFromValueRule)
|
||||
|
||||
ROLE(DIAGRAM,
|
||||
"diagram",
|
||||
|
@ -10,16 +10,17 @@
|
||||
#include "nsColor.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
||||
class HyperTextAccessible;
|
||||
class nsIFrame;
|
||||
class nsIPersistentProperties;
|
||||
class nsIContent;
|
||||
class Accessible;
|
||||
class nsDeviceContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
class HyperTextAccessible;
|
||||
|
||||
/**
|
||||
* Used to expose text attributes for the hyper text accessible (see
|
||||
* HyperTextAccessible class).
|
||||
|
@ -82,14 +82,14 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
|
||||
// Fire text change event for removal.
|
||||
nsRefPtr<AccEvent> textRemoveEvent =
|
||||
new AccTextChangeEvent(mHyperText, mTextOffset, str1, false);
|
||||
mDocument->FireDelayedAccessibleEvent(textRemoveEvent);
|
||||
mDocument->FireDelayedEvent(textRemoveEvent);
|
||||
}
|
||||
|
||||
if (strLen2 > 0) {
|
||||
// Fire text change event for insertion.
|
||||
nsRefPtr<AccEvent> textInsertEvent =
|
||||
new AccTextChangeEvent(mHyperText, mTextOffset, str2, true);
|
||||
mDocument->FireDelayedAccessibleEvent(textInsertEvent);
|
||||
mDocument->FireDelayedEvent(textInsertEvent);
|
||||
}
|
||||
|
||||
mDocument->MaybeNotifyOfValueChange(mHyperText);
|
||||
@ -135,7 +135,7 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
|
||||
|
||||
// Fire events.
|
||||
for (int32_t idx = events.Length() - 1; idx >= 0; idx--)
|
||||
mDocument->FireDelayedAccessibleEvent(events[idx]);
|
||||
mDocument->FireDelayedEvent(events[idx]);
|
||||
|
||||
mDocument->MaybeNotifyOfValueChange(mHyperText);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "Accessible.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
@ -11,10 +11,15 @@
|
||||
|
||||
#include "nsINodeList.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// WalkState
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
struct WalkState
|
||||
{
|
||||
WalkState(nsIContent *aContent) :
|
||||
@ -26,42 +31,45 @@ struct WalkState
|
||||
WalkState *prevState;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTreeWalker
|
||||
// TreeWalker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsAccTreeWalker::
|
||||
nsAccTreeWalker(DocAccessible* aDoc, nsIContent* aContent,
|
||||
bool aWalkAnonContent, bool aWalkCache) :
|
||||
mDoc(aDoc), mWalkCache(aWalkCache), mState(nullptr)
|
||||
TreeWalker::
|
||||
TreeWalker(Accessible* aContext, nsIContent* aContent, bool aWalkCache) :
|
||||
mDoc(aContext->Document()), mContext(aContext),
|
||||
mWalkCache(aWalkCache), mState(nullptr)
|
||||
{
|
||||
NS_ASSERTION(aContent, "No node for the accessible tree walker!");
|
||||
|
||||
if (aContent)
|
||||
mState = new WalkState(aContent);
|
||||
|
||||
mChildFilter = aWalkAnonContent ? nsIContent::eAllChildren :
|
||||
nsIContent::eAllButXBL;
|
||||
mChildFilter = mContext->CanHaveAnonChildren() ?
|
||||
nsIContent::eAllChildren : nsIContent::eAllButXBL;
|
||||
|
||||
mChildFilter |= nsIContent::eSkipPlaceholderContent;
|
||||
|
||||
MOZ_COUNT_CTOR(nsAccTreeWalker);
|
||||
MOZ_COUNT_CTOR(TreeWalker);
|
||||
}
|
||||
|
||||
nsAccTreeWalker::~nsAccTreeWalker()
|
||||
TreeWalker::~TreeWalker()
|
||||
{
|
||||
// Clear state stack from memory
|
||||
while (mState)
|
||||
PopState();
|
||||
|
||||
MOZ_COUNT_DTOR(nsAccTreeWalker);
|
||||
MOZ_COUNT_DTOR(TreeWalker);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTreeWalker: private
|
||||
// TreeWalker: private
|
||||
|
||||
Accessible*
|
||||
nsAccTreeWalker::NextChildInternal(bool aNoWalkUp)
|
||||
TreeWalker::NextChildInternal(bool aNoWalkUp)
|
||||
{
|
||||
if (!mState || !mState->content)
|
||||
return nullptr;
|
||||
@ -102,7 +110,7 @@ nsAccTreeWalker::NextChildInternal(bool aNoWalkUp)
|
||||
}
|
||||
|
||||
void
|
||||
nsAccTreeWalker::PopState()
|
||||
TreeWalker::PopState()
|
||||
{
|
||||
WalkState* prevToLastState = mState->prevState;
|
||||
delete mState;
|
||||
@ -110,7 +118,7 @@ nsAccTreeWalker::PopState()
|
||||
}
|
||||
|
||||
bool
|
||||
nsAccTreeWalker::PushState(nsIContent* aContent)
|
||||
TreeWalker::PushState(nsIContent* aContent)
|
||||
{
|
||||
WalkState* nextToLastState = new WalkState(aContent);
|
||||
if (!nextToLastState)
|
@ -3,25 +3,28 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _nsAccTreeWalker_H_
|
||||
#define _nsAccTreeWalker_H_
|
||||
#ifndef mozilla_a11y_TreeWalker_h_
|
||||
#define mozilla_a11y_TreeWalker_h_
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
class DocAccessible;
|
||||
|
||||
struct WalkState;
|
||||
|
||||
/**
|
||||
* This class is used to walk the DOM tree to create accessible tree.
|
||||
*/
|
||||
class nsAccTreeWalker
|
||||
class TreeWalker
|
||||
{
|
||||
public:
|
||||
nsAccTreeWalker(DocAccessible* aDoc, nsIContent* aNode,
|
||||
bool aWalkAnonymousContent, bool aWalkCache = false);
|
||||
virtual ~nsAccTreeWalker();
|
||||
TreeWalker(Accessible* aContext, nsIContent* aNode, bool aWalkCache = false);
|
||||
virtual ~TreeWalker();
|
||||
|
||||
/**
|
||||
* Return the next child accessible.
|
||||
@ -36,6 +39,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
TreeWalker();
|
||||
TreeWalker(const TreeWalker&);
|
||||
TreeWalker& operator =(const TreeWalker&);
|
||||
|
||||
/**
|
||||
* Return the next child accessible.
|
||||
@ -60,9 +66,13 @@ private:
|
||||
void PopState();
|
||||
|
||||
DocAccessible* mDoc;
|
||||
Accessible* mContext;
|
||||
int32_t mChildFilter;
|
||||
bool mWalkCache;
|
||||
WalkState* mState;
|
||||
};
|
||||
|
||||
#endif
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_a11y_TreeWalker_h_
|
@ -33,9 +33,9 @@ ClearCacheEntry(const void* aKey, nsRefPtr<T>& aAccessible, void* aUserArg)
|
||||
*/
|
||||
|
||||
static void
|
||||
ClearCache(AccessibleHashtable& aCache)
|
||||
ClearCache(mozilla::a11y::AccessibleHashtable& aCache)
|
||||
{
|
||||
aCache.Enumerate(ClearCacheEntry<Accessible>, nullptr);
|
||||
aCache.Enumerate(ClearCacheEntry<mozilla::a11y::Accessible>, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,10 +61,11 @@ CycleCollectorTraverseCacheEntry(const void *aKey, T *aAccessible,
|
||||
*/
|
||||
|
||||
static void
|
||||
CycleCollectorTraverseCache(AccessibleHashtable& aCache,
|
||||
CycleCollectorTraverseCache(mozilla::a11y::AccessibleHashtable& aCache,
|
||||
nsCycleCollectionTraversalCallback *aCallback)
|
||||
{
|
||||
aCache.EnumerateRead(CycleCollectorTraverseCacheEntry<Accessible>, aCallback);
|
||||
aCache.EnumerateRead(CycleCollectorTraverseCacheEntry<mozilla::a11y::Accessible>,
|
||||
aCallback);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -20,11 +20,15 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPoint.h"
|
||||
|
||||
struct nsRoleMapEntry;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class nsAccessNode;
|
||||
class Accessible;
|
||||
class HyperTextAccessible;
|
||||
class DocAccessible;
|
||||
struct nsRoleMapEntry;
|
||||
|
||||
class nsAccUtils
|
||||
{
|
||||
@ -293,4 +297,7 @@ public:
|
||||
static bool MustPrune(Accessible* aAccessible);
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -13,23 +13,19 @@
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "nsINode.h"
|
||||
|
||||
class nsAccessNode;
|
||||
class DocAccessible;
|
||||
class nsIAccessibleDocument;
|
||||
class nsIContent;
|
||||
class nsIDocShellTreeItem;
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class DocAccessible;
|
||||
class RootAccessible;
|
||||
}
|
||||
}
|
||||
|
||||
class nsIPresShell;
|
||||
class nsPresContext;
|
||||
class nsIFrame;
|
||||
class nsIDocShellTreeItem;
|
||||
|
||||
class nsAccessNode: public nsISupports
|
||||
class nsAccessNode : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
@ -47,7 +43,7 @@ public:
|
||||
/**
|
||||
* Return the root document accessible for this accessnode.
|
||||
*/
|
||||
mozilla::a11y::RootAccessible* RootAccessible() const;
|
||||
a11y::RootAccessible* RootAccessible() const;
|
||||
|
||||
/**
|
||||
* Shutdown the access node object.
|
||||
@ -58,6 +54,7 @@ public:
|
||||
* Return frame for the given access node object.
|
||||
*/
|
||||
virtual nsIFrame* GetFrame() const;
|
||||
|
||||
/**
|
||||
* Return DOM node associated with the accessible.
|
||||
*/
|
||||
@ -103,5 +100,8 @@ private:
|
||||
nsAccessNode& operator =(const nsAccessNode&) MOZ_DELETE;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -125,7 +125,7 @@ ApplicationAccessible* nsAccessibilityService::gApplicationAccessible = nullptr;
|
||||
bool nsAccessibilityService::gIsShutdown = true;
|
||||
|
||||
nsAccessibilityService::nsAccessibilityService() :
|
||||
nsAccDocManager(), FocusManager()
|
||||
DocManager(), FocusManager()
|
||||
{
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ nsAccessibilityService::~nsAccessibilityService()
|
||||
// nsISupports
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED3(nsAccessibilityService,
|
||||
nsAccDocManager,
|
||||
DocManager,
|
||||
nsIAccessibilityService,
|
||||
nsIAccessibleRetrieval,
|
||||
nsIObserver)
|
||||
@ -621,7 +621,7 @@ nsAccessibilityService::GetAccessibleFromCache(nsIDOMNode* aNode,
|
||||
// caches. If we don't find it, and the given node is itself a document, check
|
||||
// our cache of document accessibles (document cache). Note usually shutdown
|
||||
// document accessibles are not stored in the document cache, however an
|
||||
// "unofficially" shutdown document (i.e. not from nsAccDocManager) can still
|
||||
// "unofficially" shutdown document (i.e. not from DocManager) can still
|
||||
// exist in the document cache.
|
||||
Accessible* accessible = FindAccessibleInCache(node);
|
||||
if (!accessible) {
|
||||
@ -975,7 +975,7 @@ bool
|
||||
nsAccessibilityService::Init()
|
||||
{
|
||||
// Initialize accessible document manager.
|
||||
if (!nsAccDocManager::Init())
|
||||
if (!DocManager::Init())
|
||||
return false;
|
||||
|
||||
// Add observers.
|
||||
@ -1026,7 +1026,7 @@ nsAccessibilityService::Shutdown()
|
||||
}
|
||||
|
||||
// Stop accessible document loader.
|
||||
nsAccDocManager::Shutdown();
|
||||
DocManager::Shutdown();
|
||||
|
||||
// Application is going to be closed, shutdown accessibility and mark
|
||||
// accessibility service as shutdown to prevent calls of its methods.
|
||||
|
@ -8,8 +8,7 @@
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
||||
#include "nsAccDocManager.h"
|
||||
|
||||
#include "mozilla/a11y/DocManager.h"
|
||||
#include "mozilla/a11y/FocusManager.h"
|
||||
|
||||
#include "nsIObserver.h"
|
||||
@ -64,12 +63,15 @@ bool ShouldA11yBeEnabled();
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
class nsAccessibilityService : public nsAccDocManager,
|
||||
class nsAccessibilityService : public mozilla::a11y::DocManager,
|
||||
public mozilla::a11y::FocusManager,
|
||||
public nsIAccessibilityService,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
typedef mozilla::a11y::Accessible Accessible;
|
||||
typedef mozilla::a11y::DocAccessible DocAccessible;
|
||||
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -14,7 +14,14 @@
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
class nsIAccessibleTraversalRule;
|
||||
|
||||
/**
|
||||
@ -23,6 +30,8 @@ class nsIAccessibleTraversalRule;
|
||||
class nsAccessiblePivot MOZ_FINAL : public nsIAccessiblePivot
|
||||
{
|
||||
public:
|
||||
typedef mozilla::a11y::Accessible Accessible;
|
||||
|
||||
nsAccessiblePivot(Accessible* aRoot);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
@ -243,10 +243,8 @@ nsCaretAccessible::NormalSelectionChanged(nsISelection* aSelection)
|
||||
mLastCaretOffset = caretOffset;
|
||||
mLastTextAccessible = textAcc;
|
||||
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccCaretMoveEvent(mLastTextAccessible->GetNode());
|
||||
if (event)
|
||||
mLastTextAccessible->Document()->FireDelayedAccessibleEvent(event);
|
||||
nsRefPtr<AccEvent> event = new AccCaretMoveEvent(mLastTextAccessible);
|
||||
mLastTextAccessible->Document()->FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
@ -258,15 +256,13 @@ nsCaretAccessible::SpellcheckSelectionChanged(nsISelection* aSelection)
|
||||
// misspelled word). If spellchecking is disabled (for example,
|
||||
// @spellcheck="false" on html:body) then we won't fire any event.
|
||||
|
||||
HyperTextAccessible* textAcc =
|
||||
HyperTextAccessible* hyperText =
|
||||
nsAccUtils::GetTextAccessibleFromSelection(aSelection);
|
||||
if (!textAcc)
|
||||
return;
|
||||
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED, textAcc);
|
||||
if (event)
|
||||
textAcc->Document()->FireDelayedAccessibleEvent(event);
|
||||
if (hyperText) {
|
||||
hyperText->Document()->
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
|
||||
hyperText);
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
|
@ -117,7 +117,7 @@ private:
|
||||
// If it was on a control, then its control's selection. Otherwise, it's for
|
||||
// a document where the selection changed.
|
||||
nsCOMPtr<nsIWeakReference> mLastUsedSelection; // Weak ref to nsISelection
|
||||
nsRefPtr<HyperTextAccessible> mLastTextAccessible;
|
||||
nsRefPtr<mozilla::a11y::HyperTextAccessible> mLastTextAccessible;
|
||||
int32_t mLastCaretOffset;
|
||||
|
||||
mozilla::a11y::RootAccessible* mRootAccessible;
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsEventShell
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -20,7 +22,7 @@ nsEventShell::FireEvent(AccEvent* aEvent)
|
||||
Accessible* accessible = aEvent->GetAccessible();
|
||||
NS_ENSURE_TRUE_VOID(accessible);
|
||||
|
||||
nsINode* node = aEvent->GetNode();
|
||||
nsINode* node = accessible->GetNode();
|
||||
if (node) {
|
||||
sEventTargetNode = node;
|
||||
sEventFromUserInput = aEvent->IsFromUserInput();
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
/**
|
||||
* Fire the accessible event.
|
||||
*/
|
||||
static void FireEvent(AccEvent* aEvent);
|
||||
static void FireEvent(mozilla::a11y::AccEvent* aEvent);
|
||||
|
||||
/**
|
||||
* Fire accessible event of the given type for the given accessible.
|
||||
@ -28,8 +28,9 @@ public:
|
||||
* @param aEventType [in] the event type
|
||||
* @param aAccessible [in] the event target
|
||||
*/
|
||||
static void FireEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
static void FireEvent(uint32_t aEventType,
|
||||
mozilla::a11y::Accessible* aAccessible,
|
||||
mozilla::a11y::EIsFromUserInput aIsFromUserInput = mozilla::a11y::eAutoDetect);
|
||||
|
||||
/**
|
||||
* Append 'event-from-input' object attribute if the accessible event has
|
||||
|
@ -42,6 +42,7 @@ enum ETextEquivRule
|
||||
class nsTextEquivUtils
|
||||
{
|
||||
public:
|
||||
typedef mozilla::a11y::Accessible Accessible;
|
||||
|
||||
/**
|
||||
* Calculates the name from accessible subtree if allowed.
|
||||
|
@ -11,8 +11,11 @@
|
||||
|
||||
#include "AccIterator.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
inline Accessible*
|
||||
mozilla::a11y::ARIAGridCellAccessible::TableFor(Accessible* aRow) const
|
||||
ARIAGridCellAccessible::TableFor(Accessible* aRow) const
|
||||
{
|
||||
if (aRow) {
|
||||
Accessible* table = aRow->Parent();
|
||||
@ -33,7 +36,7 @@ mozilla::a11y::ARIAGridCellAccessible::TableFor(Accessible* aRow) const
|
||||
}
|
||||
|
||||
inline int32_t
|
||||
mozilla::a11y::ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
|
||||
ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
|
||||
{
|
||||
Accessible* table = TableFor(aRow);
|
||||
if (table) {
|
||||
@ -50,4 +53,7 @@ mozilla::a11y::ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -10,6 +10,9 @@
|
||||
#include "Accessible.h"
|
||||
#include "nsARIAMap.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
inline mozilla::a11y::role
|
||||
Accessible::Role()
|
||||
{
|
||||
@ -45,4 +48,7 @@ Accessible::HasNumericValue() const
|
||||
return mRoleMapEntry && mRoleMapEntry->valueRule != eNoValue;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsAccessibleRelation.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
@ -23,6 +22,7 @@
|
||||
#include "RootAccessible.h"
|
||||
#include "States.h"
|
||||
#include "StyleInfo.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
@ -2949,7 +2949,7 @@ Accessible::CacheChildren()
|
||||
DocAccessible* doc = Document();
|
||||
NS_ENSURE_TRUE_VOID(doc);
|
||||
|
||||
nsAccTreeWalker walker(doc, mContent, CanHaveAnonChildren());
|
||||
TreeWalker walker(this, mContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild()) && AppendChild(child));
|
||||
|
@ -21,20 +21,26 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
|
||||
class AccEvent;
|
||||
class AccGroupInfo;
|
||||
class KeyBinding;
|
||||
class Accessible;
|
||||
class HyperTextAccessible;
|
||||
struct nsRoleMapEntry;
|
||||
|
||||
struct nsRect;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIAtom;
|
||||
class nsIView;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
class AccEvent;
|
||||
class AccGroupInfo;
|
||||
class EmbeddedObjCollector;
|
||||
class HTMLImageMapAccessible;
|
||||
class HTMLLIAccessible;
|
||||
class HyperTextAccessible;
|
||||
class ImageAccessible;
|
||||
class KeyBinding;
|
||||
class Relation;
|
||||
class TableAccessible;
|
||||
class TableCellAccessible;
|
||||
@ -81,15 +87,6 @@ struct GroupPos
|
||||
int32_t setSize;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
struct nsRect;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIAtom;
|
||||
class nsIView;
|
||||
|
||||
typedef nsRefPtrHashtable<nsPtrHashKey<const void>, Accessible>
|
||||
AccessibleHashtable;
|
||||
|
||||
@ -150,7 +147,7 @@ public:
|
||||
* Note: aName.IsVoid() when name was left empty by the author on purpose.
|
||||
* aName.IsEmpty() when the author missed name, AT can try to repair a name.
|
||||
*/
|
||||
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||
virtual ENameValueFlag Name(nsString& aName);
|
||||
|
||||
/**
|
||||
* Return DOM node associated with this accessible.
|
||||
@ -911,7 +908,7 @@ protected:
|
||||
|
||||
nsAutoPtr<mozilla::a11y::EmbeddedObjCollector> mEmbeddedObjCollector;
|
||||
int32_t mIndexOfEmbeddedChild;
|
||||
friend class mozilla::a11y::EmbeddedObjCollector;
|
||||
friend class EmbeddedObjCollector;
|
||||
|
||||
nsAutoPtr<AccGroupInfo> mGroupInfo;
|
||||
friend class AccGroupInfo;
|
||||
@ -983,4 +980,7 @@ private:
|
||||
uint32_t mModifierMask;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -12,6 +12,31 @@
|
||||
#include "NotificationController.h"
|
||||
#include "States.h"
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
#include "Logging.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
inline void
|
||||
DocAccessible::FireDelayedEvent(AccEvent* aEvent)
|
||||
{
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
logging::DocLoadEventFired(aEvent);
|
||||
#endif
|
||||
|
||||
mNotificationController->QueueEvent(aEvent);
|
||||
}
|
||||
|
||||
inline void
|
||||
DocAccessible::FireDelayedEvent(uint32_t aEventType, Accessible* aTarget)
|
||||
{
|
||||
nsRefPtr<AccEvent> event = new AccEvent(aEventType, aTarget);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
inline void
|
||||
DocAccessible::BindChildDocument(DocAccessible* aDocument)
|
||||
{
|
||||
@ -50,22 +75,20 @@ DocAccessible::NotifyOfLoad(uint32_t aLoadEventType)
|
||||
// caused by file loading. Fire busy state change event.
|
||||
if (HasLoadState(eCompletelyLoaded) && IsLoadEventTarget()) {
|
||||
nsRefPtr<AccEvent> stateEvent =
|
||||
new AccStateChangeEvent(this, mozilla::a11y::states::BUSY, false);
|
||||
FireDelayedAccessibleEvent(stateEvent);
|
||||
new AccStateChangeEvent(this, states::BUSY, false);
|
||||
FireDelayedEvent(stateEvent);
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
|
||||
{
|
||||
mozilla::a11y::role role = aAccessible->Role();
|
||||
if (role == mozilla::a11y::roles::ENTRY ||
|
||||
role == mozilla::a11y::roles::COMBOBOX) {
|
||||
nsRefPtr<AccEvent> valueChangeEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
|
||||
eAutoDetect, AccEvent::eRemoveDupes);
|
||||
FireDelayedAccessibleEvent(valueChangeEvent);
|
||||
}
|
||||
a11y::role role = aAccessible->Role();
|
||||
if (role == roles::ENTRY || role == roles::COMBOBOX)
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include "DocAccessible-inl.h"
|
||||
#include "nsAccCache.h"
|
||||
#include "nsAccessiblePivot.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Role.h"
|
||||
#include "RootAccessible.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsICommandManager.h"
|
||||
@ -44,10 +44,6 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
#include "Logging.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIXULDocument.h"
|
||||
#endif
|
||||
@ -100,7 +96,7 @@ DocAccessible::
|
||||
if (!mDocument)
|
||||
return;
|
||||
|
||||
// nsAccDocManager creates document accessible when scrollable frame is
|
||||
// DocManager creates document accessible when scrollable frame is
|
||||
// available already, it should be safe time to add scroll listener.
|
||||
AddScrollListener();
|
||||
|
||||
@ -892,7 +888,7 @@ DocAccessible::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
// about this exceptional case.
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(this, states::EDITABLE, true);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -987,7 +983,7 @@ DocAccessible::AttributeChanged(nsIDocument* aDocument,
|
||||
|
||||
// Fire accessible events iff there's an accessible, otherwise we consider
|
||||
// the accessible state wasn't changed, i.e. its state is initial state.
|
||||
AttributeChangedImpl(aElement, aNameSpaceID, aAttribute);
|
||||
AttributeChangedImpl(accessible, aNameSpaceID, aAttribute);
|
||||
|
||||
// Update dependent IDs cache. Take care of accessible elements because no
|
||||
// accessible element means either the element is not accessible at all or
|
||||
@ -1002,7 +998,8 @@ DocAccessible::AttributeChanged(nsIDocument* aDocument,
|
||||
|
||||
// DocAccessible protected member
|
||||
void
|
||||
DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID, nsIAtom* aAttribute)
|
||||
DocAccessible::AttributeChangedImpl(Accessible* aAccessible,
|
||||
int32_t aNameSpaceID, nsIAtom* aAttribute)
|
||||
{
|
||||
// Fire accessible event after short timer, because we need to wait for
|
||||
// DOM attribute & resulting layout to actually change. Otherwise,
|
||||
@ -1033,14 +1030,12 @@ DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID,
|
||||
// ARIA's aria-disabled does not affect the disabled state bit.
|
||||
|
||||
nsRefPtr<AccEvent> enabledChangeEvent =
|
||||
new AccStateChangeEvent(aContent, states::ENABLED);
|
||||
|
||||
FireDelayedAccessibleEvent(enabledChangeEvent);
|
||||
new AccStateChangeEvent(aAccessible, states::ENABLED);
|
||||
FireDelayedEvent(enabledChangeEvent);
|
||||
|
||||
nsRefPtr<AccEvent> sensitiveChangeEvent =
|
||||
new AccStateChangeEvent(aContent, states::SENSITIVE);
|
||||
|
||||
FireDelayedAccessibleEvent(sensitiveChangeEvent);
|
||||
new AccStateChangeEvent(aAccessible, states::SENSITIVE);
|
||||
FireDelayedEvent(sensitiveChangeEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1049,7 +1044,7 @@ DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID,
|
||||
// Check for hyphenated aria-foo property?
|
||||
if (StringBeginsWith(nsDependentAtomString(aAttribute),
|
||||
NS_LITERAL_STRING("aria-"))) {
|
||||
ARIAAttributeChanged(aContent, aAttribute);
|
||||
ARIAAttributeChanged(aAccessible, aAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1057,75 +1052,69 @@ DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID,
|
||||
aAttribute == nsGkAtoms::title ||
|
||||
aAttribute == nsGkAtoms::aria_label ||
|
||||
aAttribute == nsGkAtoms::aria_labelledby) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE,
|
||||
aContent);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, aAccessible);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_busy) {
|
||||
bool isOn = aContent->AttrValueIs(aNameSpaceID, aAttribute,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
nsRefPtr<AccEvent> event = new AccStateChangeEvent(aContent, states::BUSY, isOn);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
bool isOn = aAccessible->GetContent()->
|
||||
AttrValueIs(aNameSpaceID, aAttribute, nsGkAtoms::_true, eCaseMatters);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aAccessible, states::BUSY, isOn);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
// ARIA or XUL selection
|
||||
if ((aContent->IsXUL() && aAttribute == nsGkAtoms::selected) ||
|
||||
if ((aAccessible->GetContent()->IsXUL() && aAttribute == nsGkAtoms::selected) ||
|
||||
aAttribute == nsGkAtoms::aria_selected) {
|
||||
Accessible* item = GetAccessible(aContent);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
Accessible* widget =
|
||||
nsAccUtils::GetSelectableContainer(item, item->State());
|
||||
nsAccUtils::GetSelectableContainer(aAccessible, aAccessible->State());
|
||||
if (widget) {
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
AccSelChangeEvent::SelChangeType selChangeType =
|
||||
aContent->AttrValueIs(aNameSpaceID, aAttribute,
|
||||
nsGkAtoms::_true, eCaseMatters) ?
|
||||
elm->AttrValueIs(aNameSpaceID, aAttribute, nsGkAtoms::_true, eCaseMatters) ?
|
||||
AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
|
||||
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccSelChangeEvent(widget, item, selChangeType);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccSelChangeEvent(widget, aAccessible, selChangeType);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::contenteditable) {
|
||||
nsRefPtr<AccEvent> editableChangeEvent =
|
||||
new AccStateChangeEvent(aContent, states::EDITABLE);
|
||||
FireDelayedAccessibleEvent(editableChangeEvent);
|
||||
new AccStateChangeEvent(aAccessible, states::EDITABLE);
|
||||
FireDelayedEvent(editableChangeEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::value) {
|
||||
Accessible* accessible = GetAccessible(aContent);
|
||||
if(accessible && accessible->IsProgress()) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
aContent);
|
||||
}
|
||||
if (aAccessible->IsProgress())
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
|
||||
}
|
||||
}
|
||||
|
||||
// DocAccessible protected member
|
||||
void
|
||||
DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
DocAccessible::ARIAAttributeChanged(Accessible* aAccessible, nsIAtom* aAttribute)
|
||||
{
|
||||
// Note: For universal/global ARIA states and properties we don't care if
|
||||
// there is an ARIA role present or not.
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_required) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::REQUIRED);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(aAccessible, states::REQUIRED);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_invalid) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::INVALID);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(aAccessible, states::INVALID);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1133,8 +1122,8 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// to the element with the id that activedescendant points to. Make sure
|
||||
// the tree up to date before processing.
|
||||
if (aAttribute == nsGkAtoms::aria_activedescendant) {
|
||||
mNotificationController->HandleNotification<DocAccessible, nsIContent>
|
||||
(this, &DocAccessible::ARIAActiveDescendantChanged, aContent);
|
||||
mNotificationController->HandleNotification<DocAccessible, Accessible>
|
||||
(this, &DocAccessible::ARIAActiveDescendantChanged, aAccessible);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1142,8 +1131,8 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// We treat aria-expanded as a global ARIA state for historical reasons
|
||||
if (aAttribute == nsGkAtoms::aria_expanded) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::EXPANDED);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(aAccessible, states::EXPANDED);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1151,10 +1140,11 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// change event; at least until native API comes up with a more meaningful event.
|
||||
uint8_t attrFlags = nsAccUtils::GetAttributeCharacteristics(aAttribute);
|
||||
if (!(attrFlags & ATTR_BYPASSOBJ))
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
|
||||
aContent);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
|
||||
aAccessible);
|
||||
|
||||
if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
if (!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
|
||||
// We don't care about these other ARIA attribute changes unless there is
|
||||
// an ARIA role set for the element
|
||||
// XXX: we should check the role map to see if the changed property is
|
||||
@ -1165,29 +1155,26 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// The following ARIA attributes only take affect when dynamic content role is present
|
||||
if (aAttribute == nsGkAtoms::aria_checked ||
|
||||
aAttribute == nsGkAtoms::aria_pressed) {
|
||||
const uint32_t kState = (aAttribute == nsGkAtoms::aria_checked) ?
|
||||
const uint64_t kState = (aAttribute == nsGkAtoms::aria_checked) ?
|
||||
states::CHECKED : states::PRESSED;
|
||||
nsRefPtr<AccEvent> event = new AccStateChangeEvent(aContent, kState);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
nsRefPtr<AccEvent> event = new AccStateChangeEvent(aAccessible, kState);
|
||||
FireDelayedEvent(event);
|
||||
|
||||
Accessible* accessible = event->GetAccessible();
|
||||
if (accessible) {
|
||||
bool wasMixed = (mARIAAttrOldValue == nsGkAtoms::mixed);
|
||||
bool isMixed = aContent->AttrValueIs(kNameSpaceID_None, aAttribute,
|
||||
nsGkAtoms::mixed, eCaseMatters);
|
||||
if (isMixed != wasMixed) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::MIXED, isMixed);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
bool wasMixed = (mARIAAttrOldValue == nsGkAtoms::mixed);
|
||||
bool isMixed = elm->AttrValueIs(kNameSpaceID_None, aAttribute,
|
||||
nsGkAtoms::mixed, eCaseMatters);
|
||||
if (isMixed != wasMixed) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aAccessible, states::MIXED, isMixed);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_readonly) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::READONLY);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(aAccessible, states::READONLY);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1195,23 +1182,22 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// when aria-valuenow is changed and aria-valuetext is empty
|
||||
if (aAttribute == nsGkAtoms::aria_valuetext ||
|
||||
(aAttribute == nsGkAtoms::aria_valuenow &&
|
||||
(!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_valuetext,
|
||||
nsGkAtoms::_empty, eCaseMatters)))) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
aContent);
|
||||
(!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext) ||
|
||||
elm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_valuetext,
|
||||
nsGkAtoms::_empty, eCaseMatters)))) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DocAccessible::ARIAActiveDescendantChanged(nsIContent* aElm)
|
||||
DocAccessible::ARIAActiveDescendantChanged(Accessible* aAccessible)
|
||||
{
|
||||
Accessible* widget = GetAccessible(aElm);
|
||||
if (widget && widget->IsActiveWidget()) {
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
if (elm && aAccessible->IsActiveWidget()) {
|
||||
nsAutoString id;
|
||||
if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
|
||||
dom::Element* activeDescendantElm = aElm->OwnerDoc()->GetElementById(id);
|
||||
if (elm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
|
||||
dom::Element* activeDescendantElm = elm->OwnerDoc()->GetElementById(id);
|
||||
if (activeDescendantElm) {
|
||||
Accessible* activeDescendant = GetAccessible(activeDescendantElm);
|
||||
if (activeDescendant) {
|
||||
@ -1240,31 +1226,32 @@ DocAccessible::ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
Accessible* accessible = GetAccessible(aContent);
|
||||
if (!accessible)
|
||||
return;
|
||||
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_CHECKED)) {
|
||||
Accessible* item = GetAccessible(aContent);
|
||||
if (item) {
|
||||
Accessible* widget = item->ContainerWidget();
|
||||
if (widget && widget->IsSelect()) {
|
||||
AccSelChangeEvent::SelChangeType selChangeType =
|
||||
aContent->AsElement()->State().HasState(NS_EVENT_STATE_CHECKED) ?
|
||||
AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
|
||||
nsRefPtr<AccEvent> event = new AccSelChangeEvent(widget, item,
|
||||
selChangeType);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
Accessible* widget = accessible->ContainerWidget();
|
||||
if (widget && widget->IsSelect()) {
|
||||
AccSelChangeEvent::SelChangeType selChangeType =
|
||||
aContent->AsElement()->State().HasState(NS_EVENT_STATE_CHECKED) ?
|
||||
AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccSelChangeEvent(widget, accessible, selChangeType);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_INVALID)) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::INVALID, true);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(accessible, states::INVALID, true);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_VISITED)) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::TRAVERSED, true);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(accessible, states::TRAVERSED, true);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1511,8 +1498,7 @@ DocAccessible::CacheChildren()
|
||||
{
|
||||
// Search for accessible children starting from the document element since
|
||||
// some web pages tend to insert elements under it rather than document body.
|
||||
nsAccTreeWalker walker(this, mDocument->GetRootElement(),
|
||||
CanHaveAnonChildren());
|
||||
TreeWalker walker(this, mDocument->GetRootElement());
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild()) && AppendChild(child));
|
||||
@ -1543,8 +1529,8 @@ DocAccessible::NotifyOfLoading(bool aIsReloading)
|
||||
// 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 =
|
||||
new AccStateChangeEvent(mDocument, states::BUSY, true);
|
||||
FireDelayedAccessibleEvent(stateEvent);
|
||||
new AccStateChangeEvent(this, states::BUSY, true);
|
||||
FireDelayedEvent(stateEvent);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1568,7 +1554,7 @@ DocAccessible::DoInitialUpdate()
|
||||
// a problem then consider to keep event processing per tab document.
|
||||
if (!IsRoot()) {
|
||||
nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(Parent());
|
||||
ParentDocument()->FireDelayedAccessibleEvent(reorderEvent);
|
||||
ParentDocument()->FireDelayedEvent(reorderEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1748,36 +1734,6 @@ DocAccessible::UpdateAccessibleOnAttrChange(dom::Element* aElement,
|
||||
return false;
|
||||
}
|
||||
|
||||
// DocAccessible public member
|
||||
nsresult
|
||||
DocAccessible::FireDelayedAccessibleEvent(uint32_t aEventType, nsINode* aNode,
|
||||
AccEvent::EEventRule aAllowDupes,
|
||||
EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(aEventType, aNode, aIsFromUserInput, aAllowDupes);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
|
||||
// DocAccessible public member
|
||||
nsresult
|
||||
DocAccessible::FireDelayedAccessibleEvent(AccEvent* aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG(aEvent);
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
logging::DocLoadEventFired(aEvent);
|
||||
#endif
|
||||
|
||||
if (mNotificationController)
|
||||
mNotificationController->QueueEvent(aEvent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
DocAccessible::ProcessContentInserted(Accessible* aContainer,
|
||||
const nsTArray<nsCOMPtr<nsIContent> >* aInsertedContent)
|
||||
@ -1857,8 +1813,7 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
|
||||
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);
|
||||
|
||||
} else {
|
||||
nsAccTreeWalker walker(this, aChildNode,
|
||||
aContainer->CanHaveAnonChildren(), true);
|
||||
TreeWalker walker(aContainer, aChildNode, true);
|
||||
|
||||
while ((child = walker.NextChild()))
|
||||
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);
|
||||
@ -1876,9 +1831,7 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
|
||||
Accessible* ancestor = aContainer;
|
||||
while (ancestor) {
|
||||
if (ancestor->ARIARole() == roles::ALERT) {
|
||||
nsRefPtr<AccEvent> alertEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
|
||||
FireDelayedAccessibleEvent(alertEvent);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1894,7 +1847,7 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
|
||||
|
||||
// Fire reorder event so the MSAA clients know the children have changed. Also
|
||||
// the event is used internally by MSAA layer.
|
||||
FireDelayedAccessibleEvent(reorderEvent);
|
||||
FireDelayedEvent(reorderEvent);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@ -1918,11 +1871,8 @@ DocAccessible::UpdateTreeInternal(Accessible* aChild, bool aIsInsert,
|
||||
// the changes before our processing and we may miss some menupopup
|
||||
// events. Now we just want to be consistent in content insertion/removal
|
||||
// handling.
|
||||
if (aChild->ARIARole() == roles::MENUPOPUP) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END, aChild);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
if (aChild->ARIARole() == roles::MENUPOPUP)
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END, aChild);
|
||||
}
|
||||
|
||||
// Fire show/hide event.
|
||||
@ -1932,23 +1882,19 @@ DocAccessible::UpdateTreeInternal(Accessible* aChild, bool aIsInsert,
|
||||
else
|
||||
event = new AccHideEvent(aChild, node);
|
||||
|
||||
FireDelayedAccessibleEvent(event);
|
||||
FireDelayedEvent(event);
|
||||
aReorderEvent->AddSubMutationEvent(event);
|
||||
|
||||
if (aIsInsert) {
|
||||
roles::Role ariaRole = aChild->ARIARole();
|
||||
if (ariaRole == roles::MENUPOPUP) {
|
||||
// Fire EVENT_MENUPOPUP_START if ARIA menu appears.
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START, aChild);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START, aChild);
|
||||
|
||||
} else if (ariaRole == roles::ALERT) {
|
||||
// Fire EVENT_ALERT if ARIA alert appears.
|
||||
updateFlags = eAlertAccessible;
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_ALERT, aChild);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, aChild);
|
||||
}
|
||||
|
||||
// If focused node has been shown then it means its frame was recreated
|
||||
@ -1998,8 +1944,7 @@ DocAccessible::CacheChildrenInSubtree(Accessible* aRoot)
|
||||
if (aRoot->HasARIARole() && !aRoot->IsDoc()) {
|
||||
a11y::role role = aRoot->ARIARole();
|
||||
if (role == roles::DIALOG || role == roles::DOCUMENT)
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE,
|
||||
aRoot->GetContent());
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE, aRoot);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,22 +24,20 @@
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
|
||||
template<class Class, class Arg>
|
||||
class TNotification;
|
||||
class NotificationController;
|
||||
class nsAccessiblePivot;
|
||||
|
||||
class nsIScrollableView;
|
||||
class nsAccessiblePivot;
|
||||
|
||||
const uint32_t kDefaultCacheSize = 256;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class DocManager;
|
||||
class NotificationController;
|
||||
class RelatedAccIterator;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
template<class Class, class Arg>
|
||||
class TNotification;
|
||||
|
||||
class DocAccessible : public HyperTextAccessibleWrap,
|
||||
public nsIAccessibleDocument,
|
||||
@ -175,22 +173,10 @@ public:
|
||||
{ return mChildDocuments.SafeElementAt(aIndex, nullptr); }
|
||||
|
||||
/**
|
||||
* Non-virtual method to fire a delayed event after a 0 length timeout.
|
||||
*
|
||||
* @param aEventType [in] the nsIAccessibleEvent event type
|
||||
* @param aDOMNode [in] DOM node the accesible event should be fired for
|
||||
* @param aAllowDupes [in] rule to process an event (see EEventRule constants)
|
||||
* Fire accessible event asynchronously.
|
||||
*/
|
||||
nsresult FireDelayedAccessibleEvent(uint32_t aEventType, nsINode *aNode,
|
||||
AccEvent::EEventRule aAllowDupes = AccEvent::eRemoveDupes,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
/**
|
||||
* Fire accessible event after timeout.
|
||||
*
|
||||
* @param aEvent [in] the event to fire
|
||||
*/
|
||||
nsresult FireDelayedAccessibleEvent(AccEvent* aEvent);
|
||||
void FireDelayedEvent(AccEvent* aEvent);
|
||||
void FireDelayedEvent(uint32_t aEventType, Accessible* aTarget);
|
||||
|
||||
/**
|
||||
* Fire value change event on the given accessible if applicable.
|
||||
@ -333,7 +319,7 @@ protected:
|
||||
void NotifyOfLoad(uint32_t aLoadEventType);
|
||||
void NotifyOfLoading(bool aIsReloading);
|
||||
|
||||
friend class nsAccDocManager;
|
||||
friend class DocManager;
|
||||
|
||||
/**
|
||||
* Perform initial update (create accessible tree).
|
||||
@ -400,27 +386,28 @@ protected:
|
||||
bool UpdateAccessibleOnAttrChange(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Fires accessible events when attribute is changed.
|
||||
*
|
||||
* @param aContent - node that attribute is changed for
|
||||
* @param aNameSpaceID - namespace of changed attribute
|
||||
* @param aAttribute - changed attribute
|
||||
*/
|
||||
void AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID, nsIAtom* aAttribute);
|
||||
/**
|
||||
* Fire accessible events when attribute is changed.
|
||||
*
|
||||
* @param aAccessible [in] accessible the DOM attribute is changed for
|
||||
* @param aNameSpaceID [in] namespace of changed attribute
|
||||
* @param aAttribute [in] changed attribute
|
||||
*/
|
||||
void AttributeChangedImpl(Accessible* aAccessible,
|
||||
int32_t aNameSpaceID, nsIAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Fires accessible events when ARIA attribute is changed.
|
||||
*
|
||||
* @param aContent - node that attribute is changed for
|
||||
* @param aAttribute - changed attribute
|
||||
*/
|
||||
void ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute);
|
||||
/**
|
||||
* Fire accessible events when ARIA attribute is changed.
|
||||
*
|
||||
* @param aAccessible [in] accesislbe the DOM attribute is changed for
|
||||
* @param aAttribute [in] changed attribute
|
||||
*/
|
||||
void ARIAAttributeChanged(Accessible* aAccessible, nsIAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Process ARIA active-descendant attribute change.
|
||||
*/
|
||||
void ARIAActiveDescendantChanged(nsIContent* aElm);
|
||||
void ARIAActiveDescendantChanged(Accessible* aAccessible);
|
||||
|
||||
/**
|
||||
* Update the accessible tree for inserted content.
|
||||
@ -563,7 +550,7 @@ protected:
|
||||
typedef nsTArray<nsAutoPtr<AttrRelProvider> > AttrRelProviderArray;
|
||||
nsClassHashtable<nsStringHashKey, AttrRelProviderArray> mDependentIDsHash;
|
||||
|
||||
friend class mozilla::a11y::RelatedAccIterator;
|
||||
friend class RelatedAccIterator;
|
||||
|
||||
/**
|
||||
* Used for our caching algorithm. We store the list of nodes that should be
|
||||
@ -591,4 +578,7 @@ Accessible::AsDoc()
|
||||
static_cast<DocAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -17,12 +17,11 @@
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
struct DOMPoint {
|
||||
nsINode* node;
|
||||
int32_t idx;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
|
||||
|
||||
@ -243,7 +242,7 @@ public:
|
||||
|
||||
protected:
|
||||
// Accessible
|
||||
virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
||||
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
||||
|
||||
// HyperTextAccessible
|
||||
|
||||
@ -405,5 +404,8 @@ Accessible::AsHyperText()
|
||||
static_cast<HyperTextAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -77,18 +77,17 @@ private:
|
||||
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Accessible downcasting method
|
||||
|
||||
inline mozilla::a11y::ImageAccessible*
|
||||
inline ImageAccessible*
|
||||
Accessible::AsImage()
|
||||
{
|
||||
return IsImage() ?
|
||||
static_cast<mozilla::a11y::ImageAccessible*>(this) : nullptr;
|
||||
return IsImage() ? static_cast<ImageAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -135,13 +135,13 @@ OuterDocAccessible::Shutdown()
|
||||
void
|
||||
OuterDocAccessible::InvalidateChildren()
|
||||
{
|
||||
// Do not invalidate children because nsAccDocManager is responsible for
|
||||
// Do not invalidate children because DocManager is responsible for
|
||||
// document accessible lifetime when DOM document is created or destroyed. If
|
||||
// DOM document isn't destroyed but its presshell is destroyed (for example,
|
||||
// when DOM node of outerdoc accessible is hidden), then outerdoc accessible
|
||||
// notifies nsAccDocManager about this. If presshell is created for existing
|
||||
// notifies DocManager about this. If presshell is created for existing
|
||||
// DOM document (for example when DOM node of outerdoc accessible is shown)
|
||||
// then allow nsAccDocManager to handle this case since the document
|
||||
// then allow DocManager to handle this case since the document
|
||||
// accessible is created and appended as a child when it's requested.
|
||||
|
||||
SetChildrenFlag(eChildrenUninitialized);
|
||||
|
@ -311,8 +311,6 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
if (!accessible)
|
||||
return;
|
||||
|
||||
nsINode* targetNode = accessible->GetNode();
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
XULTreeAccessible* treeAcc = accessible->AsXULTree();
|
||||
if (treeAcc) {
|
||||
@ -383,6 +381,7 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
return;
|
||||
}
|
||||
|
||||
nsINode* targetNode = accessible->GetNode();
|
||||
if (treeItemAcc && eventType.EqualsLiteral("select")) {
|
||||
// XXX: We shouldn't be based on DOM select event which doesn't provide us
|
||||
// any context info. We should integrate into nsTreeSelection instead.
|
||||
@ -478,10 +477,10 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
|
||||
//We don't process 'ValueChange' events for progress meters since we listen
|
||||
//@value attribute change for them.
|
||||
if (!accessible->IsProgress())
|
||||
targetDocument->
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
targetNode);
|
||||
if (!accessible->IsProgress()) {
|
||||
targetDocument->FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
accessible);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_DRAGDROPSTART
|
||||
else if (eventType.EqualsLiteral("mouseover")) {
|
||||
@ -677,7 +676,7 @@ RootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
|
||||
if (notifyOf & kNotifyOfState) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(widget, states::EXPANDED, false);
|
||||
document->FireDelayedAccessibleEvent(event);
|
||||
document->FireDelayedEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "nsCaretAccessible.h"
|
||||
#include "DocAccessibleWrap.h"
|
||||
|
||||
|
||||
#include "nsHashtable.h"
|
||||
#include "nsCaretAccessible.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -83,14 +82,14 @@ protected:
|
||||
nsRefPtr<nsCaretAccessible> mCaretAccessible;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
inline mozilla::a11y::RootAccessible*
|
||||
inline RootAccessible*
|
||||
Accessible::AsRoot()
|
||||
{
|
||||
return mFlags & eRootAccessible ?
|
||||
static_cast<mozilla::a11y::RootAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -11,11 +11,11 @@
|
||||
#include "nsTArray.h"
|
||||
#include "prtypes.h"
|
||||
|
||||
class Accessible;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
|
||||
/**
|
||||
* Accessible table interface.
|
||||
*/
|
||||
|
@ -10,11 +10,10 @@
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/StandardInteger.h"
|
||||
|
||||
class Accessible;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Accessible;
|
||||
class TableAccessible;
|
||||
|
||||
/**
|
||||
|
@ -38,18 +38,19 @@ protected:
|
||||
nsString mText;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Accessible downcast method
|
||||
|
||||
inline mozilla::a11y::TextLeafAccessible*
|
||||
inline TextLeafAccessible*
|
||||
Accessible::AsTextLeaf()
|
||||
{
|
||||
return mFlags & eTextLeafAccessible ?
|
||||
static_cast<mozilla::a11y::TextLeafAccessible*>(this) : nullptr;
|
||||
static_cast<TextLeafAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsARIAMap.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "DocAccessible-inl.h"
|
||||
#include "Role.h"
|
||||
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
@ -95,7 +95,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
|
||||
|
||||
if (aDoFireEvents) {
|
||||
nsRefPtr<AccHideEvent> event = new AccHideEvent(area, area->GetContent());
|
||||
mDoc->FireDelayedAccessibleEvent(event);
|
||||
mDoc->FireDelayedEvent(event);
|
||||
reorderEvent->AddSubMutationEvent(event);
|
||||
doReorderEvent = true;
|
||||
}
|
||||
@ -121,7 +121,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
|
||||
|
||||
if (aDoFireEvents) {
|
||||
nsRefPtr<AccShowEvent> event = new AccShowEvent(area, areaContent);
|
||||
mDoc->FireDelayedAccessibleEvent(event);
|
||||
mDoc->FireDelayedEvent(event);
|
||||
reorderEvent->AddSubMutationEvent(event);
|
||||
doReorderEvent = true;
|
||||
}
|
||||
@ -130,7 +130,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
|
||||
|
||||
// Fire reorder event if needed.
|
||||
if (doReorderEvent)
|
||||
mDoc->FireDelayedAccessibleEvent(reorderEvent);
|
||||
mDoc->FireDelayedEvent(reorderEvent);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -69,17 +69,18 @@ protected:
|
||||
virtual void CacheChildren();
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Accessible downcasting method
|
||||
|
||||
inline mozilla::a11y::HTMLImageMapAccessible*
|
||||
inline HTMLImageMapAccessible*
|
||||
Accessible::AsImageMap()
|
||||
{
|
||||
return IsImageMapAccessible() ?
|
||||
static_cast<mozilla::a11y::HTMLImageMapAccessible*>(this) : nullptr;
|
||||
static_cast<HTMLImageMapAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -96,15 +96,15 @@ public:
|
||||
bool IsInside() const;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
inline mozilla::a11y::HTMLLIAccessible*
|
||||
inline HTMLLIAccessible*
|
||||
Accessible::AsHTMLListItem()
|
||||
{
|
||||
return mFlags & eHTMLListItemAccessible ?
|
||||
static_cast<mozilla::a11y::HTMLLIAccessible*>(this) : nullptr;
|
||||
static_cast<HTMLLIAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -7,16 +7,15 @@
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMRange.h"
|
||||
@ -29,6 +28,7 @@
|
||||
#include "nsIDOMHTMLTableRowElement.h"
|
||||
#include "nsIDOMHTMLTableSectionElem.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsITableLayout.h"
|
||||
#include "nsITableCellLayout.h"
|
||||
@ -358,7 +358,7 @@ HTMLTableAccessible::CacheChildren()
|
||||
// caption only, because nsAccessibilityService ensures we don't create
|
||||
// accessibles for the other captions, since only the first is actually
|
||||
// visible.
|
||||
nsAccTreeWalker walker(mDoc, mContent, CanHaveAnonChildren());
|
||||
TreeWalker walker(this, mContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild())) {
|
||||
|
@ -50,10 +50,7 @@ var gSimpleTraversalRoles =
|
||||
Ci.nsIAccessibleRole.ROLE_LINK,
|
||||
Ci.nsIAccessibleRole.ROLE_PAGETAB,
|
||||
Ci.nsIAccessibleRole.ROLE_GRAPHIC,
|
||||
// XXX: Find a better solution for ROLE_STATICTEXT.
|
||||
// It allows to filter list bullets but at the same time it
|
||||
// filters CSS generated content too as an unwanted side effect.
|
||||
// Ci.nsIAccessibleRole.ROLE_STATICTEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_STATICTEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_TEXT_LEAF,
|
||||
Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
@ -95,6 +92,16 @@ this.TraversalRules = {
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
else
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
|
||||
case Ci.nsIAccessibleRole.ROLE_STATICTEXT:
|
||||
{
|
||||
let parent = aAccessible.parent;
|
||||
// Ignore prefix static text in list items. They are typically bullets or numbers.
|
||||
if (parent.childCount > 1 && aAccessible.indexInParent == 0 &&
|
||||
parent.role == Ci.nsIAccessibleRole.ROLE_LISTITEM)
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
|
||||
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
}
|
||||
default:
|
||||
// Ignore the subtree, if there is one. So that we don't land on
|
||||
// the same content that was already presented by its parent.
|
||||
|
@ -25,6 +25,9 @@
|
||||
@class mozAccessible;
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccessibleWrap : public Accessible
|
||||
{
|
||||
public: // construction, destruction
|
||||
@ -108,4 +111,7 @@ private:
|
||||
bool mNativeInited;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
#include "DocAccessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class DocAccessibleWrap : public DocAccessible
|
||||
{
|
||||
public:
|
||||
@ -17,4 +20,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#import "mozAccessible.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
DocAccessibleWrap::
|
||||
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
|
||||
nsIPresShell* aPresShell) :
|
||||
|
@ -8,7 +8,13 @@
|
||||
|
||||
#include "HyperTextAccessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
typedef class HyperTextAccessible HyperTextAccessibleWrap;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -36,7 +36,7 @@ GetNativeFromGeckoAccessible(nsIAccessible* aAccessible)
|
||||
/**
|
||||
* Weak reference; it owns us.
|
||||
*/
|
||||
AccessibleWrap* mGeckoAccessible;
|
||||
mozilla::a11y::AccessibleWrap* mGeckoAccessible;
|
||||
|
||||
/**
|
||||
* Strong ref to array of children
|
||||
@ -55,7 +55,7 @@ GetNativeFromGeckoAccessible(nsIAccessible* aAccessible)
|
||||
}
|
||||
|
||||
// inits with the gecko owner.
|
||||
- (id)initWithAccessible:(AccessibleWrap*)geckoParent;
|
||||
- (id)initWithAccessible:(mozilla::a11y::AccessibleWrap*)geckoParent;
|
||||
|
||||
// our accessible parent (AXParent)
|
||||
- (id <mozAccessible>)parent;
|
||||
@ -116,7 +116,7 @@ GetNativeFromGeckoAccessible(nsIAccessible* aAccessible)
|
||||
/**
|
||||
* Append a child if they are already cached.
|
||||
*/
|
||||
- (void)appendChild:(Accessible*)aAccessible;
|
||||
- (void)appendChild:(mozilla::a11y::Accessible*)aAccessible;
|
||||
|
||||
// makes ourselves "expired". after this point, we might be around if someone
|
||||
// has retained us (e.g., a third-party), but we really contain no information.
|
||||
|
@ -10,7 +10,7 @@
|
||||
{
|
||||
// both of these are the same old mGeckoAccessible, but already
|
||||
// QI'd for us, to the right type, for convenience.
|
||||
HyperTextAccessible *mGeckoTextAccessible; // strong
|
||||
mozilla::a11y::HyperTextAccessible* mGeckoTextAccessible; // strong
|
||||
nsIAccessibleEditableText *mGeckoEditableTextAccessible; // strong
|
||||
}
|
||||
@end
|
||||
|
@ -12,7 +12,10 @@
|
||||
|
||||
#include "nsAccessNode.h"
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode
|
||||
{
|
||||
public:
|
||||
nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);
|
||||
@ -22,5 +25,8 @@ public:
|
||||
static void ShutdownAccessibility();
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
/*
|
||||
* Class nsAccessNodeWrap
|
||||
|
@ -116,6 +116,10 @@ __try { \
|
||||
IMPL_IUNKNOWN_QUERY_CLASS(Super0) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccessibleWrap : public Accessible,
|
||||
public ia2AccessibleComponent,
|
||||
public ia2AccessibleHyperlink,
|
||||
@ -370,4 +374,7 @@ protected:
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -9,11 +9,11 @@
|
||||
|
||||
#include "mozilla/StandardInteger.h"
|
||||
|
||||
class nsAccessNodeWrap;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class nsAccessNodeWrap;
|
||||
|
||||
/**
|
||||
* Used to get compatibility modes. Note, modes are computed at accessibility
|
||||
* start up time and aren't changed during lifetime.
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include "DocAccessible.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class DocAccessibleWrap : public DocAccessible,
|
||||
public ISimpleDOMDocument
|
||||
{
|
||||
@ -69,4 +72,7 @@ protected:
|
||||
void* mHWND;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -9,6 +9,9 @@
|
||||
|
||||
#include "nsEventShell.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap,
|
||||
HyperTextAccessible)
|
||||
|
||||
|
@ -12,6 +12,9 @@
|
||||
#include "ia2AccessibleEditableText.h"
|
||||
#include "ia2AccessibleHyperText.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class HyperTextAccessibleWrap : public HyperTextAccessible,
|
||||
public ia2AccessibleHypertext,
|
||||
public ia2AccessibleEditableText
|
||||
@ -35,5 +38,7 @@ protected:
|
||||
uint32_t *aEndOffset);
|
||||
};
|
||||
|
||||
#endif
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -43,12 +43,15 @@
|
||||
{ } \
|
||||
return E_FAIL;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccTextChangeEvent;
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode,
|
||||
public nsIWinAccessNode,
|
||||
public ISimpleDOMNode,
|
||||
public IServiceProvider
|
||||
class nsAccessNodeWrap : public nsAccessNode,
|
||||
public nsIWinAccessNode,
|
||||
public ISimpleDOMNode,
|
||||
public IServiceProvider
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@ -148,6 +151,9 @@ protected:
|
||||
static AccTextChangeEvent* gTextEvent;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
* Converts nsresult to HRESULT.
|
||||
*/
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
|
@ -7,12 +7,15 @@
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
|
||||
#ifndef _AccessibleWrap_H_
|
||||
#define _AccessibleWrap_H_
|
||||
#ifndef mozilla_a11y_AccessibleWrap_h_
|
||||
#define mozilla_a11y_AccessibleWrap_h_
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "Accessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccessibleWrap : public Accessible
|
||||
{
|
||||
public: // construction, destruction
|
||||
@ -26,4 +29,7 @@ public: // construction, destruction
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -12,6 +12,12 @@
|
||||
|
||||
#include "DocAccessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
typedef DocAccessible DocAccessibleWrap;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -8,7 +8,13 @@
|
||||
|
||||
#include "HyperTextAccessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
typedef class HyperTextAccessible HyperTextAccessibleWrap;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class nsAccessNodeWrap
|
||||
|
@ -12,6 +12,9 @@
|
||||
|
||||
#include "nsAccessNode.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode
|
||||
{
|
||||
public: // construction, destruction
|
||||
@ -22,5 +25,8 @@ public: // construction, destruction
|
||||
static void ShutdownAccessibility();
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// IAccessibleEditableText
|
||||
|
||||
STDMETHODIMP
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "AccessibleWrap.h"
|
||||
#include "nsIWinAccessNode.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include "HyperTextAccessibleWrap.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// IAccessibleHypertext
|
||||
|
||||
STDMETHODIMP
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
#define TABLECELL_INTERFACE_UNSUPPORTED_MSG \
|
||||
"Subclass of ia2AccessibleTableCell doesn't implement nsIAccessibleTableCell"\
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// IAccessibleText
|
||||
|
||||
STDMETHODIMP
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
|
@ -11,11 +11,11 @@
|
||||
#include "AccessibleWrap.h"
|
||||
#include "UIAutomation.h"
|
||||
|
||||
class AccessibleWrap;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccessibleWrap;
|
||||
|
||||
/**
|
||||
* IRawElementProviderSimple implementation (maintains IAccessibleEx approach).
|
||||
*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user