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

Side by Side Diff: ui/views/controls/scroll_view.cc

Issue 2454323002: MacViews: Reveal scrollbars when resting on the trackpad. (Closed)
Patch Set: rebase for r432358 Created 4 years, 1 month 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
« no previous file with comments | « ui/events/test/event_generator.cc ('k') | ui/views/controls/scroll_view_unittest.cc » ('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/scroll_view.h" 5 #include "ui/views/controls/scroll_view.h"
6 6
7 #include "base/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 processed = vert_sb_->OnMouseWheel(e); 451 processed = vert_sb_->OnMouseWheel(e);
452 452
453 if (horiz_sb_->visible()) 453 if (horiz_sb_->visible())
454 processed = horiz_sb_->OnMouseWheel(e) || processed; 454 processed = horiz_sb_->OnMouseWheel(e) || processed;
455 455
456 return processed; 456 return processed;
457 } 457 }
458 458
459 void ScrollView::OnScrollEvent(ui::ScrollEvent* event) { 459 void ScrollView::OnScrollEvent(ui::ScrollEvent* event) {
460 #if defined(OS_MACOSX) 460 #if defined(OS_MACOSX)
461 if (!contents_)
462 return;
463
461 // TODO(tapted): Send |event| to a cc::InputHandler. For now, there's nothing 464 // TODO(tapted): Send |event| to a cc::InputHandler. For now, there's nothing
462 // to do because Widget::OnScrollEvent() will automatically process an 465 // to do because Widget::OnScrollEvent() will automatically process an
463 // unhandled ScrollEvent as a MouseWheelEvent. 466 // unhandled ScrollEvent as a MouseWheelEvent.
467
468 // A direction might not be known when the event stream starts, notify both
469 // scrollbars that they may be about scroll, or that they may need to cancel
470 // UI feedback once the scrolling direction is known.
471 if (horiz_sb_)
472 horiz_sb_->ObserveScrollEvent(*event);
473 if (vert_sb_)
474 vert_sb_->ObserveScrollEvent(*event);
464 #endif 475 #endif
465 } 476 }
466 477
467 void ScrollView::OnGestureEvent(ui::GestureEvent* event) { 478 void ScrollView::OnGestureEvent(ui::GestureEvent* event) {
468 // If the event happened on one of the scrollbars, then those events are 479 // If the event happened on one of the scrollbars, then those events are
469 // sent directly to the scrollbars. Otherwise, only scroll events are sent to 480 // sent directly to the scrollbars. Otherwise, only scroll events are sent to
470 // the scrollbars. 481 // the scrollbars.
471 bool scroll_event = event->type() == ui::ET_GESTURE_SCROLL_UPDATE || 482 bool scroll_event = event->type() == ui::ET_GESTURE_SCROLL_UPDATE ||
472 event->type() == ui::ET_GESTURE_SCROLL_BEGIN || 483 event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
473 event->type() == ui::ET_GESTURE_SCROLL_END || 484 event->type() == ui::ET_GESTURE_SCROLL_END ||
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 782
772 VariableRowHeightScrollHelper::RowInfo 783 VariableRowHeightScrollHelper::RowInfo
773 FixedRowHeightScrollHelper::GetRowInfo(int y) { 784 FixedRowHeightScrollHelper::GetRowInfo(int y) {
774 if (y < top_margin_) 785 if (y < top_margin_)
775 return RowInfo(0, top_margin_); 786 return RowInfo(0, top_margin_);
776 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, 787 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
777 row_height_); 788 row_height_);
778 } 789 }
779 790
780 } // namespace views 791 } // namespace views
OLDNEW
« no previous file with comments | « ui/events/test/event_generator.cc ('k') | ui/views/controls/scroll_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698