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/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/native_theme/native_theme.h" | 10 #include "ui/native_theme/native_theme.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 processed = vert_sb_->OnKeyPressed(event); | 347 processed = vert_sb_->OnKeyPressed(event); |
348 | 348 |
349 if (!processed && horiz_sb_->visible()) | 349 if (!processed && horiz_sb_->visible()) |
350 processed = horiz_sb_->OnKeyPressed(event); | 350 processed = horiz_sb_->OnKeyPressed(event); |
351 | 351 |
352 return processed; | 352 return processed; |
353 } | 353 } |
354 | 354 |
355 bool ScrollView::OnMouseWheel(const ui::MouseWheelEvent& e) { | 355 bool ScrollView::OnMouseWheel(const ui::MouseWheelEvent& e) { |
356 bool processed = false; | 356 bool processed = false; |
357 // Give vertical scrollbar priority | 357 |
358 if (vert_sb_->visible()) | 358 if (vert_sb_->visible()) |
359 processed = vert_sb_->OnMouseWheel(e); | 359 processed = vert_sb_->OnMouseWheel(e); |
360 | 360 |
361 if (!processed && horiz_sb_->visible()) | 361 if (horiz_sb_->visible()) |
Andre
2014/08/29 23:31:35
BaseScrollBar::OnMouseWheel() always returns true
| |
362 processed = horiz_sb_->OnMouseWheel(e); | 362 processed = horiz_sb_->OnMouseWheel(e) || processed; |
363 | 363 |
364 return processed; | 364 return processed; |
365 } | 365 } |
366 | 366 |
367 void ScrollView::OnMouseEntered(const ui::MouseEvent& event) { | 367 void ScrollView::OnMouseEntered(const ui::MouseEvent& event) { |
368 if (horiz_sb_) | 368 if (horiz_sb_) |
369 horiz_sb_->OnMouseEnteredScrollView(event); | 369 horiz_sb_->OnMouseEnteredScrollView(event); |
370 if (vert_sb_) | 370 if (vert_sb_) |
371 vert_sb_->OnMouseEnteredScrollView(event); | 371 vert_sb_->OnMouseEnteredScrollView(event); |
372 } | 372 } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 | 635 |
636 VariableRowHeightScrollHelper::RowInfo | 636 VariableRowHeightScrollHelper::RowInfo |
637 FixedRowHeightScrollHelper::GetRowInfo(int y) { | 637 FixedRowHeightScrollHelper::GetRowInfo(int y) { |
638 if (y < top_margin_) | 638 if (y < top_margin_) |
639 return RowInfo(0, top_margin_); | 639 return RowInfo(0, top_margin_); |
640 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, | 640 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, |
641 row_height_); | 641 row_height_); |
642 } | 642 } |
643 | 643 |
644 } // namespace views | 644 } // namespace views |
OLD | NEW |