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

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

Issue 2454323002: MacViews: Reveal scrollbars when resting on the trackpad. (Closed)
Patch Set: fix compile 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
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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 465
466 void ScrollView::OnMouseExited(const ui::MouseEvent& event) { 466 void ScrollView::OnMouseExited(const ui::MouseEvent& event) {
467 if (horiz_sb_) 467 if (horiz_sb_)
468 horiz_sb_->OnMouseExitedScrollView(event); 468 horiz_sb_->OnMouseExitedScrollView(event);
469 if (vert_sb_) 469 if (vert_sb_)
470 vert_sb_->OnMouseExitedScrollView(event); 470 vert_sb_->OnMouseExitedScrollView(event);
471 } 471 }
472 472
473 void ScrollView::OnScrollEvent(ui::ScrollEvent* event) { 473 void ScrollView::OnScrollEvent(ui::ScrollEvent* event) {
474 #if defined(OS_MACOSX) 474 #if defined(OS_MACOSX)
475 if (!contents_)
476 return;
477
475 // TODO(tapted): Send |event| to a cc::InputHandler. For now, there's nothing 478 // TODO(tapted): Send |event| to a cc::InputHandler. For now, there's nothing
476 // to do because Widget::OnScrollEvent() will automatically process an 479 // to do because Widget::OnScrollEvent() will automatically process an
477 // unhandled ScrollEvent as a MouseWheelEvent. 480 // unhandled ScrollEvent as a MouseWheelEvent.
481
482 // A direction might not be known when the event stream starts, notify both
483 // scrollbars that they may be about scroll, or that they may need to cancel
484 // UI feedback once the scrolling direction is known.
485 if (horiz_sb_)
486 horiz_sb_->ObserveScrollEvent(*event);
487 if (vert_sb_)
488 vert_sb_->ObserveScrollEvent(*event);
478 #endif 489 #endif
479 } 490 }
480 491
481 void ScrollView::OnGestureEvent(ui::GestureEvent* event) { 492 void ScrollView::OnGestureEvent(ui::GestureEvent* event) {
482 // If the event happened on one of the scrollbars, then those events are 493 // If the event happened on one of the scrollbars, then those events are
483 // sent directly to the scrollbars. Otherwise, only scroll events are sent to 494 // sent directly to the scrollbars. Otherwise, only scroll events are sent to
484 // the scrollbars. 495 // the scrollbars.
485 bool scroll_event = event->type() == ui::ET_GESTURE_SCROLL_UPDATE || 496 bool scroll_event = event->type() == ui::ET_GESTURE_SCROLL_UPDATE ||
486 event->type() == ui::ET_GESTURE_SCROLL_BEGIN || 497 event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
487 event->type() == ui::ET_GESTURE_SCROLL_END || 498 event->type() == ui::ET_GESTURE_SCROLL_END ||
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 796
786 VariableRowHeightScrollHelper::RowInfo 797 VariableRowHeightScrollHelper::RowInfo
787 FixedRowHeightScrollHelper::GetRowInfo(int y) { 798 FixedRowHeightScrollHelper::GetRowInfo(int y) {
788 if (y < top_margin_) 799 if (y < top_margin_)
789 return RowInfo(0, top_margin_); 800 return RowInfo(0, top_margin_);
790 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, 801 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
791 row_height_); 802 row_height_);
792 } 803 }
793 804
794 } // namespace views 805 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698