bug 1218762 - proxy ia2Accessible::scrollTo{,Point}() r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Wed, 18 Nov 2015 14:19:47 -0500
changeset 273525 6c9566ca9ed1cd409dd2cc2043883f6ef36d7258
parent 273524 18344b1eb183ceff41d82218826be7846eb09481
child 273526 c3ba2f74af1ee3432f7872de90ca647519fc2e93
push id68307
push usertsaunders@mozilla.com
push dateFri, 20 Nov 2015 14:48:33 +0000
treeherdermozilla-inbound@14bd25c63912 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1218762
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1218762 - proxy ia2Accessible::scrollTo{,Point}() r=davidb
accessible/ipc/DocAccessibleChild.cpp
accessible/ipc/DocAccessibleChild.h
accessible/ipc/PDocAccessible.ipdl
accessible/ipc/ProxyAccessible.cpp
accessible/ipc/ProxyAccessible.h
accessible/windows/ia2/ia2Accessible.cpp
--- a/accessible/ipc/DocAccessibleChild.cpp
+++ b/accessible/ipc/DocAccessibleChild.cpp
@@ -368,16 +368,40 @@ DocAccessibleChild::RecvGetLevelInternal
   Accessible* acc = IdToAccessible(aID);
   if (acc) {
     *aLevel = acc->GetLevelInternal();
   }
   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)
 {
   HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
   *aLineNumber = acc && acc->IsTextRole() ? acc->CaretLineNumber() : 0;
   return true;
 }
 
 bool
--- a/accessible/ipc/DocAccessibleChild.h
+++ b/accessible/ipc/DocAccessibleChild.h
@@ -93,16 +93,21 @@ public:
   virtual bool RecvLandmarkRole(const uint64_t& aID, nsString* aLandmark) override;
 
   virtual bool RecvARIARoleAtom(const uint64_t& aID, nsString* aRole) override;
 
   virtual bool RecvGetLevelInternal(const uint64_t& aID, int32_t* aLevel) override;
 
   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;
   virtual bool RecvCaretOffset(const uint64_t& aID, int32_t* aOffset)
     override;
   virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset)
     override;
 
--- a/accessible/ipc/PDocAccessible.ipdl
+++ b/accessible/ipc/PDocAccessible.ipdl
@@ -81,16 +81,19 @@ child:
   prio(high) sync Attributes(uint64_t aID) returns(Attribute[] attributes);
   prio(high) sync RelationByType(uint64_t aID, uint32_t aRelationType)
     returns(uint64_t[] targets);
   prio(high) sync Relations(uint64_t aID) returns(RelationTargets[] relations);
   prio(high) sync IsSearchbox(uint64_t aID) returns(bool retval);
   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
 
   // TextSubstring is getText in IDL.
   prio(high) sync CaretLineNumber(uint64_t aID) returns(int32_t aLineNumber);
   prio(high) sync CaretOffset(uint64_t aID) returns(int32_t aOffset);
    async SetCaretOffset(uint64_t aID, int32_t aOffset);
   prio(high) sync CharacterCount(uint64_t aID) returns(int32_t aCount);
--- a/accessible/ipc/ProxyAccessible.cpp
+++ b/accessible/ipc/ProxyAccessible.cpp
@@ -195,16 +195,28 @@ ProxyAccessible::ARIARoleAtom() const
 int32_t
 ProxyAccessible::GetLevelInternal()
 {
   int32_t level = 0;
   Unused << mDoc->SendGetLevelInternal(mID, &level);
   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()
 {
   int32_t line = -1;
   Unused << mDoc->SendCaretOffset(mID, &line);
   return line;
 }
 
--- a/accessible/ipc/ProxyAccessible.h
+++ b/accessible/ipc/ProxyAccessible.h
@@ -139,16 +139,18 @@ public:
 
   bool IsSearchbox() const;
 
   nsIAtom* LandmarkRole() const;
 
   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();
   void SetCaretOffset(int32_t aOffset);
 
   int32_t CharacterCount();
   int32_t SelectionCount();
 
--- a/accessible/windows/ia2/ia2Accessible.cpp
+++ b/accessible/windows/ia2/ia2Accessible.cpp
@@ -274,18 +274,23 @@ STDMETHODIMP
 ia2Accessible::scrollTo(enum IA2ScrollType aScrollType)
 {
   A11Y_TRYBLOCK_BEGIN
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   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
 }
 
 STDMETHODIMP
 ia2Accessible::scrollToPoint(enum IA2CoordinateType aCoordType,
                               long aX, long aY)
@@ -295,17 +300,22 @@ ia2Accessible::scrollToPoint(enum IA2Coo
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     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
 }
 
 STDMETHODIMP
 ia2Accessible::get_groupPosition(long* aGroupLevel,
                                  long* aSimilarItemsInGroup,