Bug 725644 - add new nsIAccessibleHideEvent interface, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-02-14 09:02:41 +09:00
Родитель c59ab7ad07
Коммит 6d52cb64b8
5 изменённых файлов: 92 добавлений и 0 удалений

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

@ -529,6 +529,25 @@ interface nsIAccessibleTextChangeEvent : nsISupports
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
{

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

@ -291,6 +291,14 @@ AccHideEvent::
mPrevSibling = mAccessible->PrevSibling();
}
already_AddRefed<nsAccEvent>
AccHideEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccHideEvent(this);
NS_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// AccShowEvent

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

@ -270,12 +270,19 @@ public:
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode);
// Event
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
static const EventGroup kEventGroup = eHideEvent;
virtual unsigned int GetEventGroups() const
{
return AccMutationEvent::GetEventGroups() | (1U << eHideEvent);
}
// AccHideEvent
nsAccessible* TargetParent() const { return mParent; }
nsAccessible* TargetNextSibling() const { return mNextSibling; }
nsAccessible* TargetPrevSibling() const { return mPrevSibling; }
protected:
nsRefPtr<nsAccessible> mParent;
nsRefPtr<nsAccessible> mNextSibling;

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

@ -173,6 +173,44 @@ nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
}
////////////////////////////////////////////////////////////////////////////////
// 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
////////////////////////////////////////////////////////////////////////////////

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

@ -105,6 +105,26 @@ private:
};
/**
* 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.
*/