Files
roytam1 e0e84a7434 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1193786 - crash in mozilla::dom::Element::FindAttrValueIn, r=marcoz (1f03b9594f)
- bug 1172516 - fix firing caret move events for proxied accessibles r=lsocks (6a62915a27)
- Bug 582024 - ARIA active-descendant should work for ARIA owned elements, r=yzen (4fc7049fe1)
- Bug 1212457 - crash at ARIARowAccessible::GroupPosition(), r=marcoz (dd058e3dcd)
- bit of 1139049 (ae765adc6a)
- Bug 1221542, bug 1221543 - crash in mozilla::a11y::DocAccessible::SeizeChild/PutChildrenBack, r=davidb (8a35b14523)
- Bug 1105611 - HyperTextAccessible should set DOM range outside of pseudo elements r=surkov (19e2cf65cd)
- Bug 1177765 - Add xmlroles for MathML. r=surkov (381201ae27)
- Bug 1176683 - crash in mozilla::a11y::HyperTextAccessible::LandmarkRole() const, r=marcoz (f3fd977d35)
- Bug 1176123 - Add NODE_CHILD_OF/NODE_PARENT_OF relations to mroot. r=surkov (36f08faa15)
- Bug 1179483 - Fix crash in mozilla::a11y::HyperTextAccessible::RelationByType. r=MarcoZ (fec7fde5b3)
- Bug 1177765 - Make nsIMathMLFrame expose the fence and separator properties of operators. r=karlt (91e45d9980)
- Bug 1139709. Cache nsMathMLContainerFrame's intrinsic width. r=mats (ac40d07d89)
- code style (c5f50fc0c3)
- Bug 1226875 - Remove nsIFrame::GetLastChild(). r=mats (9b88566b77)
- pointer style (6a5b9599f4)
- Bug 1177093 - mathfont.properties does not need to be preprocessed after Bug 1000745 r=fred.wang (d114e285a1)
- Bug 1224951 - Part 2: Fix -Wunreachable-code warnings in layout. r=dholbert (5854ee5e3e)
- Bug 1141443 - Remove unused rpcns4 from OS_LIBS. r=mshal (1a5ccc985b)
- bug 1218762 - proxy ia2Accessible::scrollTo{,Point}() r=davidb (db1db8e703)
- Bug 1182208 - Add support for android scrolling and range accessibility actions. r=mfinkle r=yzen (29df38ee29)
- Bug 1144516 - Remove offset of mozbrowser iframe. r=yzen (c7473a8feb)
- Bug 1176292 - Send 'toggle-shade' control event to content on 3 finger triple tap. r=yzen (536932619a)
- Bug 1182222 - Make Layerview support accessibility HTML navigation. r=yzen r=mfinkle (2beb411989)
- Bug 1203697 - Add braille navigation. r=yzen r=mfinkle (d5a513e79e)
- Bug 1209054 - Make 2 finger tap toggle pause speech. r=yzen (28bc8c16a6)
- Bug 1214398 - Add highlight box to doc body if it is available and set z-index. r=yzen (9cca205849)
- Bug 1182214 - Update highlight rect as you scroll. r=yzen (6d2738366a)
- Bug 1182214 - Follow-up to fix Presentation.displayedAccessibles getter. r=me CLOSED TREE (6dd8ec3652)
- Bug 1212528 - ensuring first seen document in ancestry is announced first. r=marcoz (fb8e9bc406)
- Bug 1217038 - Remove for-each and legacy array comprehension from accessible/. r=yzen (810590b5d3)
- Bug 1220860 - fixing an error with getting documentElement on AccessFu stop. r=eeejay (4a35fabc3d)
- Bug 1169019 - Removed screenreader announcement from gecko. r=yzen (2b1732cddc)
- Bug 1211122 - ensuring that we check position against an actual doc/dialog on doc load event. r=marcoz (78b7cc8a77)
- Bug 1019432 - [AccessFu] Only capture explore by touch events in Android. r=yzen (eee4b09c72)
- Bug 1182311 - Make 3 finger triple tap more reliable. r=yzen (7cf926a839)
- Bug 1201146 - Introduce "Section" traversal rule. r=yzen (253d53ec8d)
- Bug 1203283 - Introduce Android "Control" traversal rule. r=yzen (4d14ffa973)
2023-03-07 11:54:02 +08:00

