| OLD | NEW |
| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 449 |
| 450 if (vert_sb_->visible()) | 450 if (vert_sb_->visible()) |
| 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::OnMouseEntered(const ui::MouseEvent& event) { | |
| 460 if (horiz_sb_) | |
| 461 horiz_sb_->OnMouseEnteredScrollView(event); | |
| 462 if (vert_sb_) | |
| 463 vert_sb_->OnMouseEnteredScrollView(event); | |
| 464 } | |
| 465 | |
| 466 void ScrollView::OnMouseExited(const ui::MouseEvent& event) { | |
| 467 if (horiz_sb_) | |
| 468 horiz_sb_->OnMouseExitedScrollView(event); | |
| 469 if (vert_sb_) | |
| 470 vert_sb_->OnMouseExitedScrollView(event); | |
| 471 } | |
| 472 | |
| 473 void ScrollView::OnScrollEvent(ui::ScrollEvent* event) { | 459 void ScrollView::OnScrollEvent(ui::ScrollEvent* event) { |
| 474 #if defined(OS_MACOSX) | 460 #if defined(OS_MACOSX) |
| 475 // TODO(tapted): Send |event| to a cc::InputHandler. For now, there's nothing | 461 // TODO(tapted): Send |event| to a cc::InputHandler. For now, there's nothing |
| 476 // to do because Widget::OnScrollEvent() will automatically process an | 462 // to do because Widget::OnScrollEvent() will automatically process an |
| 477 // unhandled ScrollEvent as a MouseWheelEvent. | 463 // unhandled ScrollEvent as a MouseWheelEvent. |
| 478 #endif | 464 #endif |
| 479 } | 465 } |
| 480 | 466 |
| 481 void ScrollView::OnGestureEvent(ui::GestureEvent* event) { | 467 void ScrollView::OnGestureEvent(ui::GestureEvent* event) { |
| 482 // If the event happened on one of the scrollbars, then those events are | 468 // If the event happened on one of the scrollbars, then those events are |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 771 |
| 786 VariableRowHeightScrollHelper::RowInfo | 772 VariableRowHeightScrollHelper::RowInfo |
| 787 FixedRowHeightScrollHelper::GetRowInfo(int y) { | 773 FixedRowHeightScrollHelper::GetRowInfo(int y) { |
| 788 if (y < top_margin_) | 774 if (y < top_margin_) |
| 789 return RowInfo(0, top_margin_); | 775 return RowInfo(0, top_margin_); |
| 790 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, | 776 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, |
| 791 row_height_); | 777 row_height_); |
| 792 } | 778 } |
| 793 | 779 |
| 794 } // namespace views | 780 } // namespace views |
| OLD | NEW |