mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 833164 - code gen xpcom accessible events r=surkov ted
This commit is contained in:
parent
10e8c887e8
commit
206e3db32f
@ -12,7 +12,13 @@ XPIDL_SOURCES += [
|
||||
'nsIAccessibleCursorable.idl',
|
||||
'nsIAccessibleDocument.idl',
|
||||
'nsIAccessibleEditableText.idl',
|
||||
'nsIAccessibleCaretMoveEvent.idl',
|
||||
'nsIAccessibleEvent.idl',
|
||||
'nsIAccessibleHideEvent.idl',
|
||||
'nsIAccessibleStateChangeEvent.idl',
|
||||
'nsIAccessibleTableChangeEvent.idl',
|
||||
'nsIAccessibleTextChangeEvent.idl',
|
||||
'nsIAccessibleVirtualCursorChangeEvent.idl',
|
||||
'nsIAccessibleHyperLink.idl',
|
||||
'nsIAccessibleHyperText.idl',
|
||||
'nsIAccessibleImage.idl',
|
||||
|
18
accessible/public/nsIAccessibleCaretMoveEvent.idl
Normal file
18
accessible/public/nsIAccessibleCaretMoveEvent.idl
Normal file
@ -0,0 +1,18 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 "nsIAccessibleEvent.idl"
|
||||
|
||||
/**
|
||||
* Fired when the caret changes position in text.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
|
||||
interface nsIAccessibleCaretMoveEvent: nsIAccessibleEvent
|
||||
{
|
||||
/**
|
||||
* Return caret offset.
|
||||
*/
|
||||
readonly attribute long caretOffset;
|
||||
};
|
@ -25,7 +25,7 @@ interface nsIDOMNode;
|
||||
* if (NS_SUCCEEDED(rv))
|
||||
* rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
|
||||
*/
|
||||
[scriptable, uuid(7f66a33a-9ed7-4fd4-87a8-e431b0f43368)]
|
||||
[scriptable, builtinclass, uuid(7f66a33a-9ed7-4fd4-87a8-e431b0f43368)]
|
||||
interface nsIAccessibleEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -448,120 +448,3 @@ interface nsIAccessibleEvent : nsISupports
|
||||
*/
|
||||
readonly attribute boolean isFromUserInput;
|
||||
};
|
||||
|
||||
|
||||
[scriptable, uuid(9addd25d-8fa1-415e-94ec-6038f220d3e4)]
|
||||
interface nsIAccessibleStateChangeEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns the state of accessible (see constants declared
|
||||
* in nsIAccessibleStates).
|
||||
*/
|
||||
readonly attribute unsigned long state;
|
||||
|
||||
/**
|
||||
* Returns true if the state is extra state.
|
||||
*/
|
||||
boolean isExtraState();
|
||||
|
||||
/**
|
||||
* Returns true if the state is turned on.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
};
|
||||
|
||||
|
||||
[scriptable, uuid(21e0f8bd-5638-4964-870b-3c8e944ac4c4)]
|
||||
interface nsIAccessibleTextChangeEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns offset of changed text in accessible.
|
||||
*/
|
||||
readonly attribute long start;
|
||||
|
||||
/**
|
||||
* Returns length of changed text.
|
||||
*/
|
||||
readonly attribute unsigned long length;
|
||||
|
||||
/**
|
||||
* Returns true if text was inserted, otherwise false.
|
||||
*/
|
||||
boolean isInserted();
|
||||
|
||||
/**
|
||||
* The inserted or removed text
|
||||
*/
|
||||
readonly attribute DOMString modifiedText;
|
||||
};
|
||||
|
||||
[scriptable, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
|
||||
interface nsIAccessibleHideEvent: nsISupports
|
||||
{
|
||||
/**
|
||||
* Return an accessible that was a parent of the target.
|
||||
*/
|
||||
readonly attribute nsIAccessible targetParent;
|
||||
|
||||
/**
|
||||
* Return an accessible that was a next sibling of the target
|
||||
*/
|
||||
readonly attribute nsIAccessible targetNextSibling;
|
||||
|
||||
/**
|
||||
* Return an accessible that was a parent of the target
|
||||
*/
|
||||
readonly attribute nsIAccessible targetPrevSibling;
|
||||
};
|
||||
|
||||
[scriptable, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
|
||||
interface nsIAccessibleCaretMoveEvent: nsISupports
|
||||
{
|
||||
/**
|
||||
* Return caret offset.
|
||||
*/
|
||||
readonly attribute long caretOffset;
|
||||
};
|
||||
|
||||
[scriptable, uuid(df517997-ed52-4ea2-b310-2f8e0fe64572)]
|
||||
interface nsIAccessibleTableChangeEvent: nsISupports
|
||||
{
|
||||
/**
|
||||
* Return the row or column index.
|
||||
*/
|
||||
readonly attribute long rowOrColIndex;
|
||||
|
||||
/**
|
||||
* Return the number of rows or cols
|
||||
*/
|
||||
readonly attribute long numRowsOrCols;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* An interface for virtual cursor changed events.
|
||||
* Passes previous cursor position and text offsets.
|
||||
*/
|
||||
[scriptable, uuid(370e8b9b-2bbc-4bff-a9c7-16ddc54aea21)]
|
||||
interface nsIAccessibleVirtualCursorChangeEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
* Previous object pointed at by virtual cursor. null if none.
|
||||
*/
|
||||
readonly attribute nsIAccessible oldAccessible;
|
||||
|
||||
/**
|
||||
* Previous start offset of pivot. -1 if none.
|
||||
*/
|
||||
readonly attribute long oldStartOffset;
|
||||
|
||||
/**
|
||||
* Previous end offset of pivot. -1 if none.
|
||||
*/
|
||||
readonly attribute long oldEndOffset;
|
||||
|
||||
/**
|
||||
* Reason for virtual cursor move.
|
||||
*/
|
||||
readonly attribute short reason;
|
||||
};
|
||||
|
28
accessible/public/nsIAccessibleHideEvent.idl
Normal file
28
accessible/public/nsIAccessibleHideEvent.idl
Normal file
@ -0,0 +1,28 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 "nsIAccessibleEvent.idl"
|
||||
|
||||
/**
|
||||
* Fired when a accessible and its subtree are removed from the tree.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
|
||||
interface nsIAccessibleHideEvent: nsIAccessibleEvent
|
||||
{
|
||||
/**
|
||||
* Return an accessible that was a parent of the target.
|
||||
*/
|
||||
readonly attribute nsIAccessible targetParent;
|
||||
|
||||
/**
|
||||
* Return an accessible that was a next sibling of the target
|
||||
*/
|
||||
readonly attribute nsIAccessible targetNextSibling;
|
||||
|
||||
/**
|
||||
* Return an accessible that was a parent of the target
|
||||
*/
|
||||
readonly attribute nsIAccessible targetPrevSibling;
|
||||
};
|
29
accessible/public/nsIAccessibleStateChangeEvent.idl
Normal file
29
accessible/public/nsIAccessibleStateChangeEvent.idl
Normal file
@ -0,0 +1,29 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 "nsIAccessibleEvent.idl"
|
||||
|
||||
/**
|
||||
* Fired when a state of an accessible changes.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(0d2d77c5-7b16-4a15-8b20-c484ceb5ac0d)]
|
||||
interface nsIAccessibleStateChangeEvent : nsIAccessibleEvent
|
||||
{
|
||||
/**
|
||||
* Returns the state of accessible (see constants declared
|
||||
* in nsIAccessibleStates).
|
||||
*/
|
||||
readonly attribute unsigned long state;
|
||||
|
||||
/**
|
||||
* Returns true if the state is extra state.
|
||||
*/
|
||||
readonly attribute boolean isExtraState;
|
||||
|
||||
/**
|
||||
* Returns true if the state is turned on.
|
||||
*/
|
||||
readonly attribute boolean isEnabled;
|
||||
};
|
20
accessible/public/nsIAccessibleTableChangeEvent.idl
Normal file
20
accessible/public/nsIAccessibleTableChangeEvent.idl
Normal file
@ -0,0 +1,20 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 "nsIAccessibleEvent.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(df517997-ed52-4ea2-b310-2f8e0fe64572)]
|
||||
interface nsIAccessibleTableChangeEvent: nsIAccessibleEvent
|
||||
{
|
||||
/**
|
||||
* Return the row or column index.
|
||||
*/
|
||||
readonly attribute long rowOrColIndex;
|
||||
|
||||
/**
|
||||
* Return the number of rows or cols
|
||||
*/
|
||||
readonly attribute long RowsOrColsCount;
|
||||
};
|
33
accessible/public/nsIAccessibleTextChangeEvent.idl
Normal file
33
accessible/public/nsIAccessibleTextChangeEvent.idl
Normal file
@ -0,0 +1,33 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 "nsIAccessibleEvent.idl"
|
||||
|
||||
/**
|
||||
* Fired when an accessible's text changes.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(21e0f8bd-5638-4964-870b-3c8e944ac4c4)]
|
||||
interface nsIAccessibleTextChangeEvent : nsIAccessibleEvent
|
||||
{
|
||||
/**
|
||||
* Returns offset of changed text in accessible.
|
||||
*/
|
||||
readonly attribute long start;
|
||||
|
||||
/**
|
||||
* Returns length of changed text.
|
||||
*/
|
||||
readonly attribute unsigned long length;
|
||||
|
||||
/**
|
||||
* Returns true if text was inserted, otherwise false.
|
||||
*/
|
||||
readonly attribute boolean isInserted;
|
||||
|
||||
/**
|
||||
* The inserted or removed text
|
||||
*/
|
||||
readonly attribute DOMString modifiedText;
|
||||
};
|
34
accessible/public/nsIAccessibleVirtualCursorChangeEvent.idl
Normal file
34
accessible/public/nsIAccessibleVirtualCursorChangeEvent.idl
Normal file
@ -0,0 +1,34 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 "nsIAccessibleEvent.idl"
|
||||
|
||||
/*
|
||||
* An interface for virtual cursor changed events.
|
||||
* Passes previous cursor position and text offsets.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(370e8b9b-2bbc-4bff-a9c7-16ddc54aea21)]
|
||||
interface nsIAccessibleVirtualCursorChangeEvent : nsIAccessibleEvent
|
||||
{
|
||||
/**
|
||||
* Previous object pointed at by virtual cursor. null if none.
|
||||
*/
|
||||
readonly attribute nsIAccessible oldAccessible;
|
||||
|
||||
/**
|
||||
* Previous start offset of pivot. -1 if none.
|
||||
*/
|
||||
readonly attribute long oldStartOffset;
|
||||
|
||||
/**
|
||||
* Previous end offset of pivot. -1 if none.
|
||||
*/
|
||||
readonly attribute long oldEndOffset;
|
||||
|
||||
/**
|
||||
* Reason for virtual cursor move.
|
||||
*/
|
||||
readonly attribute short reason;
|
||||
};
|
@ -11,7 +11,7 @@
|
||||
#include "nsAccUtils.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsAccEvent.h"
|
||||
#include "xpcAccEvents.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsEventStateManager.h"
|
||||
@ -20,6 +20,7 @@
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -39,17 +40,6 @@ AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccEvent public methods
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccEvent::CreateXPCOMObject()
|
||||
{
|
||||
nsAccEvent* event = new nsAccEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccEvent cycle collection
|
||||
|
||||
@ -59,18 +49,6 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccStateChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccStateChangeEvent::CreateXPCOMObject()
|
||||
{
|
||||
nsAccEvent* event = new nsAccStateChangeEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccTextChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -100,14 +78,6 @@ AccTextChangeEvent::
|
||||
(states::FOCUSED | states::EDITABLE);
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccTextChangeEvent::CreateXPCOMObject()
|
||||
{
|
||||
nsAccEvent* event = new nsAccTextChangeEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccReorderEvent
|
||||
@ -142,14 +112,6 @@ AccHideEvent::
|
||||
mPrevSibling = mAccessible->PrevSibling();
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccHideEvent::CreateXPCOMObject()
|
||||
{
|
||||
nsAccEvent* event = new nsAccHideEvent(this);
|
||||
NS_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccShowEvent
|
||||
@ -162,19 +124,6 @@ AccShowEvent::
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccCaretMoveEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccCaretMoveEvent::CreateXPCOMObject()
|
||||
{
|
||||
nsAccEvent* event = new nsAccCaretMoveEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccSelChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -209,14 +158,6 @@ AccTableChangeEvent::
|
||||
{
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccTableChangeEvent::CreateXPCOMObject()
|
||||
{
|
||||
nsAccEvent* event = new nsAccTableChangeEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccVCChangeEvent
|
||||
@ -233,10 +174,63 @@ AccVCChangeEvent::
|
||||
{
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccVCChangeEvent::CreateXPCOMObject()
|
||||
already_AddRefed<nsIAccessibleEvent>
|
||||
a11y::MakeXPCEvent(AccEvent* aEvent)
|
||||
{
|
||||
nsAccEvent* event = new nsAccVirtualCursorChangeEvent(this);
|
||||
NS_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
DocAccessible* doc = aEvent->GetDocAccessible();
|
||||
Accessible* acc = aEvent->GetAccessible();
|
||||
nsINode* node = acc->GetNode();
|
||||
nsIDOMNode* domNode = node ? node->AsDOMNode() : nullptr;
|
||||
bool fromUser = aEvent->IsFromUserInput();
|
||||
uint32_t type = aEvent->GetEventType();
|
||||
uint32_t eventGroup = aEvent->GetEventGroups();
|
||||
nsCOMPtr<nsIAccessibleEvent> xpEvent;
|
||||
|
||||
if (eventGroup & (1 << AccEvent::eStateChangeEvent)) {
|
||||
AccStateChangeEvent* sc = downcast_accEvent(aEvent);
|
||||
bool extra = false;
|
||||
uint32_t state = nsAccUtils::To32States(sc->GetState(), &extra);
|
||||
xpEvent = new xpcAccStateChangeEvent(type, acc, doc, domNode, fromUser,
|
||||
state, extra, sc->IsStateEnabled());
|
||||
return xpEvent.forget();
|
||||
}
|
||||
|
||||
if (eventGroup & (1 << AccEvent::eTextChangeEvent)) {
|
||||
AccTextChangeEvent* tc = downcast_accEvent(aEvent);
|
||||
nsString text;
|
||||
tc->GetModifiedText(text);
|
||||
xpEvent = new xpcAccTextChangeEvent(type, acc, doc, domNode, fromUser,
|
||||
tc->GetStartOffset(), tc->GetLength(),
|
||||
tc->IsTextInserted(), text);
|
||||
return xpEvent.forget();
|
||||
}
|
||||
|
||||
if (eventGroup & (1 << AccEvent::eHideEvent)) {
|
||||
AccHideEvent* hideEvent = downcast_accEvent(aEvent);
|
||||
xpEvent = new xpcAccHideEvent(type, acc, doc, domNode, fromUser,
|
||||
hideEvent->TargetParent(),
|
||||
hideEvent->TargetNextSibling(),
|
||||
hideEvent->TargetPrevSibling());
|
||||
return xpEvent.forget();
|
||||
}
|
||||
|
||||
if (eventGroup & (1 << AccEvent::eCaretMoveEvent)) {
|
||||
AccCaretMoveEvent* cm = downcast_accEvent(aEvent);
|
||||
xpEvent = new xpcAccCaretMoveEvent(type, acc, doc, domNode, fromUser,
|
||||
cm->GetCaretOffset());
|
||||
return xpEvent.forget();
|
||||
}
|
||||
|
||||
if (eventGroup & (1 << AccEvent::eVirtualCursorChangeEvent)) {
|
||||
AccVCChangeEvent* vcc = downcast_accEvent(aEvent);
|
||||
xpEvent = new xpcAccVirtualCursorChangeEvent(type, acc, doc, domNode, fromUser,
|
||||
vcc->OldAccessible(),
|
||||
vcc->OldStartOffset(),
|
||||
vcc->OldEndOffset(),
|
||||
vcc->Reason());
|
||||
return xpEvent.forget();
|
||||
}
|
||||
|
||||
xpEvent = new xpcAccEvent(type, acc, doc, domNode, fromUser);
|
||||
return xpEvent.forget();
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ namespace a11y {
|
||||
|
||||
class DocAccessible;
|
||||
|
||||
class nsAccEvent;
|
||||
|
||||
// Constants used to point whether the event is from user input.
|
||||
enum EIsFromUserInput
|
||||
{
|
||||
@ -83,11 +81,6 @@ public:
|
||||
Accessible* GetAccessible() const { return mAccessible; }
|
||||
DocAccessible* GetDocAccessible() const { return mAccessible->Document(); }
|
||||
|
||||
/**
|
||||
* Create and return an XPCOM object for accessible event object.
|
||||
*/
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
/**
|
||||
* Down casting.
|
||||
*/
|
||||
@ -147,8 +140,6 @@ public:
|
||||
{ mIsEnabled = (mAccessible->State() & mState) != 0; }
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
static const EventGroup kEventGroup = eStateChangeEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
@ -178,8 +169,6 @@ public:
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
static const EventGroup kEventGroup = eTextChangeEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
@ -248,8 +237,6 @@ public:
|
||||
AccHideEvent(Accessible* aTarget, nsINode* aTargetNode);
|
||||
|
||||
// Event
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
static const EventGroup kEventGroup = eHideEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
@ -349,8 +336,6 @@ public:
|
||||
virtual ~AccCaretMoveEvent() { }
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
static const EventGroup kEventGroup = eCaretMoveEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
@ -414,8 +399,6 @@ public:
|
||||
int32_t aRowOrColIndex, int32_t aNumRowsOrCols);
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
static const EventGroup kEventGroup = eTableChangeEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
@ -445,8 +428,6 @@ public:
|
||||
virtual ~AccVCChangeEvent() { }
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
static const EventGroup kEventGroup = eVirtualCursorChangeEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
@ -487,6 +468,12 @@ private:
|
||||
AccEvent* mRawPtr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a new xpcom accessible event for the given internal one.
|
||||
*/
|
||||
already_AddRefed<nsIAccessibleEvent>
|
||||
MakeXPCEvent(AccEvent* aEvent);
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -268,6 +268,13 @@ public:
|
||||
*aState2 = static_cast<uint32_t>(aState64 >> 31);
|
||||
}
|
||||
|
||||
static uint32_t To32States(uint64_t aState, bool* aIsExtra)
|
||||
{
|
||||
uint32_t extraState = aState >> 31;
|
||||
*aIsExtra = !!extraState;
|
||||
return aState | extraState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given accessible can't have children. Used when exposing
|
||||
* to platform accessibility APIs, should the children be pruned off?
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "AccGroupInfo.h"
|
||||
#include "AccIterator.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsAccessibleRelation.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
@ -1161,8 +1160,7 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEvent);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsService =
|
||||
mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
|
||||
NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> observers;
|
||||
@ -1174,8 +1172,8 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
|
||||
bool hasObservers = false;
|
||||
observers->HasMoreElements(&hasObservers);
|
||||
if (hasObservers) {
|
||||
nsRefPtr<nsAccEvent> evnt(aEvent->CreateXPCOMObject());
|
||||
return obsService->NotifyObservers(evnt, NS_ACCESSIBLE_EVENT_TOPIC, nullptr);
|
||||
nsCOMPtr<nsIAccessibleEvent> event = MakeXPCEvent(aEvent);
|
||||
return obsService->NotifyObservers(event, NS_ACCESSIBLE_EVENT_TOPIC, nullptr);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -125,11 +125,11 @@ this.EventManager = {
|
||||
{
|
||||
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
|
||||
if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED &&
|
||||
!(event.isExtraState())) {
|
||||
!(event.isExtraState)) {
|
||||
this.present(
|
||||
Presentation.
|
||||
actionInvoked(aEvent.accessible,
|
||||
event.isEnabled() ? 'check' : 'uncheck'));
|
||||
event.isEnabled ? 'check' : 'uncheck'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ this.Logger = {
|
||||
let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType);
|
||||
if (aEvent.eventType == Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE) {
|
||||
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
|
||||
let stateStrings = (event.isExtraState()) ?
|
||||
let stateStrings = event.isExtraState ?
|
||||
Utils.AccRetrieval.getStringStates(0, event.state) :
|
||||
Utils.AccRetrieval.getStringStates(event.state, 0);
|
||||
str += ' (' + stateStrings.item(0) + ')';
|
||||
|
240
accessible/src/xpcom/AccEventGen.py
Executable file
240
accessible/src/xpcom/AccEventGen.py
Executable file
@ -0,0 +1,240 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
import sys, os, xpidl, makeutils
|
||||
|
||||
def findIDL(includePath, interfaceFileName):
|
||||
for d in includePath:
|
||||
# Not os.path.join: we need a forward slash even on Windows because
|
||||
# this filename ends up in makedepend output.
|
||||
path = d + '/' + interfaceFileName
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
raise BaseException("No IDL file found for interface %s "
|
||||
"in include path %r"
|
||||
% (interfaceFileName, includePath))
|
||||
|
||||
def loadEventIDL(parser, includePath, eventname):
|
||||
eventidl = ("nsIAccessible%s.idl" % eventname)
|
||||
idlFile = findIDL(includePath, eventidl)
|
||||
if not idlFile in makeutils.dependencies:
|
||||
makeutils.dependencies.append(idlFile)
|
||||
idl = p.parse(open(idlFile).read(), idlFile)
|
||||
idl.resolve(includePath, p)
|
||||
return idl
|
||||
|
||||
class Configuration:
|
||||
def __init__(self, filename):
|
||||
config = {}
|
||||
execfile(filename, config)
|
||||
self.simple_events = config.get('simple_events', [])
|
||||
|
||||
def readConfigFile(filename):
|
||||
return Configuration(filename)
|
||||
|
||||
def firstCap(str):
|
||||
return str[0].upper() + str[1:]
|
||||
|
||||
def writeAttributeParams(a):
|
||||
return ("%s a%s" % (a.realtype.nativeType('in'), firstCap(a.name)))
|
||||
|
||||
def print_header_file(fd, conf):
|
||||
fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n")
|
||||
fd.write("#ifndef _mozilla_a11y_generated_AccEvents_h_\n"
|
||||
"#define _mozilla_a11y_generated_AccEvents_h_\n\n")
|
||||
fd.write("#include \"nscore.h\"\n")
|
||||
fd.write("#include \"nsCOMPtr.h\"\n")
|
||||
fd.write("#include \"nsCycleCollectionParticipant.h\"\n")
|
||||
fd.write("#include \"nsString.h\"\n")
|
||||
for e in conf.simple_events:
|
||||
fd.write("#include \"nsIAccessible%s.h\"\n" % e)
|
||||
for e in conf.simple_events:
|
||||
idl = loadEventIDL(p, options.incdirs, e)
|
||||
for iface in filter(lambda p: p.kind == "interface", idl.productions):
|
||||
classname = ("xpcAcc%s" % e)
|
||||
baseinterfaces = interfaces(iface)
|
||||
|
||||
fd.write("\nclass %s MOZ_FINAL : public %s\n" % (classname, iface.name))
|
||||
fd.write("{\n")
|
||||
fd.write("public:\n")
|
||||
|
||||
attributes = allAttributes(iface)
|
||||
args = map(writeAttributeParams, attributes)
|
||||
fd.write(" %s(%s) :\n" % (classname, ", ".join(args)))
|
||||
|
||||
initializers = []
|
||||
for a in attributes:
|
||||
initializers.append("m%s(a%s)" % (firstCap(a.name), firstCap(a.name)))
|
||||
fd.write(" %s\n {}\n" % ", ".join(initializers))
|
||||
fd.write(" ~%s() {}\n\n" % classname)
|
||||
fd.write(" NS_DECL_CYCLE_COLLECTING_ISUPPORTS\n")
|
||||
fd.write(" NS_DECL_CYCLE_COLLECTION_CLASS(%s)\n" % (classname))
|
||||
|
||||
for iface in filter(lambda i: i.name != "nsISupports", baseinterfaces):
|
||||
fd.write(" NS_DECL_%s\n" % iface.name.upper())
|
||||
|
||||
fd.write("private:\n")
|
||||
for a in attributes:
|
||||
fd.write(" %s\n" % attributeVariableTypeAndName(a))
|
||||
fd.write("};\n\n")
|
||||
|
||||
fd.write("#endif\n")
|
||||
|
||||
def interfaceAttributeTypes(idl):
|
||||
ifaces = filter(lambda p: p.kind == "interface", idl.productions)
|
||||
attributes = []
|
||||
for i in ifaces:
|
||||
ifaceAttributes = allAttributes(i)
|
||||
attributes.extend(ifaceAttributes)
|
||||
ifaceAttrs = filter(lambda a: a.realtype.nativeType("in").endswith("*"), attributes)
|
||||
return map(lambda a: a.realtype.nativeType("in").strip(" *"), ifaceAttrs)
|
||||
|
||||
def print_cpp(idl, fd, conf, eventname):
|
||||
for p in idl.productions:
|
||||
if p.kind == 'interface':
|
||||
write_cpp(eventname, p, fd)
|
||||
|
||||
def print_cpp_file(fd, conf):
|
||||
fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n")
|
||||
fd.write('#include "xpcAccEvents.h"\n')
|
||||
|
||||
includes = []
|
||||
for e in conf.simple_events:
|
||||
if not e in includes:
|
||||
includes.append(("nsIAccessible%s" % e))
|
||||
|
||||
types = []
|
||||
for e in conf.simple_events:
|
||||
idl = loadEventIDL(p, options.incdirs, e)
|
||||
types.extend(interfaceAttributeTypes(idl))
|
||||
|
||||
for c in types:
|
||||
fd.write("#include \"%s.h\"\n" % c)
|
||||
|
||||
fd.write("\n")
|
||||
for e in conf.simple_events:
|
||||
print_cpp(loadEventIDL(p, options.incdirs, e), fd, conf, e)
|
||||
|
||||
def attributeVariableTypeAndName(a):
|
||||
if a.realtype.nativeType('in').endswith('*'):
|
||||
l = ["nsCOMPtr<%s> m%s;" % (a.realtype.nativeType('in').strip('* '),
|
||||
firstCap(a.name))]
|
||||
elif a.realtype.nativeType('in').count("nsAString"):
|
||||
l = ["nsString m%s;" % firstCap(a.name)]
|
||||
elif a.realtype.nativeType('in').count("nsACString"):
|
||||
l = ["nsCString m%s;" % firstCap(a.name)]
|
||||
else:
|
||||
l = ["%sm%s;" % (a.realtype.nativeType('in'),
|
||||
firstCap(a.name))]
|
||||
return ", ".join(l)
|
||||
|
||||
def writeAttributeGetter(fd, classname, a):
|
||||
fd.write("NS_IMETHODIMP\n")
|
||||
fd.write("%s::Get%s(" % (classname, firstCap(a.name)))
|
||||
if a.realtype.nativeType('in').endswith('*'):
|
||||
fd.write("%s** a%s" % (a.realtype.nativeType('in').strip('* '), firstCap(a.name)))
|
||||
elif a.realtype.nativeType('in').count("nsAString"):
|
||||
fd.write("nsAString& a%s" % firstCap(a.name))
|
||||
elif a.realtype.nativeType('in').count("nsACString"):
|
||||
fd.write("nsACString& a%s" % firstCap(a.name))
|
||||
else:
|
||||
fd.write("%s*a%s" % (a.realtype.nativeType('in'), firstCap(a.name)))
|
||||
fd.write(")\n");
|
||||
fd.write("{\n");
|
||||
if a.realtype.nativeType('in').endswith('*'):
|
||||
fd.write(" NS_IF_ADDREF(*a%s = m%s);\n" % (firstCap(a.name), firstCap(a.name)))
|
||||
elif a.realtype.nativeType('in').count("nsAString"):
|
||||
fd.write(" a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
|
||||
elif a.realtype.nativeType('in').count("nsACString"):
|
||||
fd.write(" a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
|
||||
else:
|
||||
fd.write(" *a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
|
||||
fd.write(" return NS_OK;\n");
|
||||
fd.write("}\n\n");
|
||||
|
||||
def interfaces(iface):
|
||||
interfaces = []
|
||||
while iface.base:
|
||||
interfaces.append(iface)
|
||||
iface = iface.idl.getName(iface.base, iface.location)
|
||||
interfaces.append(iface)
|
||||
interfaces.reverse()
|
||||
return interfaces
|
||||
|
||||
def allAttributes(iface):
|
||||
attributes = []
|
||||
for i in interfaces(iface):
|
||||
attrs = filter(lambda m: isinstance(m, xpidl.Attribute), i.members)
|
||||
attributes.extend(attrs)
|
||||
|
||||
return attributes
|
||||
|
||||
def write_cpp(eventname, iface, fd):
|
||||
classname = "xpcAcc%s" % eventname
|
||||
attributes = allAttributes(iface)
|
||||
ccattributes = filter(lambda m: m.realtype.nativeType('in').endswith('*'), attributes)
|
||||
fd.write("NS_IMPL_CYCLE_COLLECTION_%u(%s" % (len(ccattributes), classname))
|
||||
for c in ccattributes:
|
||||
fd.write(", m%s" % firstCap(c.name))
|
||||
fd.write(")\n\n");
|
||||
|
||||
fd.write("NS_IMPL_CYCLE_COLLECTING_ADDREF(%s)\n" % classname)
|
||||
fd.write("NS_IMPL_CYCLE_COLLECTING_RELEASE(%s)\n\n" % classname)
|
||||
|
||||
fd.write("NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(%s)\n" % classname)
|
||||
for baseiface in interfaces(iface):
|
||||
fd.write(" NS_INTERFACE_MAP_ENTRY(%s)\n" % baseiface.name)
|
||||
fd.write("NS_INTERFACE_MAP_END\n\n")
|
||||
|
||||
for a in attributes:
|
||||
writeAttributeGetter(fd, classname, a)
|
||||
|
||||
|
||||
def main():
|
||||
from optparse import OptionParser
|
||||
o = OptionParser(usage="usage: %prog [options] configfile")
|
||||
o.add_option('-I', action='append', dest='incdirs', default=['.'],
|
||||
help="Directory to search for imported files")
|
||||
o.add_option('-o', "--stub-output",
|
||||
type='string', dest='stub_output', default=None,
|
||||
help="C++ source output file", metavar="FILE")
|
||||
o.add_option('--header-output', type='string', default=None,
|
||||
help="Quick stub header output file", metavar="FILE")
|
||||
o.add_option('--makedepend-output', type='string', default=None,
|
||||
help="gnumake dependencies output file", metavar="FILE")
|
||||
o.add_option('--cachedir', dest='cachedir', default=None,
|
||||
help="Directory in which to cache lex/parse tables.")
|
||||
global options
|
||||
(options, filenames) = o.parse_args()
|
||||
if len(filenames) != 1:
|
||||
o.error("Exactly one config filename is needed.")
|
||||
filename = filenames[0]
|
||||
|
||||
if options.cachedir is not None:
|
||||
if not os.path.isdir(options.cachedir):
|
||||
os.mkdir(options.cachedir)
|
||||
sys.path.append(options.cachedir)
|
||||
|
||||
# Instantiate the parser.
|
||||
global p
|
||||
p = xpidl.IDLParser(outputdir=options.cachedir)
|
||||
|
||||
conf = readConfigFile(filename)
|
||||
|
||||
if options.stub_output is not None:
|
||||
makeutils.targets.append(options.stub_output)
|
||||
outfd = open(options.stub_output, 'w')
|
||||
print_cpp_file(outfd, conf)
|
||||
outfd.close()
|
||||
if options.makedepend_output is not None:
|
||||
makeutils.writeMakeDependOutput(options.makedepend_output)
|
||||
if options.header_output is not None:
|
||||
outfd = open(options.header_output, 'w')
|
||||
print_header_file(outfd, conf)
|
||||
outfd.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
17
accessible/src/xpcom/AccEvents.conf
Normal file
17
accessible/src/xpcom/AccEvents.conf
Normal file
@ -0,0 +1,17 @@
|
||||
""" -*- Mode: Python -*-
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
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/.
|
||||
|
||||
The name of the event which real interface should have nsIAccessible-prefix,
|
||||
and should be in nsIAccessible<name>.idl file"""
|
||||
|
||||
simple_events = [
|
||||
'Event',
|
||||
'StateChangeEvent',
|
||||
'TextChangeEvent',
|
||||
'HideEvent',
|
||||
'CaretMoveEvent',
|
||||
'TableChangeEvent',
|
||||
'VirtualCursorChangeEvent'
|
||||
]
|
@ -14,8 +14,10 @@ MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_xpcom_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
EXPORTS := xpcAccEvents.h
|
||||
|
||||
CPPSRCS = \
|
||||
nsAccEvent.cpp \
|
||||
xpcAccEvents.cpp \
|
||||
nsAccessibleRelation.cpp \
|
||||
xpcAccessibleTable.cpp \
|
||||
xpcAccessibleTableCell.cpp \
|
||||
@ -24,6 +26,8 @@ CPPSRCS = \
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
EXTRA_MDDEPEND_FILES = xpcAccEvents.pp
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
@ -56,3 +60,34 @@ endif
|
||||
ifneq ($(A11Y_LOG),0)
|
||||
DEFINES += -DA11Y_LOG
|
||||
endif
|
||||
|
||||
xpcAccEvents.h: $(srcdir)/AccEvents.conf \
|
||||
$(srcdir)/AccEventGen.py \
|
||||
$(LIBXUL_DIST)/sdk/bin/header.py \
|
||||
$(LIBXUL_DIST)/sdk/bin/xpidl.py \
|
||||
$(DEPTH)/js/src/js-confdefs.h
|
||||
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
|
||||
-I$(LIBXUL_DIST)/sdk/bin \
|
||||
$(srcdir)/AccEventGen.py \
|
||||
-I $(DEPTH)/dist/idl \
|
||||
--header-output xpcAccEvents.h \
|
||||
$(srcdir)/AccEvents.conf
|
||||
|
||||
xpcAccEvents.cpp: $(srcdir)/AccEvents.conf \
|
||||
$(srcdir)/AccEventGen.py \
|
||||
$(LIBXUL_DIST)/sdk/bin/header.py \
|
||||
$(LIBXUL_DIST)/sdk/bin/xpidl.py \
|
||||
$(DEPTH)/js/src/js-confdefs.h
|
||||
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
|
||||
-I$(LIBXUL_DIST)/sdk/bin \
|
||||
$(srcdir)/AccEventGen.py \
|
||||
-I $(DEPTH)/dist/idl \
|
||||
--header-output xpcAccEvents.h \
|
||||
--stub-output xpcAccEvents.cpp \
|
||||
--makedepend-output $(MDDEPDIR)/xpcAccEvents.pp \
|
||||
$(srcdir)/AccEvents.conf
|
||||
|
||||
GARBAGE += \
|
||||
xpcAccEvents.cpp \
|
||||
xpcAccEvents.h \
|
||||
$(null)
|
||||
|
@ -1,270 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 "nsAccEvent.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "DocAccessible.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetIsFromUserInput(bool* aIsFromUserInput)
|
||||
{
|
||||
*aIsFromUserInput = mEvent->IsFromUserInput();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetEventType(uint32_t* aEventType)
|
||||
{
|
||||
*aEventType = mEvent->GetEventType();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetAccessible(nsIAccessible** aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nullptr;
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = mEvent->GetAccessible());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
*aDOMNode = nullptr;
|
||||
|
||||
nsINode* node = mEvent->GetAccessible()->GetNode();
|
||||
if (node)
|
||||
CallQueryInterface(node, aDOMNode);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument** aDocAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocAccessible);
|
||||
|
||||
NS_IF_ADDREF(*aDocAccessible = mEvent->GetDocAccessible());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccStateChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
|
||||
nsIAccessibleStateChangeEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::GetState(uint32_t* aState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
uint32_t state1 = 0, state2 = 0;
|
||||
uint64_t state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
|
||||
nsAccUtils::To32States(state, &state1, &state2);
|
||||
|
||||
*aState = state1 | state2; // only one state is not 0
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsExtraState(bool* aIsExtraState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsExtraState);
|
||||
|
||||
uint32_t state1 = 0, state2 = 0;
|
||||
uint64_t state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
|
||||
nsAccUtils::To32States(state, &state1, &state2);
|
||||
|
||||
*aIsExtraState = (state2 != 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsEnabled(bool* aIsEnabled)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsEnabled);
|
||||
*aIsEnabled = static_cast<AccStateChangeEvent*>(mEvent.get())->IsStateEnabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTextChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
|
||||
nsIAccessibleTextChangeEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetStart(int32_t* aStart)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStart);
|
||||
*aStart = static_cast<AccTextChangeEvent*>(mEvent.get())->GetStartOffset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetLength(uint32_t* aLength)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLength);
|
||||
*aLength = static_cast<AccTextChangeEvent*>(mEvent.get())->GetLength();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::IsInserted(bool* aIsInserted)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsInserted);
|
||||
*aIsInserted = static_cast<AccTextChangeEvent*>(mEvent.get())->IsTextInserted();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
|
||||
{
|
||||
static_cast<AccTextChangeEvent*>(mEvent.get())->GetModifiedText(aModifiedText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccHideEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccHideEvent, nsAccEvent,
|
||||
nsIAccessibleHideEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccHideEvent::GetTargetParent(nsIAccessible** aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
|
||||
NS_IF_ADDREF(*aAccessible =
|
||||
static_cast<AccHideEvent*>(mEvent.get())->TargetParent());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccHideEvent::GetTargetNextSibling(nsIAccessible** aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
|
||||
NS_IF_ADDREF(*aAccessible =
|
||||
static_cast<AccHideEvent*>(mEvent.get())->TargetNextSibling());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccHideEvent::GetTargetPrevSibling(nsIAccessible** aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
|
||||
NS_IF_ADDREF(*aAccessible =
|
||||
static_cast<AccHideEvent*>(mEvent.get())->TargetPrevSibling());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccCaretMoveEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
|
||||
nsIAccessibleCaretMoveEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccCaretMoveEvent::GetCaretOffset(int32_t *aCaretOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCaretOffset);
|
||||
|
||||
*aCaretOffset = static_cast<AccCaretMoveEvent*>(mEvent.get())->GetCaretOffset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTableChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
|
||||
nsIAccessibleTableChangeEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTableChangeEvent::GetRowOrColIndex(int32_t *aRowOrColIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowOrColIndex);
|
||||
|
||||
*aRowOrColIndex =
|
||||
static_cast<AccTableChangeEvent*>(mEvent.get())->GetIndex();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTableChangeEvent::GetNumRowsOrCols(int32_t* aNumRowsOrCols)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
|
||||
|
||||
*aNumRowsOrCols = static_cast<AccTableChangeEvent*>(mEvent.get())->GetCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccVirtualCursorChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccVirtualCursorChangeEvent, nsAccEvent,
|
||||
nsIAccessibleVirtualCursorChangeEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccVirtualCursorChangeEvent::GetOldAccessible(nsIAccessible** aOldAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOldAccessible);
|
||||
|
||||
*aOldAccessible =
|
||||
static_cast<AccVCChangeEvent*>(mEvent.get())->OldAccessible();
|
||||
NS_IF_ADDREF(*aOldAccessible);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccVirtualCursorChangeEvent::GetOldStartOffset(int32_t* aOldStartOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOldStartOffset);
|
||||
|
||||
*aOldStartOffset =
|
||||
static_cast<AccVCChangeEvent*>(mEvent.get())->OldStartOffset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccVirtualCursorChangeEvent::GetOldEndOffset(int32_t* aOldEndOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOldEndOffset);
|
||||
|
||||
*aOldEndOffset =
|
||||
static_cast<AccVCChangeEvent*>(mEvent.get())->OldEndOffset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccVirtualCursorChangeEvent::GetReason(int16_t* aReason)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReason);
|
||||
|
||||
*aReason = static_cast<AccVCChangeEvent*>(mEvent.get())->Reason();
|
||||
return NS_OK;
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 _nsAccEvent_H_
|
||||
#define _nsAccEvent_H_
|
||||
|
||||
#include "nsIAccessibleEvent.h"
|
||||
|
||||
#include "AccEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Generic accessible event.
|
||||
*/
|
||||
class nsAccEvent: public nsIAccessibleEvent
|
||||
{
|
||||
public:
|
||||
nsAccEvent(AccEvent* aEvent) : mEvent(aEvent) { }
|
||||
virtual ~nsAccEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLEEVENT
|
||||
|
||||
protected:
|
||||
nsRefPtr<AccEvent> mEvent;
|
||||
|
||||
private:
|
||||
nsAccEvent();
|
||||
nsAccEvent(const nsAccEvent&);
|
||||
nsAccEvent& operator =(const nsAccEvent&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible state change event.
|
||||
*/
|
||||
class nsAccStateChangeEvent: public nsAccEvent,
|
||||
public nsIAccessibleStateChangeEvent
|
||||
{
|
||||
public:
|
||||
nsAccStateChangeEvent(AccStateChangeEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccStateChangeEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
|
||||
|
||||
private:
|
||||
nsAccStateChangeEvent();
|
||||
nsAccStateChangeEvent(const nsAccStateChangeEvent&);
|
||||
nsAccStateChangeEvent& operator =(const nsAccStateChangeEvent&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible text change event.
|
||||
*/
|
||||
class nsAccTextChangeEvent: public nsAccEvent,
|
||||
public nsIAccessibleTextChangeEvent
|
||||
{
|
||||
public:
|
||||
nsAccTextChangeEvent(AccTextChangeEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccTextChangeEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
|
||||
|
||||
private:
|
||||
nsAccTextChangeEvent();
|
||||
nsAccTextChangeEvent(const nsAccTextChangeEvent&);
|
||||
nsAccTextChangeEvent& operator =(const nsAccTextChangeEvent&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible hide event.
|
||||
*/
|
||||
class nsAccHideEvent : public nsAccEvent,
|
||||
public nsIAccessibleHideEvent
|
||||
{
|
||||
public:
|
||||
nsAccHideEvent(AccHideEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccHideEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEHIDEEVENT
|
||||
|
||||
private:
|
||||
nsAccHideEvent() MOZ_DELETE;
|
||||
nsAccHideEvent(const nsAccHideEvent&) MOZ_DELETE;
|
||||
nsAccHideEvent& operator =(const nsAccHideEvent&) MOZ_DELETE;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible caret move event.
|
||||
*/
|
||||
class nsAccCaretMoveEvent: public nsAccEvent,
|
||||
public nsIAccessibleCaretMoveEvent
|
||||
{
|
||||
public:
|
||||
nsAccCaretMoveEvent(AccCaretMoveEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccCaretMoveEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLECARETMOVEEVENT
|
||||
|
||||
private:
|
||||
nsAccCaretMoveEvent();
|
||||
nsAccCaretMoveEvent(const nsAccCaretMoveEvent&);
|
||||
nsAccCaretMoveEvent& operator =(const nsAccCaretMoveEvent&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible table change event.
|
||||
*/
|
||||
class nsAccTableChangeEvent : public nsAccEvent,
|
||||
public nsIAccessibleTableChangeEvent
|
||||
{
|
||||
public:
|
||||
nsAccTableChangeEvent(AccTableChangeEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccTableChangeEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
|
||||
|
||||
private:
|
||||
nsAccTableChangeEvent();
|
||||
nsAccTableChangeEvent(const nsAccTableChangeEvent&);
|
||||
nsAccTableChangeEvent& operator =(const nsAccTableChangeEvent&);
|
||||
};
|
||||
|
||||
/**
|
||||
* Accessible virtual cursor change event.
|
||||
*/
|
||||
class nsAccVirtualCursorChangeEvent : public nsAccEvent,
|
||||
public nsIAccessibleVirtualCursorChangeEvent
|
||||
{
|
||||
public:
|
||||
nsAccVirtualCursorChangeEvent(AccVCChangeEvent* aEvent) :
|
||||
nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccVirtualCursorChangeEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEVIRTUALCURSORCHANGEEVENT
|
||||
|
||||
private:
|
||||
nsAccVirtualCursorChangeEvent() MOZ_DELETE;
|
||||
nsAccVirtualCursorChangeEvent(const nsAccVirtualCursorChangeEvent&) MOZ_DELETE;
|
||||
nsAccVirtualCursorChangeEvent& operator =(const nsAccVirtualCursorChangeEvent&) MOZ_DELETE;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -1565,7 +1565,7 @@ function textChangeChecker(aID, aStart, aEnd, aTextOrFunc, aIsInserted, aFromUse
|
||||
"Wrong start offset for " + prettyName(aID));
|
||||
is(aEvent.length, modifiedTextLen, "Wrong length for " + prettyName(aID));
|
||||
var changeInfo = (aIsInserted ? "inserted" : "removed");
|
||||
is(aEvent.isInserted(), aIsInserted,
|
||||
is(aEvent.isInserted, aIsInserted,
|
||||
"Text was " + changeInfo + " for " + prettyName(aID));
|
||||
is(aEvent.modifiedText, modifiedText,
|
||||
"Wrong " + changeInfo + " text for " + prettyName(aID));
|
||||
@ -1613,11 +1613,11 @@ function stateChangeChecker(aState, aIsExtraState, aIsEnabled,
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
is(event.isExtraState(), aIsExtraState,
|
||||
is(event.isExtraState, aIsExtraState,
|
||||
"Wrong extra state bit of the statechange event.");
|
||||
isState(event.state, aState, aIsExtraState,
|
||||
"Wrong state of the statechange event.");
|
||||
is(event.isEnabled(), aIsEnabled,
|
||||
is(event.isEnabled, aIsEnabled,
|
||||
"Wrong state of statechange event state");
|
||||
|
||||
if (aSkipCurrentStateCheck) {
|
||||
@ -1670,9 +1670,9 @@ function expandedStateChecker(aIsEnabled, aTargetOrFunc, aTargetFuncArg)
|
||||
return;
|
||||
|
||||
is(event.state, STATE_EXPANDED, "Wrong state of the statechange event.");
|
||||
is(event.isExtraState(), false,
|
||||
is(event.isExtraState, false,
|
||||
"Wrong extra state bit of the statechange event.");
|
||||
is(event.isEnabled(), aIsEnabled,
|
||||
is(event.isEnabled, aIsEnabled,
|
||||
"Wrong state of statechange event state");
|
||||
|
||||
testStates(event.accessible,
|
||||
@ -1730,7 +1730,7 @@ var gA11yEventObserver =
|
||||
|
||||
if (event instanceof nsIAccessibleTextChangeEvent) {
|
||||
info += ", start: " + event.start + ", length: " + event.length +
|
||||
", " + (event.isInserted() ? "inserted" : "removed") +
|
||||
", " + (event.isInserted ? "inserted" : "removed") +
|
||||
" text: " + event.modifiedText;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
return;
|
||||
|
||||
is(event.state, STATE_BUSY, "Wrong state of statechange event.");
|
||||
is(event.isEnabled(), aIsEnabled,
|
||||
is(event.isEnabled, aIsEnabled,
|
||||
"Wrong value of state of statechange event");
|
||||
|
||||
testStates(event.accessible, (aIsEnabled ? STATE_BUSY : 0), 0,
|
||||
|
@ -44,9 +44,9 @@
|
||||
|
||||
if (!event) { return; }
|
||||
|
||||
ok(event.isExtraState(), "Extra state change was expected");
|
||||
ok(event.isExtraState, "Extra state change was expected");
|
||||
is(event.state, EXT_STATE_EDITABLE, "Wrong state of statechange event");
|
||||
ok(event.isEnabled(), "Expected editable state to be enabled");
|
||||
ok(event.isEnabled, "Expected editable state to be enabled");
|
||||
}
|
||||
|
||||
this.getID = function editabledoc_getID() {
|
||||
|
Loading…
Reference in New Issue
Block a user