зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1140917 - IPC Proxy for replace/insert/copy/cut/delete/paste, r=tbsaunde
--HG-- extra : rebase_source : 172ad1db2dbe53a5b56640cdc3aed64e6db7570f
This commit is contained in:
Родитель
af6c91a100
Коммит
0004bf584d
|
@ -9,7 +9,7 @@
|
|||
#include "Accessible-inl.h"
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
#include "nsMai.h"
|
||||
|
||||
#include "ProxyAccessible.h"
|
||||
#include "nsString.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
|
@ -20,15 +20,18 @@ static void
|
|||
setTextContentsCB(AtkEditableText *aText, const gchar *aString)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return;
|
||||
if (accWrap) {
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
NS_ConvertUTF8toUTF16 strContent(aString);
|
||||
text->ReplaceText(strContent);
|
||||
NS_ConvertUTF8toUTF16 strContent(aString);
|
||||
text->ReplaceText(strContent);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
|
||||
NS_ConvertUTF8toUTF16 strContent(aString);
|
||||
proxy->ReplaceText(strContent);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -36,71 +39,82 @@ insertTextCB(AtkEditableText *aText,
|
|||
const gchar *aString, gint aLength, gint *aPosition)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return;
|
||||
if (accWrap) {
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
NS_ConvertUTF8toUTF16 strContent(aString, aLength);
|
||||
text->InsertText(strContent, *aPosition);
|
||||
NS_ConvertUTF8toUTF16 strContent(aString);
|
||||
text->InsertText(strContent, *aPosition);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
|
||||
NS_ConvertUTF8toUTF16 strContent(aString);
|
||||
proxy->InsertText(strContent, *aPosition);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return;
|
||||
if (accWrap) {
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
text->CopyText(aStartPos, aEndPos);
|
||||
text->CopyText(aStartPos, aEndPos);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
|
||||
proxy->CopyText(aStartPos, aEndPos);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return;
|
||||
if (accWrap) {
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
text->CutText(aStartPos, aEndPos);
|
||||
text->CutText(aStartPos, aEndPos);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
|
||||
proxy->CutText(aStartPos, aEndPos);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return;
|
||||
if (accWrap) {
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
text->DeleteText(aStartPos, aEndPos);
|
||||
text->DeleteText(aStartPos, aEndPos);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
|
||||
proxy->DeleteText(aStartPos, aEndPos);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pasteTextCB(AtkEditableText *aText, gint aPosition)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return;
|
||||
if (accWrap) {
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
text->PasteText(aPosition);
|
||||
text->PasteText(aPosition);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
|
||||
proxy->PasteText(aPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -508,5 +508,81 @@ DocAccessibleChild::RecvScrollSubstringToPoint(const uint64_t& aID,
|
|||
}
|
||||
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvReplaceText(const uint64_t& aID,
|
||||
const nsString& aText)
|
||||
{
|
||||
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
|
||||
if (acc && acc->IsTextRole()) {
|
||||
acc->ReplaceText(aText);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvInsertText(const uint64_t& aID,
|
||||
const nsString& aText,
|
||||
const int32_t& aPosition)
|
||||
{
|
||||
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
|
||||
if (acc && acc->IsTextRole()) {
|
||||
acc->InsertText(aText, aPosition);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvCopyText(const uint64_t& aID,
|
||||
const int32_t& aStartPos,
|
||||
const int32_t& aEndPos)
|
||||
{
|
||||
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
|
||||
if (acc && acc->IsTextRole()) {
|
||||
acc->CopyText(aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvCutText(const uint64_t& aID,
|
||||
const int32_t& aStartPos,
|
||||
const int32_t& aEndPos)
|
||||
{
|
||||
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
|
||||
if (acc && acc->IsTextRole()) {
|
||||
acc->CutText(aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvDeleteText(const uint64_t& aID,
|
||||
const int32_t& aStartPos,
|
||||
const int32_t& aEndPos)
|
||||
{
|
||||
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
|
||||
if (acc && acc->IsTextRole()) {
|
||||
acc->DeleteText(aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvPasteText(const uint64_t& aID,
|
||||
const int32_t& aPosition)
|
||||
{
|
||||
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
|
||||
if (acc && acc->IsTextRole()) {
|
||||
acc->PasteText(aPosition);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,6 +162,28 @@ public:
|
|||
const int32_t& aX,
|
||||
const int32_t& aY) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvReplaceText(const uint64_t& aID,
|
||||
const nsString& aText);
|
||||
|
||||
virtual bool RecvInsertText(const uint64_t& aID,
|
||||
const nsString& aText,
|
||||
const int32_t& aPosition);
|
||||
|
||||
virtual bool RecvCopyText(const uint64_t& aID,
|
||||
const int32_t& aStartPos,
|
||||
const int32_t& aEndPos);
|
||||
|
||||
virtual bool RecvCutText(const uint64_t& aID,
|
||||
const int32_t& aStartPos,
|
||||
const int32_t& aEndPos);
|
||||
|
||||
virtual bool RecvDeleteText(const uint64_t& aID,
|
||||
const int32_t& aStartPos,
|
||||
const int32_t& aEndPos);
|
||||
|
||||
virtual bool RecvPasteText(const uint64_t& aID,
|
||||
const int32_t& aPosition);
|
||||
|
||||
private:
|
||||
bool PersistentPropertiesToArray(nsIPersistentProperties* aProps,
|
||||
nsTArray<Attribute>* aAttributes);
|
||||
|
|
|
@ -114,6 +114,13 @@ child:
|
|||
int32_t aEndOffset,
|
||||
uint32_t aCoordinateType,
|
||||
int32_t aX, int32_t aY);
|
||||
|
||||
prio(high) sync ReplaceText(uint64_t aID, nsString aText);
|
||||
prio(high) sync InsertText(uint64_t aID, nsString aText, int32_t aPosition);
|
||||
prio(high) sync CopyText(uint64_t aID, int32_t aStartPos, int32_t aEndPos);
|
||||
prio(high) sync CutText(uint64_t aID, int32_t aStartPos, int32_t aEndPos);
|
||||
prio(high) sync DeleteText(uint64_t aID, int32_t aStartPos, int32_t aEndPos);
|
||||
prio(high) sync PasteText(uint64_t aID, int32_t aPosition);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -327,5 +327,41 @@ ProxyAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
|
|||
aCoordinateType, aX, aY);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::ReplaceText(const nsString& aText)
|
||||
{
|
||||
unused << mDoc->SendReplaceText(mID, aText);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::InsertText(const nsString& aText, int32_t aPosition)
|
||||
{
|
||||
unused << mDoc->SendInsertText(mID, aText, aPosition);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::CopyText(int32_t aStartPos, int32_t aEndPos)
|
||||
{
|
||||
unused << mDoc->SendCopyText(mID, aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::CutText(int32_t aStartPos, int32_t aEndPos)
|
||||
{
|
||||
unused << mDoc->SendCutText(mID, aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::DeleteText(int32_t aStartPos, int32_t aEndPos)
|
||||
{
|
||||
unused << mDoc->SendDeleteText(mID, aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::PasteText(int32_t aPosition)
|
||||
{
|
||||
unused << mDoc->SendPasteText(mID, aPosition);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,6 +162,18 @@ public:
|
|||
uint32_t aCoordinateType,
|
||||
int32_t aX, int32_t aY);
|
||||
|
||||
void ReplaceText(const nsString& aText);
|
||||
|
||||
void InsertText(const nsString& aText, int32_t aPosition);
|
||||
|
||||
void CopyText(int32_t aStartPos, int32_t aEndPos);
|
||||
|
||||
void CutText(int32_t aStartPos, int32_t aEndPos);
|
||||
|
||||
void DeleteText(int32_t aStartPos, int32_t aEndPos);
|
||||
|
||||
void PasteText(int32_t aPosition);
|
||||
|
||||
/**
|
||||
* Allow the platform to store a pointers worth of data on us.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче