diff --git a/accessible/atk/AccessibleWrap.cpp b/accessible/atk/AccessibleWrap.cpp index 237472d146a..6fe89f7f237 100644 --- a/accessible/atk/AccessibleWrap.cpp +++ b/accessible/atk/AccessibleWrap.cpp @@ -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] = { diff --git a/accessible/base/Platform.h b/accessible/base/Platform.h index 01d33a81a44..62c88b894c3 100644 --- a/accessible/base/Platform.h +++ b/accessible/base/Platform.h @@ -6,6 +6,8 @@ #include +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 diff --git a/accessible/generic/Accessible.cpp b/accessible/generic/Accessible.cpp index 2e48561d436..092f973c2ef 100644 --- a/accessible/generic/Accessible.cpp +++ b/accessible/generic/Accessible.cpp @@ -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()); } diff --git a/accessible/ipc/DocAccessibleParent.cpp b/accessible/ipc/DocAccessibleParent.cpp index 4f67b9e759e..eb4dd256509 100644 --- a/accessible/ipc/DocAccessibleParent.cpp +++ b/accessible/ipc/DocAccessibleParent.cpp @@ -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) { diff --git a/accessible/ipc/DocAccessibleParent.h b/accessible/ipc/DocAccessibleParent.h index 1a6b2c83e41..f0d2978fc30 100644 --- a/accessible/ipc/DocAccessibleParent.h +++ b/accessible/ipc/DocAccessibleParent.h @@ -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() { diff --git a/accessible/ipc/PDocAccessible.ipdl b/accessible/ipc/PDocAccessible.ipdl index 5df2e1c12e8..81c9033b168 100644 --- a/accessible/ipc/PDocAccessible.ipdl +++ b/accessible/ipc/PDocAccessible.ipdl @@ -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 diff --git a/accessible/mac/Platform.mm b/accessible/mac/Platform.mm index d726bfa7b23..6ed294ce1cb 100644 --- a/accessible/mac/Platform.mm +++ b/accessible/mac/Platform.mm @@ -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 diff --git a/accessible/other/Platform.cpp b/accessible/other/Platform.cpp index 5e09e1cea6a..78eceeaf6e8 100644 --- a/accessible/other/Platform.cpp +++ b/accessible/other/Platform.cpp @@ -43,3 +43,9 @@ void a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) { } + +void +a11y::ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t, + bool, bool) +{ +} diff --git a/accessible/windows/msaa/Platform.cpp b/accessible/windows/msaa/Platform.cpp index 40c73651413..b2b0aa54558 100644 --- a/accessible/windows/msaa/Platform.cpp +++ b/accessible/windows/msaa/Platform.cpp @@ -68,3 +68,9 @@ void a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) { } + +void +a11y::ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t, + bool, bool) +{ +}