From 9eef2078ade0447e8ef630844e48fb5588c49567 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Wed, 14 Oct 2015 16:36:52 -0400 Subject: [PATCH] bug 1214864 - make SetCarretOffset() async r=davidb It calls TakeFocus() which needs to be async to avoid deadlocks, so it needs to be async as well. --- accessible/atk/nsMaiInterfaceText.cpp | 5 ++--- accessible/ipc/DocAccessibleChild.cpp | 5 +---- accessible/ipc/DocAccessibleChild.h | 4 ++-- accessible/ipc/PDocAccessible.ipdl | 2 +- accessible/ipc/ProxyAccessible.cpp | 6 ++---- accessible/ipc/ProxyAccessible.h | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/accessible/atk/nsMaiInterfaceText.cpp b/accessible/atk/nsMaiInterfaceText.cpp index 6e421d27bd8..0386ef8343f 100644 --- a/accessible/atk/nsMaiInterfaceText.cpp +++ b/accessible/atk/nsMaiInterfaceText.cpp @@ -586,9 +586,8 @@ setCaretOffsetCB(AtkText *aText, gint aOffset) } if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) { - if (proxy->SetCaretOffset(aOffset)) { - return TRUE; - } + proxy->SetCaretOffset(aOffset); + return TRUE; } return FALSE; diff --git a/accessible/ipc/DocAccessibleChild.cpp b/accessible/ipc/DocAccessibleChild.cpp index 9ae1b5e6d5e..813fd16e783 100644 --- a/accessible/ipc/DocAccessibleChild.cpp +++ b/accessible/ipc/DocAccessibleChild.cpp @@ -390,13 +390,10 @@ DocAccessibleChild::RecvCaretOffset(const uint64_t& aID, int32_t* aOffset) bool DocAccessibleChild::RecvSetCaretOffset(const uint64_t& aID, - const int32_t& aOffset, - bool* aRetVal) + const int32_t& aOffset) { HyperTextAccessible* acc = IdToHyperTextAccessible(aID); - *aRetVal = false; if (acc && acc->IsTextRole() && acc->IsValidOffset(aOffset)) { - *aRetVal = true; acc->SetCaretOffset(aOffset); } return true; diff --git a/accessible/ipc/DocAccessibleChild.h b/accessible/ipc/DocAccessibleChild.h index 6fbb5c84479..0ac72e9fdd1 100644 --- a/accessible/ipc/DocAccessibleChild.h +++ b/accessible/ipc/DocAccessibleChild.h @@ -103,8 +103,8 @@ public: override; virtual bool RecvCaretOffset(const uint64_t& aID, int32_t* aOffset) override; - virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset, - bool* aValid) override; + virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset) + override; virtual bool RecvCharacterCount(const uint64_t& aID, int32_t* aCount) override; diff --git a/accessible/ipc/PDocAccessible.ipdl b/accessible/ipc/PDocAccessible.ipdl index 182cbc26f7a..d29b56f36bd 100644 --- a/accessible/ipc/PDocAccessible.ipdl +++ b/accessible/ipc/PDocAccessible.ipdl @@ -92,7 +92,7 @@ child: // TextSubstring is getText in IDL. prio(high) sync CaretLineNumber(uint64_t aID) returns(int32_t aLineNumber); prio(high) sync CaretOffset(uint64_t aID) returns(int32_t aOffset); - prio(high) sync SetCaretOffset(uint64_t aID, int32_t aOffset) returns (bool aValid); + async SetCaretOffset(uint64_t aID, int32_t aOffset); prio(high) sync CharacterCount(uint64_t aID) returns(int32_t aCount); prio(high) sync SelectionCount(uint64_t aID) returns(int32_t aCount); prio(high) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t diff --git a/accessible/ipc/ProxyAccessible.cpp b/accessible/ipc/ProxyAccessible.cpp index d4db727243b..5654a87cf7a 100644 --- a/accessible/ipc/ProxyAccessible.cpp +++ b/accessible/ipc/ProxyAccessible.cpp @@ -216,12 +216,10 @@ ProxyAccessible::CaretOffset() return offset; } -bool +void ProxyAccessible::SetCaretOffset(int32_t aOffset) { - bool valid = false; - unused << mDoc->SendSetCaretOffset(mID, aOffset, &valid); - return valid; + unused << mDoc->SendSetCaretOffset(mID, aOffset); } int32_t diff --git a/accessible/ipc/ProxyAccessible.h b/accessible/ipc/ProxyAccessible.h index b6176973c99..d1ecf209e23 100644 --- a/accessible/ipc/ProxyAccessible.h +++ b/accessible/ipc/ProxyAccessible.h @@ -132,7 +132,7 @@ public: int32_t CaretLineNumber(); int32_t CaretOffset(); - bool SetCaretOffset(int32_t aOffset); + void SetCaretOffset(int32_t aOffset); int32_t CharacterCount(); int32_t SelectionCount();