175 lines
5.0 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global Components, XPCOMUtils, Utils, Logger, GestureSettings,
GestureTracker */
/* exported PointerRelay, PointerAdapter */
'use strict';
const Ci = Components.interfaces;
const Cu = Components.utils;
this.EXPORTED_SYMBOLS = ['PointerRelay', 'PointerAdapter']; // jshint ignore:line
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Utils', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'GestureSettings', // jshint ignore:line
'resource://gre/modules/accessibility/Gestures.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'GestureTracker', // jshint ignore:line
'resource://gre/modules/accessibility/Gestures.jsm');
// The virtual touch ID generated by a mouse event.
const MOUSE_ID = 'mouse';
// Synthesized touch ID.
const SYNTH_ID = -1;
var PointerRelay = { // jshint ignore:line
/**
* A mapping of events we should be intercepting. Entries with a value of
* |true| are used for compiling high-level gesture events. Entries with a
* value of |false| are cancelled and do not propogate to content.
*/
get _eventsOfInterest() {
delete this._eventsOfInterest;
switch (Utils.widgetToolkit) {
case 'android':
this._eventsOfInterest = {
'touchstart' : true,
'touchmove' : true,
'touchend' : true };
break;
case 'gonk':
this._eventsOfInterest = {
'touchstart' : true,
'touchmove' : true,
'touchend' : true,
'mousedown' : false,
'mousemove' : false,
'mouseup': false,
'click': false };
break;
default:
// Desktop.
this._eventsOfInterest = {
'mousemove' : true,
'mousedown' : true,
'mouseup': true,
'click': false
};
if ('ontouchstart' in Utils.win) {
for (let eventType of ['touchstart', 'touchmove', 'touchend']) {
this._eventsOfInterest[eventType] = true;
}
}
break;
}
return this._eventsOfInterest;
},
_eventMap: {
'touchstart' : 'pointerdown',
'mousedown' : 'pointerdown',
'touchmove' : 'pointermove',
'mousemove' : 'pointermove',
'touchend' : 'pointerup',
'mouseup': 'pointerup'
},
start: function PointerRelay_start(aOnPointerEvent) {
Logger.debug('PointerRelay.start');
this.onPointerEvent = aOnPointerEvent;
for (let eventType in this._eventsOfInterest) {
Utils.win.addEventListener(eventType, this, true, true);
}
},
stop: function PointerRelay_stop() {
Logger.debug('PointerRelay.stop');
delete this.lastPointerMove;
delete this.onPointerEvent;
for (let eventType in this._eventsOfInterest) {
Utils.win.removeEventListener(eventType, this, true, true);
}
},
handleEvent: function PointerRelay_handleEvent(aEvent) {
// Don't bother with chrome mouse events.
if (Utils.MozBuildApp === 'browser' &&
aEvent.view.top instanceof Ci.nsIDOMChromeWindow) {
return;
}
if (aEvent.mozInputSource === Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN ||
aEvent.isSynthesized) {
// Ignore events that are scripted or clicks from the a11y API.
return;
}
let changedTouches = aEvent.changedTouches || [{
identifier: MOUSE_ID,
screenX: aEvent.screenX,
screenY: aEvent.screenY,
target: aEvent.target
}];
if (Utils.widgetToolkit === 'android' &&
changedTouches.length === 1 && changedTouches[0].identifier === 1) {
return;
}
if (changedTouches.length === 1 &&
changedTouches[0].identifier === SYNTH_ID) {
return;
}
aEvent.preventDefault();
aEvent.stopImmediatePropagation();
let type = aEvent.type;
if (!this._eventsOfInterest[type]) {
return;
}
let pointerType = this._eventMap[type];
this.onPointerEvent({
type: pointerType,
points: Array.prototype.map.call(changedTouches,
function mapTouch(aTouch) {
return {
identifier: aTouch.identifier,
x: aTouch.screenX,
y: aTouch.screenY
};
}
)
});
}
};
this.PointerAdapter = { // jshint ignore:line
start: function PointerAdapter_start() {
Logger.debug('PointerAdapter.start');
GestureTracker.reset();
PointerRelay.start(this.handleEvent);
},
stop: function PointerAdapter_stop() {
Logger.debug('PointerAdapter.stop');
PointerRelay.stop();
GestureTracker.reset();
},
handleEvent: function PointerAdapter_handleEvent(aDetail) {
let timeStamp = Date.now();
GestureTracker.handle(aDetail, timeStamp);
}
};