diff --git a/mobile/android/base/gfx/JavaPanZoomController.java b/mobile/android/base/gfx/JavaPanZoomController.java index ea76a91f166a..8340aefda40c 100644 --- a/mobile/android/base/gfx/JavaPanZoomController.java +++ b/mobile/android/base/gfx/JavaPanZoomController.java @@ -1373,9 +1373,7 @@ class JavaPanZoomController @Override public boolean onDoubleTap(MotionEvent motionEvent) { - if (mTarget.getZoomConstraints().getAllowDoubleTapZoom()) { - sendPointToGecko("Gesture:DoubleTap", motionEvent); - } + sendPointToGecko("Gesture:DoubleTap", motionEvent); return true; } diff --git a/mobile/android/chrome/content/aboutReader.js b/mobile/android/chrome/content/aboutReader.js index 660fb6001e2d..c7bcc913ab70 100644 --- a/mobile/android/chrome/content/aboutReader.js +++ b/mobile/android/chrome/content/aboutReader.js @@ -35,6 +35,7 @@ let AboutReader = function(doc, win) { Services.obs.addObserver(this, "Reader:Add", false); Services.obs.addObserver(this, "Reader:Remove", false); Services.obs.addObserver(this, "Reader:ListStatusReturn", false); + Services.obs.addObserver(this, "Gesture:DoubleTap", false); this._article = null; @@ -223,6 +224,19 @@ AboutReader.prototype = { } break; } + + case "Gesture:DoubleTap": { + let args = JSON.parse(aData); + let scrollBy; + // Arbitary choice of innerHeight - 50 to give some context after scroll + if (args.y < (this._win.innerHeight / 2)) { + scrollBy = -this._win.innerHeight + 50; + } else { + scrollBy = this._win.innerHeight - 50; + } + this._scrollPage(scrollBy); + break; + } } }, @@ -261,10 +275,21 @@ AboutReader.prototype = { Services.obs.removeObserver(this, "Reader:Add"); Services.obs.removeObserver(this, "Reader:Remove"); Services.obs.removeObserver(this, "Reader:ListStatusReturn"); + Services.obs.removeObserver(this, "Gesture:DoubleTap"); break; } }, + _scrollPage: function Reader_scrollPage(scrollByPixels) { + let viewport = BrowserApp.selectedTab.getViewport(); + let newY = Math.min(Math.max(viewport.cssY + scrollByPixels, viewport.cssPageTop), viewport.cssPageBottom); + let newRect = new Rect(viewport.cssX, newY, viewport.cssWidth, viewport.cssHeight); + + this._setToolbarVisibility(false); + this._scrolled = true; + ZoomHelper.zoomToRect(newRect, -1, false, false); + }, + _updateToggleButton: function Reader_updateToggleButton() { let classes = this._doc.getElementById("toggle-button").classList; diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 45c4b8f2ad13..3fd34d22eb21 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -4878,6 +4878,11 @@ var BrowserEventHandler = { }, onDoubleTap: function(aData) { + let metadata = BrowserApp.selectedTab.metadata; + if (!metadata.allowDoubleTapZoom) { + return; + } + let data = JSON.parse(aData); let element = ElementTouchHelper.anyElementFromPoint(data.x, data.y);