зеркало из https://github.com/mozilla/pjs.git
Bug 653009 (part 1/2) - Make preventDefault on touch events compatible with WebKit [r=wesj] DONTBUILD (mobile only)
--HG-- extra : rebase_source : bb77614e151f8491d2ebe0daaed2b1f809780b92
This commit is contained in:
Родитель
09e94e1fe3
Коммит
fbc28ab631
|
@ -1639,7 +1639,6 @@ const ContentTouchHandler = {
|
|||
document.addEventListener("TapLong", this, false);
|
||||
document.addEventListener("TapMove", this, false);
|
||||
|
||||
document.addEventListener("PanBegin", this, false);
|
||||
document.addEventListener("PopupChanged", this, false);
|
||||
document.addEventListener("CancelTouchSequence", this, false);
|
||||
|
||||
|
@ -1665,7 +1664,6 @@ const ContentTouchHandler = {
|
|||
return;
|
||||
|
||||
switch (aEvent.type) {
|
||||
case "PanBegin":
|
||||
case "PopupChanged":
|
||||
case "CancelTouchSequence":
|
||||
this._clearPendingMessages();
|
||||
|
|
|
@ -1205,6 +1205,8 @@ ConsoleAPIObserver.init();
|
|||
|
||||
var TouchEventHandler = {
|
||||
element: null,
|
||||
isCancellable: true,
|
||||
|
||||
init: function() {
|
||||
addMessageListener("Browser:MouseUp", this);
|
||||
addMessageListener("Browser:MouseDown", this);
|
||||
|
@ -1222,12 +1224,13 @@ var TouchEventHandler = {
|
|||
|
||||
switch (aMessage.name) {
|
||||
case "Browser:MouseDown":
|
||||
let cwu = Util.getWindowUtils(content);
|
||||
this.isCancellable = true;
|
||||
this.element = elementFromPoint(json.x, json.y);
|
||||
cancelled = !this.sendEvent("touchstart", json, this.element);
|
||||
break;
|
||||
|
||||
case "Browser:MouseUp":
|
||||
this.isCancellable = false;
|
||||
if (this.element)
|
||||
this.sendEvent("touchend", json, this.element);
|
||||
this.element = null;
|
||||
|
@ -1239,9 +1242,15 @@ var TouchEventHandler = {
|
|||
break;
|
||||
}
|
||||
|
||||
if (aMessage.name != "Browser:MouseUp")
|
||||
if (this.isCancellable) {
|
||||
sendAsyncMessage("Browser:CaptureEvents", { messageId: json.messageId,
|
||||
panning: cancelled });
|
||||
// Panning can be cancelled only during the "touchstart" event and the
|
||||
// first "touchmove" event. After it's cancelled, it stays cancelled
|
||||
// until the next touchstart event.
|
||||
if (cancelled || aMessage.name == "Browser:MouseMove")
|
||||
this.isCancellable = false;
|
||||
}
|
||||
},
|
||||
|
||||
sendEvent: function(aName, aData, aElement) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче