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

Side by Side Diff: chrome/browser/resources/ntp4/page_list_view.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview PageListView implementation. 6 * @fileoverview PageListView implementation.
7 * PageListView manages page list, dot list, switcher buttons and handles apps 7 * PageListView manages page list, dot list, switcher buttons and handles apps
8 * pages callbacks from backend. 8 * pages callbacks from backend.
9 * 9 *
10 * Note that you need to have AppLauncherHandler in your WebUI to use this code. 10 * Note that you need to have AppLauncherHandler in your WebUI to use this code.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 e.preventDefault(); 174 e.preventDefault();
175 }, true); 175 }, true);
176 176
177 this.tilePages = this.pageList.getElementsByClassName('tile-page'); 177 this.tilePages = this.pageList.getElementsByClassName('tile-page');
178 this.appsPages = this.pageList.getElementsByClassName('apps-page'); 178 this.appsPages = this.pageList.getElementsByClassName('apps-page');
179 179
180 // Initialize the cardSlider without any cards at the moment 180 // Initialize the cardSlider without any cards at the moment
181 this.sliderFrame = cardSliderFrame; 181 this.sliderFrame = cardSliderFrame;
182 this.cardSlider = new cr.ui.CardSlider(this.sliderFrame, this.pageList, 182 this.cardSlider = new cr.ui.CardSlider(this.sliderFrame, this.pageList,
183 this.sliderFrame.offsetWidth); 183 this.sliderFrame.offsetWidth);
184 this.cardSlider.initialize(); 184
185 // Attaching *any* listener for mousewheel will prevent two-finger swipe
Nico 2012/04/17 23:22:35 Only if the listener does event.preventDefault(),
Patrick Dubroy 2012/04/18 14:43:06 Hmmm, you're right. I had a test that I thought sh
186 // gestures on Mac OS from working, so don't add the listeners if that
187 // feature is enabled.
188 var ignoreMouseWheelEvents =
189 templateData.isSwipeTrackingFromScrollEventsEnabled;
190 this.cardSlider.initialize(ignoreMouseWheelEvents);
191
192 // Handle mousewheel events anywhere in the card slider, so that wheel
193 // events on the page switchers will still scroll the page.
194 if (!ignoreMouseWheelEvents) {
195 var cardSlider = this.cardSlider;
196 cardSliderFrame.addEventListener('mousewheel', function(e) {
197 cardSlider.currentCardValue.handleMouseWheel(e);
198 });
199 }
185 200
186 // Handle events from the card slider. 201 // Handle events from the card slider.
187 this.pageList.addEventListener('cardSlider:card_changed', 202 this.pageList.addEventListener('cardSlider:card_changed',
188 this.onCardChanged_.bind(this)); 203 this.onCardChanged_.bind(this));
189 this.pageList.addEventListener('cardSlider:card_added', 204 this.pageList.addEventListener('cardSlider:card_added',
190 this.onCardAdded_.bind(this)); 205 this.onCardAdded_.bind(this));
191 this.pageList.addEventListener('cardSlider:card_removed', 206 this.pageList.addEventListener('cardSlider:card_removed',
192 this.onCardRemoved_.bind(this)); 207 this.onCardRemoved_.bind(this));
193 208
194 // Ensure the slider is resized appropriately with the window 209 // Ensure the slider is resized appropriately with the window
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 if (page.navigationDot) 736 if (page.navigationDot)
722 page.navigationDot.remove(opt_animate); 737 page.navigationDot.remove(opt_animate);
723 this.cardSlider.removeCard(page); 738 this.cardSlider.removeCard(page);
724 }, 739 },
725 }; 740 };
726 741
727 return { 742 return {
728 PageListView: PageListView 743 PageListView: PageListView
729 }; 744 };
730 }); 745 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698