Bug 766780 - Introduce android scroll accessibility events. r=davidb
authorEitan Isaacson <eitan@monotonous.org>
Mon, 25 Jun 2012 10:34:52 -0700
changeset 102870 678d9ad1e2447259167ef48ecbb4914808e2b861
parent 102869 a65f7692ceab2bef83cdd2e0bba6d80911a2f7c2
child 102871 b4fff5e5afb3051970f811a01bff24f0d574634d
push id191
push userlsblakk@mozilla.com
push dateFri, 05 Oct 2012 17:12:53 +0000
treeherdermozilla-release@ddb22ac6c03b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs766780
milestone16.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 766780 - Introduce android scroll accessibility events. r=davidb
accessible/src/jsat/Presenters.jsm
--- a/accessible/src/jsat/Presenters.jsm
+++ b/accessible/src/jsat/Presenters.jsm
@@ -224,16 +224,21 @@ AndroidPresenter.prototype = {
 
   // Android AccessibilityEvent type constants.
   ANDROID_VIEW_CLICKED: 0x01,
   ANDROID_VIEW_LONG_CLICKED: 0x02,
   ANDROID_VIEW_SELECTED: 0x04,
   ANDROID_VIEW_FOCUSED: 0x08,
   ANDROID_VIEW_TEXT_CHANGED: 0x10,
   ANDROID_WINDOW_STATE_CHANGED: 0x20,
+  ANDROID_VIEW_SCROLLED: 0x1000,
+
+  attach: function AndroidPresenter_attach(aWindow) {
+    this.chromeWin = aWindow;
+  },
 
   pivotChanged: function AndroidPresenter_pivotChanged(aContext) {
     if (!aContext.accessible)
       return;
 
     let output = [];
     aContext.newAncestry.forEach(
       function(acc) {
@@ -314,16 +319,34 @@ AndroidPresenter.prototype = {
       androidEvent.removedCount = aLength;
       androidEvent.beforeText =
         aText.substring(0, aStart) + aModifiedText + aText.substring(aStart);
     }
 
     this.sendMessageToJava({gecko: androidEvent});
   },
 
+  viewportChanged: function AndroidPresenter_viewportChanged() {
+    if (Utils.AndroidSdkVersion < 14)
+      return;
+
+    let win = Utils.getBrowserApp(this.chromeWin).selectedBrowser.contentWindow;
+    this.sendMessageToJava({
+      gecko: {
+        type: 'Accessibility:Event',
+        eventType: this.ANDROID_VIEW_SCROLLED,
+        text: [],
+        scrollX: win.scrollX,
+        scrollY: win.scrollY,
+        maxScrollX: win.scrollMaxX,
+        maxScrollY: win.scrollMaxY
+      }
+    });
+  },
+
   sendMessageToJava: function AndroidPresenter_sendMessageTojava(aMessage) {
     return Cc['@mozilla.org/android/bridge;1'].
       getService(Ci.nsIAndroidBridge).
       handleGeckoMessage(JSON.stringify(aMessage));
   }
 };
 
 /**