Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8085)

Unified Diff: chrome/browser/resources/ntp4/tile_page.js

Issue 10092017: Mac: Prevent NTP mousewheel events from being suppressed on Lion. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix scrolling when over page switcher. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/ntp4/tile_page.js
diff --git a/chrome/browser/resources/ntp4/tile_page.js b/chrome/browser/resources/ntp4/tile_page.js
index 7a79c0b757441221b8012c2bf134401242fea7cd..69be9cef42582b8db9b38608c45e4aa22c3e8ac1 100644
--- a/chrome/browser/resources/ntp4/tile_page.js
+++ b/chrome/browser/resources/ntp4/tile_page.js
@@ -448,7 +448,6 @@ cr.define('ntp', function() {
this.addEventListener('DOMNodeInsertedIntoDocument',
this.onNodeInsertedIntoDocument_);
- this.addEventListener('mousewheel', this.onMouseWheel_);
Patrick Dubroy 2012/04/17 17:28:24 We don't need to add a listener to this object, be
this.content_.addEventListener('scroll', this.onScroll_.bind(this));
this.dragWrapper_ = new cr.ui.DragWrapper(this.tileGrid_, this);
@@ -1053,28 +1052,28 @@ cr.define('ntp', function() {
},
/**
- * Scrolls the page in response to a mousewheel event.
+ * Scrolls the page in response to an mousewheel event, although the event
+ * may have been triggered on a different element.
+ * This is called explicitly, which allows a consistent experience whether
+ * the user scrolls on the page or on the page switcher, because this
+ * function provides a common conversion factor between wheel delta and
+ * scroll delta.
* @param {Event} e The mousewheel event.
*/
handleMouseWheel: function(e) {
- this.content_.scrollTop -= e.wheelDeltaY / 3;
- },
-
- /**
- * Handles mouse wheels on |this|. We handle this explicitly because we want
- * a consistent experience whether the user scrolls on the page or on the
- * page switcher (handleMouseWheel provides a common conversion factor
- * between wheel delta and scroll delta).
- * @param {Event} e The mousewheel event.
- * @private
- */
- onMouseWheel_: function(e) {
if (e.wheelDeltaY == 0)
return;
- this.handleMouseWheel(e);
- e.preventDefault();
- e.stopPropagation();
+ this.content_.scrollTop -= e.wheelDeltaY / 3;
+
+ // Prevent the event from triggering the default scroll behavior on this
+ // element.
+ for (var el = e.target; el; el = el.parentNode) {
+ if (el == this) {
+ e.preventDefault();
+ break;
+ }
+ }
},
/**

Powered by Google App Engine
This is Rietveld 408576698