bug 1172523 - fire useful text change events for proxies r=lsocks

This commit is contained in:
Trevor Saunders 2015-06-05 15:43:30 -04:00
parent 27dc768d13
commit 077c66681a
9 changed files with 65 additions and 0 deletions

View File

@ -1462,6 +1462,15 @@ MaiAtkObject::FireStateChangeEvent(uint64_t aState, bool aEnabled)
}
}
void
a11y::ProxyTextChangeEvent(ProxyAccessible* aTarget, const nsString& aStr,
int32_t aStart, uint32_t aLen, bool aIsInsert,
bool aFromUser)
{
MaiAtkObject* atkObj = MAI_ATK_OBJECT(GetWrapperFor(aTarget));
atkObj->FireTextChangeEvent(aStr, aStart, aLen, aIsInsert, aFromUser);
}
#define OLD_TEXT_INSERTED "text_changed::insert"
#define OLD_TEXT_REMOVED "text_changed::delete"
static const char* oldTextChangeStrings[2][2] = {

View File

@ -6,6 +6,8 @@
#include <stdint.h>
class nsString;
namespace mozilla {
namespace a11y {
@ -70,6 +72,9 @@ void ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType);
void ProxyStateChangeEvent(ProxyAccessible* aTarget, uint64_t aState,
bool aEnabled);
void ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset);
void ProxyTextChangeEvent(ProxyAccessible* aTarget, const nsString& aStr,
int32_t aStart, uint32_t aLen, bool aIsInsert,
bool aFromUser);
} // namespace a11y
} // namespace mozilla

View File

@ -865,6 +865,16 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
ipcDoc->SendEvent(id, event->GetCaretOffset());
break;
}
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
case nsIAccessibleEvent::EVENT_TEXT_REMOVED: {
AccTextChangeEvent* event = downcast_accEvent(aEvent);
ipcDoc->SendTextChangeEvent(id, event->ModifiedText(),
event->GetStartOffset(),
event->GetLength(),
event->IsTextInserted(),
event->IsFromUserInput());
break;
}
default:
ipcDoc->SendEvent(id, aEvent->GetEventType());
}

View File

@ -151,6 +151,23 @@ DocAccessibleParent::RecvCaretMoveEvent(const uint64_t& aID, const int32_t& aOff
return true;
}
bool
DocAccessibleParent::RecvTextChangeEvent(const uint64_t& aID,
const nsString& aStr,
const int32_t& aStart,
const uint32_t& aLen,
const bool& aIsInsert,
const bool& aFromUser)
{
ProxyAccessible* target = GetAccessible(aID);
if (!target)
return false;
ProxyTextChangeEvent(target, aStr, aStart, aLen, aIsInsert, aFromUser);
return true;
}
bool
DocAccessibleParent::RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uint64_t& aID)
{

View File

@ -51,6 +51,11 @@ public:
virtual bool RecvCaretMoveEvent(const uint64_t& aID, const int32_t& aOffset)
override final;
virtual bool RecvTextChangeEvent(const uint64_t& aID, const nsString& aStr,
const int32_t& aStart, const uint32_t& aLen,
const bool& aIsInsert,
const bool& aFromUser) override;
virtual bool RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uint64_t& aID) override;
void Unbind()
{

View File

@ -59,6 +59,8 @@ parent:
HideEvent(uint64_t aRootID);
StateChangeEvent(uint64_t aID, uint64_t aState, bool aEnabled);
CaretMoveEvent(uint64_t aID, int32_t aOffset);
TextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart, uint32_t aLen,
bool aIsInsert, bool aFromUser);
/*
* Tell the parent document to bind the existing document as a new child

View File

@ -83,6 +83,11 @@ ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
[wrapper selectedTextDidChange];
}
void
ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t,
bool, bool)
{
}
} // namespace a11y
} // namespace mozilla

View File

@ -43,3 +43,9 @@ void
a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
{
}
void
a11y::ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t,
bool, bool)
{
}

View File

@ -68,3 +68,9 @@ void
a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
{
}
void
a11y::ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t,
bool, bool)
{
}