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.
This commit is contained in:
Trevor Saunders 2015-10-14 16:36:52 -04:00
parent e1504edae4
commit 9eef2078ad
6 changed files with 9 additions and 15 deletions

View File

@ -586,9 +586,8 @@ setCaretOffsetCB(AtkText *aText, gint aOffset)
} }
if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) { if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
if (proxy->SetCaretOffset(aOffset)) { proxy->SetCaretOffset(aOffset);
return TRUE; return TRUE;
}
} }
return FALSE; return FALSE;

View File

@ -390,13 +390,10 @@ DocAccessibleChild::RecvCaretOffset(const uint64_t& aID, int32_t* aOffset)
bool bool
DocAccessibleChild::RecvSetCaretOffset(const uint64_t& aID, DocAccessibleChild::RecvSetCaretOffset(const uint64_t& aID,
const int32_t& aOffset, const int32_t& aOffset)
bool* aRetVal)
{ {
HyperTextAccessible* acc = IdToHyperTextAccessible(aID); HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
*aRetVal = false;
if (acc && acc->IsTextRole() && acc->IsValidOffset(aOffset)) { if (acc && acc->IsTextRole() && acc->IsValidOffset(aOffset)) {
*aRetVal = true;
acc->SetCaretOffset(aOffset); acc->SetCaretOffset(aOffset);
} }
return true; return true;

View File

@ -103,8 +103,8 @@ public:
override; override;
virtual bool RecvCaretOffset(const uint64_t& aID, int32_t* aOffset) virtual bool RecvCaretOffset(const uint64_t& aID, int32_t* aOffset)
override; override;
virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset, virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset)
bool* aValid) override; override;
virtual bool RecvCharacterCount(const uint64_t& aID, int32_t* aCount) virtual bool RecvCharacterCount(const uint64_t& aID, int32_t* aCount)
override; override;

View File

@ -92,7 +92,7 @@ child:
// TextSubstring is getText in IDL. // TextSubstring is getText in IDL.
prio(high) sync CaretLineNumber(uint64_t aID) returns(int32_t aLineNumber); 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 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 CharacterCount(uint64_t aID) returns(int32_t aCount);
prio(high) sync SelectionCount(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 prio(high) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t

View File

@ -216,12 +216,10 @@ ProxyAccessible::CaretOffset()
return offset; return offset;
} }
bool void
ProxyAccessible::SetCaretOffset(int32_t aOffset) ProxyAccessible::SetCaretOffset(int32_t aOffset)
{ {
bool valid = false; unused << mDoc->SendSetCaretOffset(mID, aOffset);
unused << mDoc->SendSetCaretOffset(mID, aOffset, &valid);
return valid;
} }
int32_t int32_t

View File

@ -132,7 +132,7 @@ public:
int32_t CaretLineNumber(); int32_t CaretLineNumber();
int32_t CaretOffset(); int32_t CaretOffset();
bool SetCaretOffset(int32_t aOffset); void SetCaretOffset(int32_t aOffset);
int32_t CharacterCount(); int32_t CharacterCount();
int32_t SelectionCount(); int32_t SelectionCount();