зеркало из https://github.com/mozilla/pjs.git
Bug 653990 - preventDefault on touchmove does not completely prevent panning [r=wesj]
This commit is contained in:
Родитель
43fc776d3e
Коммит
bf9d18eaf5
|
@ -1746,9 +1746,12 @@ const ContentTouchHandler = {
|
||||||
|
|
||||||
if (json.click)
|
if (json.click)
|
||||||
this.clickPrevented = true;
|
this.clickPrevented = true;
|
||||||
|
if (json.panning)
|
||||||
|
this.panningPrevented = true;
|
||||||
|
|
||||||
if (this.canCancelPan)
|
// We don't know if panning is allowed until the first touchmove event is processed.
|
||||||
Elements.browsers.customDragger.contentMouseCapture = json.panning;
|
if (this.canCancelPan && json.type == "touchmove")
|
||||||
|
Elements.browsers.customDragger.contentMouseCapture = this.panningPrevented;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "Browser:CanCaptureMouse:Return": {
|
case "Browser:CanCaptureMouse:Return": {
|
||||||
|
@ -1790,10 +1793,9 @@ const ContentTouchHandler = {
|
||||||
},
|
},
|
||||||
|
|
||||||
touchTimeout: null,
|
touchTimeout: null,
|
||||||
|
|
||||||
canCancelPan: false,
|
canCancelPan: false,
|
||||||
|
|
||||||
clickPrevented: false,
|
clickPrevented: false,
|
||||||
|
panningPrevented: false,
|
||||||
|
|
||||||
updateCanCancel: function(aX, aY) {
|
updateCanCancel: function(aX, aY) {
|
||||||
let dpi = Browser.windowUtils.displayDPI;
|
let dpi = Browser.windowUtils.displayDPI;
|
||||||
|
@ -1823,6 +1825,7 @@ const ContentTouchHandler = {
|
||||||
// if the page might capture touch events, we give it the option
|
// if the page might capture touch events, we give it the option
|
||||||
this.updateCanCancel(aX, aY);
|
this.updateCanCancel(aX, aY);
|
||||||
this.clickPrevented = false;
|
this.clickPrevented = false;
|
||||||
|
this.panningPrevented = false;
|
||||||
|
|
||||||
let dragger = Elements.browsers.customDragger;
|
let dragger = Elements.browsers.customDragger;
|
||||||
dragger.contentMouseCapture = this.canCancelPan && Browser.selectedTab.contentMightCaptureMouse;
|
dragger.contentMouseCapture = this.canCancelPan && Browser.selectedTab.contentMightCaptureMouse;
|
||||||
|
|
|
@ -1224,30 +1224,33 @@ var TouchEventHandler = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let cancelled = false;
|
let type;
|
||||||
|
|
||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
case "Browser:MouseDown":
|
case "Browser:MouseDown":
|
||||||
this.isCancellable = true;
|
this.isCancellable = true;
|
||||||
this.element = elementFromPoint(json.x, json.y);
|
this.element = elementFromPoint(json.x, json.y);
|
||||||
cancelled = !this.sendEvent("touchstart", json, this.element);
|
type = "touchstart";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Browser:MouseUp":
|
case "Browser:MouseUp":
|
||||||
this.isCancellable = false;
|
this.isCancellable = false;
|
||||||
if (this.element)
|
type = "touchend";
|
||||||
this.sendEvent("touchend", json, this.element);
|
|
||||||
this.element = null;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Browser:MouseMove":
|
case "Browser:MouseMove":
|
||||||
if (this.element)
|
type = "touchmove";
|
||||||
cancelled = !this.sendEvent("touchmove", json, this.element);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.element)
|
||||||
|
return;
|
||||||
|
let cancelled = !this.sendEvent(type, json, this.element);
|
||||||
|
if (type == "touchend")
|
||||||
|
this.element = null;
|
||||||
|
|
||||||
if (this.isCancellable) {
|
if (this.isCancellable) {
|
||||||
sendAsyncMessage("Browser:CaptureEvents", { messageId: json.messageId,
|
sendAsyncMessage("Browser:CaptureEvents", { messageId: json.messageId,
|
||||||
|
type: type,
|
||||||
contentMightCaptureMouse: true,
|
contentMightCaptureMouse: true,
|
||||||
click: cancelled && aMessage.name == "Browser:MouseDown",
|
click: cancelled && aMessage.name == "Browser:MouseDown",
|
||||||
panning: cancelled });
|
panning: cancelled });
|
||||||
|
|
Загрузка…
Ссылка в новой задаче