diff options
author | bryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-15 20:31:29 +0000 |
---|---|---|
committer | bryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-15 20:31:29 +0000 |
commit | a91a4a953be6f5e4bf02e9e45f7bdd7821ed1273 (patch) | |
tree | d9af812aeb8735bc86f0fc1e38bb6f1f48c86a74 /chrome | |
parent | 17176ace61dcfe1e5abc58dd03adeb0837ce36e1 (diff) | |
download | chromium_src-a91a4a953be6f5e4bf02e9e45f7bdd7821ed1273.zip chromium_src-a91a4a953be6f5e4bf02e9e45f7bdd7821ed1273.tar.gz chromium_src-a91a4a953be6f5e4bf02e9e45f7bdd7821ed1273.tar.bz2 |
preventDefault everywhere in the virtual keyboard.
This prevents the virtual keyboard from changing scale, scrolling, etc.
BUG=none
TEST=manually
Review URL: http://codereview.chromium.org/7910004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/resources/keyboard/common.js | 8 | ||||
-rw-r--r-- | chrome/browser/resources/keyboard/main.js | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/chrome/browser/resources/keyboard/common.js b/chrome/browser/resources/keyboard/common.js index e58f069..1d9cb96 100644 --- a/chrome/browser/resources/keyboard/common.js +++ b/chrome/browser/resources/keyboard/common.js @@ -186,6 +186,9 @@ function setupKeyEventHandlers(key, element, handlers) { * @param {UIEvent} evt The UI event which triggered the key down. */ var downHandler = function(evt) { + // Prevent any of the system gestures from happening. + evt.preventDefault(); + // Don't process a key down if the key is already down. if (key.pressed) { return; @@ -194,7 +197,6 @@ function setupKeyEventHandlers(key, element, handlers) { if (keyDownHandler) { keyDownHandler(); } - evt.preventDefault(); repeatKey.cancel(); // Start a repeating timer if there is a repeat interval and a function to @@ -228,6 +230,9 @@ function setupKeyEventHandlers(key, element, handlers) { * @param {UIEvent} evt The UI event which triggered the key up. */ var upHandler = function(evt) { + // Prevent any of the system gestures from happening. + evt.preventDefault(); + // Reset long-press timer. if (key.longPressTimer) { clearTimeout(key.longPressTimer); @@ -248,7 +253,6 @@ function setupKeyEventHandlers(key, element, handlers) { if (keyUpHandler) { keyUpHandler(); } - evt.preventDefault(); }; var outHandler = function(evt) { diff --git a/chrome/browser/resources/keyboard/main.js b/chrome/browser/resources/keyboard/main.js index 99d4571..729df6c 100644 --- a/chrome/browser/resources/keyboard/main.js +++ b/chrome/browser/resources/keyboard/main.js @@ -155,6 +155,15 @@ window.onresize = function() { window.onload = function() { var body = document.getElementById('b'); + // Catch all unhandled touch events and prevent default, to prevent the + // keyboard from responding to gestures like double tap. + function disableGestures(evt) { + evt.preventDefault(); + } + body.addEventListener('touchstart', disableGestures); + body.addEventListener('touchmove', disableGestures); + body.addEventListener('touchend', disableGestures); + var mainDiv = document.createElement('div'); mainDiv.className = 'main'; mainDiv.id = 'main'; |