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

Side by Side Diff: ui/views/controls/menu/submenu_view.cc

Issue 11280290: events: Change gesture-event handler in EventHandler to not return any values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/menu/submenu_view.h ('k') | ui/views/controls/scroll_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/views/controls/menu/submenu_view.h" 5 #include "ui/views/controls/menu/submenu_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "ui/base/accessibility/accessible_view_state.h" 10 #include "ui/base/accessibility/accessible_view_state.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 first_vis_index++; 253 first_vis_index++;
254 } 254 }
255 ScrollRectToVisible(gfx::Rect(gfx::Point(0, scroll_target), 255 ScrollRectToVisible(gfx::Rect(gfx::Point(0, scroll_target),
256 vis_bounds.size())); 256 vis_bounds.size()));
257 vis_bounds = GetVisibleBounds(); 257 vis_bounds = GetVisibleBounds();
258 } 258 }
259 259
260 return true; 260 return true;
261 } 261 }
262 262
263 ui::EventResult SubmenuView::OnGestureEvent(ui::GestureEvent* event) { 263 void SubmenuView::OnGestureEvent(ui::GestureEvent* event) {
264 ui::EventResult to_return = ui::ER_CONSUMED; 264 bool handled = true;
265 switch (event->type()) { 265 switch (event->type()) {
266 case ui::ET_GESTURE_SCROLL_BEGIN: 266 case ui::ET_GESTURE_SCROLL_BEGIN:
267 scroll_animator_->Stop(); 267 scroll_animator_->Stop();
268 break; 268 break;
269 case ui::ET_GESTURE_SCROLL_UPDATE: 269 case ui::ET_GESTURE_SCROLL_UPDATE:
270 OnScroll(0, event->details().scroll_y()); 270 OnScroll(0, event->details().scroll_y());
271 break; 271 break;
272 case ui::ET_GESTURE_SCROLL_END: 272 case ui::ET_GESTURE_SCROLL_END:
273 break; 273 break;
274 case ui::ET_SCROLL_FLING_START: 274 case ui::ET_SCROLL_FLING_START:
275 if (event->details().velocity_y() != 0.0f) 275 if (event->details().velocity_y() != 0.0f)
276 scroll_animator_->Start(0, event->details().velocity_y()); 276 scroll_animator_->Start(0, event->details().velocity_y());
277 break; 277 break;
278 case ui::ET_GESTURE_TAP_DOWN: 278 case ui::ET_GESTURE_TAP_DOWN:
279 case ui::ET_SCROLL_FLING_CANCEL: 279 case ui::ET_SCROLL_FLING_CANCEL:
280 scroll_animator_->Stop(); 280 scroll_animator_->Stop();
281 break; 281 break;
282 default: 282 default:
283 to_return = ui::ER_UNHANDLED; 283 handled = false;
284 break; 284 break;
285 } 285 }
286 return to_return; 286 if (handled)
287 event->SetHandled();
287 } 288 }
288 289
289 bool SubmenuView::IsShowing() { 290 bool SubmenuView::IsShowing() {
290 return host_ && host_->IsMenuHostVisible(); 291 return host_ && host_->IsMenuHostVisible();
291 } 292 }
292 293
293 void SubmenuView::ShowAt(Widget* parent, 294 void SubmenuView::ShowAt(Widget* parent,
294 const gfx::Rect& bounds, 295 const gfx::Rect& bounds,
295 bool do_capture) { 296 bool do_capture) {
296 if (host_) { 297 if (host_) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 int y = vis_bounds.y() - static_cast<int>(dy); 449 int y = vis_bounds.y() - static_cast<int>(dy);
449 // clamp y to [0, full_height - vis_height) 450 // clamp y to [0, full_height - vis_height)
450 y = std::max(y, 0); 451 y = std::max(y, 0);
451 y = std::min(y, full_bounds.height() - vis_bounds.height() - 1); 452 y = std::min(y, full_bounds.height() - vis_bounds.height() - 1);
452 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); 453 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height());
453 if (new_vis_bounds != vis_bounds) 454 if (new_vis_bounds != vis_bounds)
454 ScrollRectToVisible(new_vis_bounds); 455 ScrollRectToVisible(new_vis_bounds);
455 } 456 }
456 457
457 } // namespace views 458 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/submenu_view.h ('k') | ui/views/controls/scroll_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698