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

Unified Diff: ui/views/controls/scroll_view.cc

Issue 16171010: Introduces a new scrollbar for message_center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/scroll_view.cc
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc
index 3659c35c5db45f75e4a9b98a4ce11debcdaaa410..55211874f9381ebf227518ad3f2996fd0dad9d64 100644
--- a/ui/views/controls/scroll_view.cc
+++ b/ui/views/controls/scroll_view.cc
@@ -117,6 +117,8 @@ ScrollView::ScrollView()
vert_sb_(new NativeScrollBar(false)),
resize_corner_(NULL),
hide_horizontal_scrollbar_(false) {
+ set_notify_enter_exit_on_child(true);
+
AddChildView(contents_viewport_);
AddChildView(header_viewport_);
@@ -252,15 +254,19 @@ void ScrollView::Layout() {
}
if (horiz_sb_required) {
+ int horiz_sb_visible_height = horiz_sb_->GetVisibleSize();
+ int height_offset = horiz_sb_visible_height - horiz_sb_height;
horiz_sb_->SetBounds(0,
- viewport_bounds.bottom(),
+ viewport_bounds.bottom() - height_offset,
viewport_bounds.right(),
- horiz_sb_height);
+ horiz_sb_visible_height);
}
if (vert_sb_required) {
- vert_sb_->SetBounds(viewport_bounds.right(),
+ int vert_sb_visible_width = vert_sb_->GetVisibleSize();
+ int width_offset = vert_sb_visible_width - vert_sb_width;
+ vert_sb_->SetBounds(viewport_bounds.right() - width_offset,
0,
- vert_sb_width,
+ vert_sb_visible_width,
viewport_bounds.bottom());
}
if (resize_corner_required) {
@@ -312,6 +318,20 @@ bool ScrollView::OnMouseWheel(const ui::MouseWheelEvent& e) {
return processed;
}
+void ScrollView::OnMouseEntered(const ui::MouseEvent& event) {
+ if (horiz_sb_)
+ horiz_sb_->OnMouseEnteredScrollView(event);
+ if (vert_sb_)
+ vert_sb_->OnMouseEnteredScrollView(event);
+}
+
+void ScrollView::OnMouseExited(const ui::MouseEvent& event) {
+ if (horiz_sb_)
+ horiz_sb_->OnMouseExitedScrollView(event);
+ if (vert_sb_)
+ vert_sb_->OnMouseExitedScrollView(event);
+}
+
void ScrollView::OnGestureEvent(ui::GestureEvent* event) {
// If the event happened on one of the scrollbars, then those events are
// sent directly to the scrollbars. Otherwise, only scroll events are sent to

Powered by Google App Engine
This is Rietveld 408576698