Bug 653990 - preventDefault on touchmove does not completely prevent panning [r=wesj]

This commit is contained in:
Matt Brubeck 2011-05-02 12:57:22 -07:00
Родитель 43fc776d3e
Коммит bf9d18eaf5
2 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@ -1746,9 +1746,12 @@ const ContentTouchHandler = {
if (json.click)
this.clickPrevented = true;
if (json.panning)
this.panningPrevented = true;
if (this.canCancelPan)
Elements.browsers.customDragger.contentMouseCapture = json.panning;
// We don't know if panning is allowed until the first touchmove event is processed.
if (this.canCancelPan && json.type == "touchmove")
Elements.browsers.customDragger.contentMouseCapture = this.panningPrevented;
break;
}
case "Browser:CanCaptureMouse:Return": {
@ -1790,10 +1793,9 @@ const ContentTouchHandler = {
},
touchTimeout: null,
canCancelPan: false,
clickPrevented: false,
panningPrevented: false,
updateCanCancel: function(aX, aY) {
let dpi = Browser.windowUtils.displayDPI;
@ -1823,6 +1825,7 @@ const ContentTouchHandler = {
// if the page might capture touch events, we give it the option
this.updateCanCancel(aX, aY);
this.clickPrevented = false;
this.panningPrevented = false;
let dragger = Elements.browsers.customDragger;
dragger.contentMouseCapture = this.canCancelPan && Browser.selectedTab.contentMightCaptureMouse;

Просмотреть файл

@ -1224,30 +1224,33 @@ var TouchEventHandler = {
return;
}
let cancelled = false;
let type;
switch (aMessage.name) {
case "Browser:MouseDown":
this.isCancellable = true;
this.element = elementFromPoint(json.x, json.y);
cancelled = !this.sendEvent("touchstart", json, this.element);
type = "touchstart";
break;
case "Browser:MouseUp":
this.isCancellable = false;
if (this.element)
this.sendEvent("touchend", json, this.element);
this.element = null;
type = "touchend";
break;
case "Browser:MouseMove":
if (this.element)
cancelled = !this.sendEvent("touchmove", json, this.element);
type = "touchmove";
break;
}
if (!this.element)
return;
let cancelled = !this.sendEvent(type, json, this.element);
if (type == "touchend")
this.element = null;
if (this.isCancellable) {
sendAsyncMessage("Browser:CaptureEvents", { messageId: json.messageId,
type: type,
contentMightCaptureMouse: true,
click: cancelled && aMessage.name == "Browser:MouseDown",
panning: cancelled });