Skip to content
Permalink
Browse files

Bug 1135908 - [E10s] Proxy for Character/SelectionCount(), r=tbsaunde

  • Loading branch information...
rmottola committed Aug 16, 2019
1 parent c120918 commit 9ba60b0f2dbb12612d55c5bd457f211a1901d475
@@ -330,12 +330,17 @@ static gint
getCharacterCountCB(AtkText *aText)
{
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return 0;
if (accWrap) {
HyperTextAccessible* textAcc = accWrap->AsHyperText();
return
textAcc->IsDefunct() ? 0 : static_cast<gint>(textAcc->CharacterCount());
}

HyperTextAccessible* textAcc = accWrap->AsHyperText();
return textAcc->IsDefunct() ?
0 : static_cast<gint>(textAcc->CharacterCount());
if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
return proxy->CharacterCount();
}

return 0;
}

static gint
@@ -362,14 +367,20 @@ static gint
getTextSelectionCountCB(AtkText *aText)
{
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return 0;
if (accWrap) {
HyperTextAccessible* text = accWrap->AsHyperText();
if (!text || !text->IsTextRole()) {
return 0;
}

HyperTextAccessible* text = accWrap->AsHyperText();
if (!text || !text->IsTextRole())
return 0;
return text->SelectionCount();
}

if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
return proxy->SelectionCount();
}

return text->SelectionCount();
return 0;
}

static gchar*
@@ -207,6 +207,22 @@ DocAccessibleChild::RecvRelations(const uint64_t& aID,
return true;
}

bool
DocAccessibleChild::RecvCharacterCount(const uint64_t& aID, int32_t* aCount)
{
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
*aCount = acc ? acc->CharacterCount() : 0;
return true;
}

bool
DocAccessibleChild::RecvSelectionCount(const uint64_t& aID, int32_t* aCount)
{
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
*aCount = acc ? acc->SelectionCount() : 0;
return true;
}

bool
DocAccessibleChild::RecvTextSubstring(const uint64_t& aID,
const int32_t& aStartOffset,
@@ -63,6 +63,12 @@ class DocAccessibleChild : public PDocAccessibleChild

virtual bool RecvAttributes(const uint64_t& aID,
nsTArray<Attribute> *aAttributes) override;

virtual bool RecvCharacterCount(const uint64_t& aID, int32_t* aCount)
override;
virtual bool RecvSelectionCount(const uint64_t& aID, int32_t* aCount)
override;

virtual bool RecvTextSubstring(const uint64_t& aID,
const int32_t& aStartOffset,
const int32_t& aEndOffset, nsString* aText)
@@ -65,6 +65,8 @@ child:
// AccessibleText

// TextSubstring is getText in IDL.
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
aEndOffset) returns(nsString aText);
prio(high) sync GetTextAfterOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
@@ -149,6 +149,22 @@ ProxyAccessible::Relations(nsTArray<RelationType>* aTypes,
}
}

int32_t
ProxyAccessible::CharacterCount()
{
int32_t count = 0;
unused << mDoc->SendCharacterCount(mID, &count);
return count;
}

int32_t
ProxyAccessible::SelectionCount()
{
int32_t count = 0;
unused << mDoc->SendSelectionCount(mID, &count);
return count;
}

void
ProxyAccessible::TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
nsString& aText) const
@@ -99,6 +99,9 @@ class ProxyAccessible
void Relations(nsTArray<RelationType>* aTypes,
nsTArray<nsTArray<ProxyAccessible*>>* aTargetSets) const;

int32_t CharacterCount();
int32_t SelectionCount();

/**
* Get the text between the given offsets.
*/

0 comments on commit 9ba60b0

Please sign in to comment.
You can’t perform that action at this time.