mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1004294 - Improve explore by touch performance. r=yzen
This commit is contained in:
parent
9beee79ee3
commit
77cc463cc5
@ -918,10 +918,18 @@ var Input = {
|
||||
},
|
||||
|
||||
moveToPoint: function moveToPoint(aRule, aX, aY) {
|
||||
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
|
||||
mm.sendAsyncMessage('AccessFu:MoveToPoint', {rule: aRule,
|
||||
x: aX, y: aY,
|
||||
origin: 'top'});
|
||||
// XXX: Bug 1013408 - There is no alignment between the chrome window's
|
||||
// viewport size and the content viewport size in Android. This makes
|
||||
// sending mouse events beyond its bounds impossible.
|
||||
if (Utils.MozBuildApp === 'mobile/android') {
|
||||
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
|
||||
mm.sendAsyncMessage('AccessFu:MoveToPoint',
|
||||
{rule: aRule, x: aX, y: aY, origin: 'top'});
|
||||
} else {
|
||||
let win = Utils.win;
|
||||
Utils.winUtils.sendMouseEvent('mousemove',
|
||||
aX - win.mozInnerScreenX, aY - win.mozInnerScreenY, 0, 0, 0);
|
||||
}
|
||||
},
|
||||
|
||||
moveCursor: function moveCursor(aAction, aRule, aInputType) {
|
||||
@ -999,11 +1007,9 @@ var Input = {
|
||||
let page = aDetails.page;
|
||||
let p = AccessFu.adjustContentBounds(aDetails.bounds, Utils.CurrentBrowser,
|
||||
true, true).center();
|
||||
let wu = Utils.win.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
wu.sendWheelEvent(p.x, p.y,
|
||||
horizontal ? page : 0, horizontal ? 0 : page, 0,
|
||||
Utils.win.WheelEvent.DOM_DELTA_PAGE, 0, 0, 0, 0);
|
||||
Utils.winUtils.sendWheelEvent(p.x, p.y,
|
||||
horizontal ? page : 0, horizontal ? 0 : page, 0,
|
||||
Utils.win.WheelEvent.DOM_DELTA_PAGE, 0, 0, 0, 0);
|
||||
},
|
||||
|
||||
get keyMap() {
|
||||
|
@ -45,6 +45,7 @@ this.ContentControl.prototype = {
|
||||
for (let message of this.messagesOfInterest) {
|
||||
cs.addMessageListener(message, this);
|
||||
}
|
||||
cs.addEventListener('mousemove', this);
|
||||
},
|
||||
|
||||
stop: function cc_stop() {
|
||||
@ -52,6 +53,7 @@ this.ContentControl.prototype = {
|
||||
for (let message of this.messagesOfInterest) {
|
||||
cs.removeMessageListener(message, this);
|
||||
}
|
||||
cs.removeEventListener('mousemove', this);
|
||||
},
|
||||
|
||||
get document() {
|
||||
@ -124,18 +126,22 @@ this.ContentControl.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent: function cc_handleEvent(aEvent) {
|
||||
if (aEvent.type === 'mousemove') {
|
||||
this.handleMoveToPoint(
|
||||
{ json: { x: aEvent.screenX, y: aEvent.screenY, rule: 'Simple' } });
|
||||
}
|
||||
if (!Utils.getMessageManager(aEvent.target)) {
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
handleMoveToPoint: function cc_handleMoveToPoint(aMessage) {
|
||||
let [x, y] = [aMessage.json.x, aMessage.json.y];
|
||||
let rule = TraversalRules[aMessage.json.rule];
|
||||
let vc = this.vc;
|
||||
let win = this.window;
|
||||
|
||||
let dpr = win.devicePixelRatio;
|
||||
let dpr = this.window.devicePixelRatio;
|
||||
this.vc.moveToPoint(rule, x * dpr, y * dpr, true);
|
||||
|
||||
let delta = Utils.isContentProcess ?
|
||||
{ x: x - win.mozInnerScreenX, y: y - win.mozInnerScreenY } : {};
|
||||
this.sendToChild(vc, aMessage, delta);
|
||||
},
|
||||
|
||||
handleClearCursor: function cc_handleClearCursor(aMessage) {
|
||||
|
@ -110,36 +110,14 @@ let PointerRelay = { // jshint ignore:line
|
||||
}
|
||||
},
|
||||
|
||||
_suppressPointerMove: function PointerRelay__suppressPointerMove(aChangedTouches) {
|
||||
if (!this.lastPointerMove) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < aChangedTouches.length; ++i) {
|
||||
let touch = aChangedTouches[i];
|
||||
let lastTouch;
|
||||
try {
|
||||
lastTouch = this.lastPointerMove.identifiedTouch ?
|
||||
this.lastPointerMove.identifiedTouch(touch.identifier) :
|
||||
this.lastPointerMove[i];
|
||||
} catch (x) {
|
||||
// Sometimes touch object can't be accessed after page navigation.
|
||||
}
|
||||
if (!lastTouch || lastTouch.target !== touch.target ||
|
||||
Math.hypot(touch.screenX - lastTouch.screenX, touch.screenY -
|
||||
lastTouch.screenY) / Utils.dpi >= GestureSettings.travelThreshold) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return 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) {
|
||||
if (aEvent.mozInputSource === Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN ||
|
||||
aEvent.isSynthesized) {
|
||||
// Ignore events that are scripted or clicks from the a11y API.
|
||||
return;
|
||||
}
|
||||
@ -164,13 +142,6 @@ let PointerRelay = { // jshint ignore:line
|
||||
return;
|
||||
}
|
||||
let pointerType = this._eventMap[type];
|
||||
if (pointerType === 'pointermove') {
|
||||
if (this._suppressPointerMove(changedTouches)) {
|
||||
// Do not fire pointermove more than every POINTERMOVE_THROTTLE.
|
||||
return;
|
||||
}
|
||||
this.lastPointerMove = changedTouches;
|
||||
}
|
||||
this.onPointerEvent({
|
||||
type: pointerType,
|
||||
points: Array.prototype.map.call(changedTouches,
|
||||
|
@ -54,6 +54,15 @@ this.Utils = {
|
||||
return this._win.get();
|
||||
},
|
||||
|
||||
get winUtils() {
|
||||
let win = this.win;
|
||||
if (!win) {
|
||||
return null;
|
||||
}
|
||||
return win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(
|
||||
Ci.nsIDOMWindowUtils);
|
||||
},
|
||||
|
||||
get AccRetrieval() {
|
||||
if (!this._AccRetrieval) {
|
||||
this._AccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
|
||||
@ -181,7 +190,6 @@ this.Utils = {
|
||||
return aBrowser.QueryInterface(Ci.nsIFrameLoaderOwner).
|
||||
frameLoader.messageManager;
|
||||
} catch (x) {
|
||||
Logger.logException(x);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
@ -252,8 +260,7 @@ this.Utils = {
|
||||
*/
|
||||
get dpi() {
|
||||
delete this.dpi;
|
||||
this.dpi = this.win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(
|
||||
Ci.nsIDOMWindowUtils).displayDPI;
|
||||
this.dpi = this.winUtils.displayDPI;
|
||||
return this.dpi;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user