Bug 1132485 - IPC proxy for GetText*Offset, r=tbsaunde

--HG--
extra : rebase_source : d9f62f17d6c487234aac3645d830fa55318d64b6
This commit is contained in:
Olli Pettay 2015-02-12 22:56:13 +02:00
parent 39bceaf68b
commit a4b808c419
5 changed files with 128 additions and 0 deletions

View File

@ -170,5 +170,60 @@ DocAccessibleChild::RecvTextSubstring(const uint64_t& aID,
acc->TextSubstring(aStartOffset, aEndOffset, *aText); acc->TextSubstring(aStartOffset, aEndOffset, *aText);
return true; return true;
} }
bool
DocAccessibleChild::RecvGetTextAfterOffset(const uint64_t& aID,
const int32_t& aOffset,
const AccessibleTextBoundary& aBoundaryType,
nsString* aText,
int32_t* aStartOffset,
int32_t* aEndOffset)
{
*aStartOffset = 0;
*aEndOffset = 0;
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc) {
acc->TextAfterOffset(aOffset, aBoundaryType,
aStartOffset, aEndOffset, *aText);
}
return true;
}
bool
DocAccessibleChild::RecvGetTextAtOffset(const uint64_t& aID,
const int32_t& aOffset,
const AccessibleTextBoundary& aBoundaryType,
nsString* aText,
int32_t* aStartOffset,
int32_t* aEndOffset)
{
*aStartOffset = 0;
*aEndOffset = 0;
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc) {
acc->TextAtOffset(aOffset, aBoundaryType,
aStartOffset, aEndOffset, *aText);
}
return true;
}
bool
DocAccessibleChild::RecvGetTextBeforeOffset(const uint64_t& aID,
const int32_t& aOffset,
const AccessibleTextBoundary& aBoundaryType,
nsString* aText,
int32_t* aStartOffset,
int32_t* aEndOffset)
{
*aStartOffset = 0;
*aEndOffset = 0;
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc) {
acc->TextBeforeOffset(aOffset, aBoundaryType,
aStartOffset, aEndOffset, *aText);
}
return true;
}
} }
} }

View File

@ -62,6 +62,22 @@ public:
const int32_t& aEndOffset, nsString* aText) const int32_t& aEndOffset, nsString* aText)
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual bool RecvGetTextAfterOffset(const uint64_t& aID,
const int32_t& aOffset,
const AccessibleTextBoundary& aBoundaryType,
nsString* aText, int32_t* aStartOffset,
int32_t* aEndOffset) MOZ_OVERRIDE;
virtual bool RecvGetTextAtOffset(const uint64_t& aID,
const int32_t& aOffset,
const AccessibleTextBoundary& aBoundaryType,
nsString* aText, int32_t* aStartOffset,
int32_t* aEndOffset) MOZ_OVERRIDE;
virtual bool RecvGetTextBeforeOffset(const uint64_t& aID,
const int32_t& aOffset,
const AccessibleTextBoundary& aBoundaryType,
nsString* aText, int32_t* aStartOffset,
int32_t* aEndOffset) MOZ_OVERRIDE;
private: private:
DocAccessible* mDoc; DocAccessible* mDoc;
}; };

View File

@ -6,6 +6,8 @@
include protocol PContent; include protocol PContent;
using AccessibleTextBoundary from "nsIAccessibleText.h";
namespace mozilla { namespace mozilla {
namespace a11y { namespace a11y {
@ -46,13 +48,24 @@ parent:
HideEvent(uint64_t aRootID); HideEvent(uint64_t aRootID);
child: child:
// Accessible
prio(high) sync State(uint64_t aID) returns(uint64_t states); prio(high) sync State(uint64_t aID) returns(uint64_t states);
prio(high) sync Name(uint64_t aID) returns(nsString name); prio(high) sync Name(uint64_t aID) returns(nsString name);
prio(high) sync Value(uint64_t aID) returns(nsString value); prio(high) sync Value(uint64_t aID) returns(nsString value);
prio(high) sync Description(uint64_t aID) returns(nsString desc); prio(high) sync Description(uint64_t aID) returns(nsString desc);
prio(high) sync Attributes(uint64_t aID) returns(Attribute[] attributes); prio(high) sync Attributes(uint64_t aID) returns(Attribute[] attributes);
// AccessibleText
// TextSubstring is getText in IDL.
prio(high) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t prio(high) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t
aEndOffset) returns(nsString aText); aEndOffset) returns(nsString aText);
prio(high) sync GetTextAfterOffset(uint64_t aID, int32_t aOffset, AccessibleTextBoundary aBoundaryType)
returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
prio(high) sync GetTextAtOffset(uint64_t aID, int32_t aOffset, AccessibleTextBoundary aBoundaryType)
returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
prio(high) sync GetTextBeforeOffset(uint64_t aID, int32_t aOffset, AccessibleTextBoundary aBoundaryType)
returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
}; };
} }

View File

@ -87,5 +87,36 @@ ProxyAccessible::TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
{ {
unused << mDoc->SendTextSubstring(mID, aStartOffset, aEndOfset, &aText); unused << mDoc->SendTextSubstring(mID, aStartOffset, aEndOfset, &aText);
} }
void
ProxyAccessible::GetTextAfterOffset(int32_t aOffset,
AccessibleTextBoundary aBoundaryType,
nsString& aText, int32_t* aStartOffset,
int32_t* aEndOffset)
{
unused << mDoc->SendGetTextAfterOffset(mID, aOffset, aBoundaryType,
&aText, aStartOffset, aEndOffset);
}
void
ProxyAccessible::GetTextAtOffset(int32_t aOffset,
AccessibleTextBoundary aBoundaryType,
nsString& aText, int32_t* aStartOffset,
int32_t* aEndOffset)
{
unused << mDoc->SendGetTextAtOffset(mID, aOffset, aBoundaryType,
&aText, aStartOffset, aEndOffset);
}
void
ProxyAccessible::GetTextBeforeOffset(int32_t aOffset,
AccessibleTextBoundary aBoundaryType,
nsString& aText, int32_t* aStartOffset,
int32_t* aEndOffset)
{
unused << mDoc->SendGetTextBeforeOffset(mID, aOffset, aBoundaryType,
&aText, aStartOffset, aEndOffset);
}
} }
} }

View File

@ -8,6 +8,7 @@
#define mozilla_a11y_ProxyAccessible_h #define mozilla_a11y_ProxyAccessible_h
#include "mozilla/a11y/Role.h" #include "mozilla/a11y/Role.h"
#include "nsIAccessibleText.h"
#include "nsString.h" #include "nsString.h"
#include "nsTArray.h" #include "nsTArray.h"
@ -90,6 +91,18 @@ public:
void TextSubstring(int32_t aStartOffset, int32_t aEndOfset, void TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
nsString& aText) const; nsString& aText) const;
void GetTextAfterOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
nsString& aText, int32_t* aStartOffset,
int32_t* aEndOffset);
void GetTextAtOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
nsString& aText, int32_t* aStartOffset,
int32_t* aEndOffset);
void GetTextBeforeOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
nsString& aText, int32_t* aStartOffset,
int32_t* aEndOffset);
/** /**
* Allow the platform to store a pointers worth of data on us. * Allow the platform to store a pointers worth of data on us.
*/ */