bug 1218762 - proxy ia2Accessible::scrollTo{,Point}() r=davidb

This commit is contained in:
Trevor Saunders 2015-11-18 14:19:47 -05:00
parent 748729e958
commit 921ee26633
6 changed files with 59 additions and 3 deletions

View File

@ -372,6 +372,30 @@ DocAccessibleChild::RecvGetLevelInternal(const uint64_t& aID, int32_t* aLevel)
return true;
}
bool
DocAccessibleChild::RecvScrollTo(const uint64_t& aID,
const uint32_t& aScrollType)
{
Accessible* acc = IdToAccessible(aID);
if (acc) {
nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
aScrollType);
}
return true;
}
bool
DocAccessibleChild::RecvScrollToPoint(const uint64_t& aID, const uint32_t& aScrollType, const int32_t& aX, const int32_t& aY)
{
Accessible* acc = IdToAccessible(aID);
if (acc) {
acc->ScrollToPoint(aScrollType, aX, aY);
}
return true;
}
bool
DocAccessibleChild::RecvCaretLineNumber(const uint64_t& aID, int32_t* aLineNumber)
{

View File

@ -98,6 +98,11 @@ public:
virtual bool RecvAttributes(const uint64_t& aID,
nsTArray<Attribute> *aAttributes) override;
virtual bool RecvScrollTo(const uint64_t& aID, const uint32_t& aScrollType)
override;
virtual bool RecvScrollToPoint(const uint64_t& aID,
const uint32_t& aScrollType,
const int32_t& aX, const int32_t& aY) override;
virtual bool RecvCaretLineNumber(const uint64_t& aID, int32_t* aLineNumber)
override;

View File

@ -86,6 +86,9 @@ child:
prio(high) sync LandmarkRole(uint64_t aID) returns(nsString landmark);
prio(high) sync ARIARoleAtom(uint64_t aID) returns(nsString role);
prio(high) sync GetLevelInternal(uint64_t aID) returns(int32_t aLevel);
async ScrollTo(uint64_t aID, uint32_t aScrollType);
async ScrollToPoint(uint64_t aID, uint32_t aScrollType, int32_t aX,
int32_t aY);
// AccessibleText

View File

@ -200,6 +200,18 @@ ProxyAccessible::GetLevelInternal()
return level;
}
void
ProxyAccessible::ScrollTo(uint32_t aScrollType)
{
Unused << mDoc->SendScrollTo(mID, aScrollType);
}
void
ProxyAccessible::ScrollToPoint(uint32_t aScrollType, int32_t aX, int32_t aY)
{
Unused << mDoc->SendScrollToPoint(mID, aScrollType, aX, aY);
}
int32_t
ProxyAccessible::CaretLineNumber()
{

View File

@ -144,6 +144,8 @@ public:
nsIAtom* ARIARoleAtom() const;
int32_t GetLevelInternal();
void ScrollTo(uint32_t aScrollType);
void ScrollToPoint(uint32_t aScrollType, int32_t aX, int32_t aY);
int32_t CaretLineNumber();
int32_t CaretOffset();

View File

@ -279,8 +279,13 @@ ia2Accessible::scrollTo(enum IA2ScrollType aScrollType)
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsCoreUtils::ScrollTo(acc->Document()->PresShell(),
acc->GetContent(), aScrollType);
if (acc->IsProxy()) {
acc->Proxy()->ScrollTo(aScrollType);
} else {
nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
aScrollType);
}
return S_OK;
A11Y_TRYBLOCK_END
@ -300,7 +305,12 @@ ia2Accessible::scrollToPoint(enum IA2CoordinateType aCoordType,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
acc->ScrollToPoint(geckoCoordType, aX, aY);
if (acc->IsProxy()) {
acc->Proxy()->ScrollToPoint(geckoCoordType, aX, aY);
} else {
acc->ScrollToPoint(geckoCoordType, aX, aY);
}
return S_OK;
A11Y_TRYBLOCK_END