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

This commit is contained in:
Olli Pettay 2015-02-12 22:56:13 +02:00
parent 30409f22e0
commit da894507bc
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);
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)
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:
DocAccessible* mDoc;
};

View File

@ -6,6 +6,8 @@
include protocol PContent;
using AccessibleTextBoundary from "nsIAccessibleText.h";
namespace mozilla {
namespace a11y {
@ -46,13 +48,24 @@ parent:
HideEvent(uint64_t aRootID);
child:
// Accessible
prio(high) sync State(uint64_t aID) returns(uint64_t states);
prio(high) sync Name(uint64_t aID) returns(nsString name);
prio(high) sync Value(uint64_t aID) returns(nsString value);
prio(high) sync Description(uint64_t aID) returns(nsString desc);
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
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);
}
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
#include "mozilla/a11y/Role.h"
#include "nsIAccessibleText.h"
#include "nsString.h"
#include "nsTArray.h"
@ -90,6 +91,18 @@ public:
void TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
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.
*/