Files
roytam1 cc9fb3b5bf import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1152454 - Made liveregions responsive to name/value change events. r=yzen (056df463ef)
- Bug 1166321 - [AccessFu] adding support for role='switch'. r=eeejay (540831bb6a)
- Bug 1179284 - using explicit label for accessible with role 'status' instead of subtree. r=eeejay (919f0b93e7)
- Bug 1163374 - Basic MathML Accessibility support in AccessFu. r=yzen (cddbfee120)
- Bug 1199884 - Keep match roles empty in BaseTraversalRules that don't provide roles. r=yzen (b80ff3c892)
- Bug 1200836 - Land on first atomic object in container traversal. r=yzen (0243a695af)
- Bug 1206491 - Fix a JavaScript error in about:cache page. r=mayhemmer (5eaa374c84)
- Bug 1142174 - Normalize omni.ja! paths when diffing about:memory reports. r=njn (bf046c4958)
- let-var (5e9cf0b098)
- Bug 1205364 part 1. Make createAttribute in an HTML document lowercase the passed-in attribute name. r=smaug (0b8a9f0f60)
- Bug 647621 - Implement document.charset and update document.inputEncoding to the latest spec. r=bz (e31fd9f567)
- Bug 647621 - Remove document.charset from historical.html because it was eventually added to the spec. r=Ms2ger (506ecf3238)
- Bug 1201798 part 1 - Move PropagateScrollToViewport() from nsCSSFrameConstructor to nsPresContext as a public method. r=roc (5d33acfa26)
- Bug 1201798 part 2 - Update viewport scrollbar override for fullscreen and remove the leagcy css rule. r=roc (852d3d181f)
- Bug 1201798 part 3 - Add test for viewport scrollbar on fullscreen. r=roc (88ad5560ae)
- Bug 1048622 - Fix 'assignment to undefined variable' warnings in nsBrowserContentHandler.js. r=gavin (55edf093ce)
- Bug 1205328: undef min/max at the top of irregexp/RegExpAST.h if they're already defined; r=ehsan (2a5daa48a9)
- Bug 773687 - Fix assertion pattern in RegExp with sticky flag. r=till (0f1643690b)
- Bug 1084248 - add a cast<> method, remove the casting constructor as requested. r=waldo (3fb0619085)
- cleanup (705296cc44)
- Bug 1143512 - Remove unused declaration of regexp_flags. r=jandem (79f538a4c8)
- bit of 1198193 and pointer styles (6bec08ca9e)
- Bug 1146580 - Make FinalizationWitnessService listen for xpcom shutdown. r=bholley (6a4093bf23)
- Bug 1199578 - include SharedTypedArray in a type test. r=waldo (94b943eb91)
- Bug 1203791 - Fix LazyLink issue with Debugger::onIonCompilation. r=h4writer (3d5c4ee130)
- pointer style (f24eb566fd)
- Bug 1204726 - Make sure that the MacroAssembler is no longer rooted when onIonCompilation is called. r=h4writer (f697b11f6d)
- Bug 1206418 - Fix origin of animations and scissors for preserves3d. r=roc (1813cc2c21)
2022-09-07 10:25:03 +08:00

152 lines
4.8 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/. */
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Presentation',
'resource://gre/modules/accessibility/Presentation.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Utils',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'EventManager',
'resource://gre/modules/accessibility/EventManager.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'ContentControl',
'resource://gre/modules/accessibility/ContentControl.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States',
'resource://gre/modules/accessibility/Constants.jsm');
Logger.info('content-script.js', content.document.location);
var eventManager = null;
var contentControl = null;
function forwardToParent(aMessage) {
// XXX: This is a silly way to make a deep copy
let newJSON = JSON.parse(JSON.stringify(aMessage.json));
newJSON.origin = 'child';
sendAsyncMessage(aMessage.name, newJSON);
}
function forwardToChild(aMessage, aListener, aVCPosition) {
let acc = aVCPosition || Utils.getVirtualCursor(content.document).position;
if (!Utils.isAliveAndVisible(acc) || acc.role != Roles.INTERNAL_FRAME) {
return false;
}
Logger.debug(() => {
return ['forwardToChild', Logger.accessibleToString(acc),
aMessage.name, JSON.stringify(aMessage.json, null, ' ')];
});
let mm = Utils.getMessageManager(acc.DOMNode);
if (aListener) {
mm.addMessageListener(aMessage.name, aListener);
}
// XXX: This is a silly way to make a deep copy
let newJSON = JSON.parse(JSON.stringify(aMessage.json));
newJSON.origin = 'parent';
if (Utils.isContentProcess) {
// XXX: OOP content's screen offset is 0,
// so we remove the real screen offset here.
newJSON.x -= content.mozInnerScreenX;
newJSON.y -= content.mozInnerScreenY;
}
mm.sendAsyncMessage(aMessage.name, newJSON);
return true;
}
function activateContextMenu(aMessage) {
let position = Utils.getVirtualCursor(content.document).position;
if (!forwardToChild(aMessage, activateContextMenu, position)) {
let center = Utils.getBounds(position, true).center();
let evt = content.document.createEvent('HTMLEvents');
evt.initEvent('contextmenu', true, true);
evt.clientX = center.x;
evt.clientY = center.y;
position.DOMNode.dispatchEvent(evt);
}
}
function presentCaretChange(aText, aOldOffset, aNewOffset) {
if (aOldOffset !== aNewOffset) {
let msg = Presentation.textSelectionChanged(aText, aNewOffset, aNewOffset,
aOldOffset, aOldOffset, true);
sendAsyncMessage('AccessFu:Present', msg);
}
}
function scroll(aMessage) {
let position = Utils.getVirtualCursor(content.document).position;
if (!forwardToChild(aMessage, scroll, position)) {
sendAsyncMessage('AccessFu:DoScroll',
{ bounds: Utils.getBounds(position, true),
page: aMessage.json.page,
horizontal: aMessage.json.horizontal });
}
}
addMessageListener(
'AccessFu:Start',
function(m) {
if (m.json.logLevel) {
Logger.logLevel = Logger[m.json.logLevel];
}
Logger.debug('AccessFu:Start');
if (m.json.buildApp)
Utils.MozBuildApp = m.json.buildApp;
addMessageListener('AccessFu:ContextMenu', activateContextMenu);
addMessageListener('AccessFu:Scroll', scroll);
if (!contentControl) {
contentControl = new ContentControl(this);
}
contentControl.start();
if (!eventManager) {
eventManager = new EventManager(this, contentControl);
}
eventManager.inTest = m.json.inTest;
eventManager.start();
function contentStarted() {
let accDoc = Utils.AccRetrieval.getAccessibleFor(content.document);
if (accDoc && !Utils.getState(accDoc).contains(States.BUSY)) {
sendAsyncMessage('AccessFu:ContentStarted');
} else {
content.setTimeout(contentStarted, 0);
}
}
if (m.json.inTest) {
// During a test we want to wait for the document to finish loading for
// consistency.
contentStarted();
}
});
addMessageListener(
'AccessFu:Stop',
function(m) {
Logger.debug('AccessFu:Stop');
removeMessageListener('AccessFu:ContextMenu', activateContextMenu);
removeMessageListener('AccessFu:Scroll', scroll);
eventManager.stop();
contentControl.stop();
});
sendAsyncMessage('AccessFu:Ready');