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

Unified Diff: ui/views/controls/scrollbar/overlay_scroll_bar.cc

Issue 2555973002: Views (native UI) overlay scrollbars: match blink overlay scrollbar (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « ui/views/controls/scrollbar/overlay_scroll_bar.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scrollbar/overlay_scroll_bar.cc
diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.cc b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
index a3403610edff8a1335f5a3fa96baebb0a871a211..358a0974db2940ff8de695f90d7486fdc5d0e417 100644
--- a/ui/views/controls/scrollbar/overlay_scroll_bar.cc
+++ b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
@@ -136,8 +136,28 @@ int OverlayScrollBar::GetContentOverlapSize() const {
return kThumbThickness;
}
+void OverlayScrollBar::Layout() {
+ gfx::Rect thumb_bounds = GetTrackBounds();
+ BaseScrollBarThumb* thumb = GetThumb();
+ if (IsHorizontal()) {
+ thumb_bounds.set_x(thumb->x());
+ thumb_bounds.set_width(thumb->width());
+ } else {
+ thumb_bounds.set_y(thumb->y());
+ thumb_bounds.set_height(thumb->height());
+ }
+ thumb->SetBoundsRect(thumb_bounds);
+}
+
+bool OverlayScrollBar::CanAcceptEvent(const ui::Event& event) {
+ return layer()->opacity() > 0 && BaseScrollBar::CanAcceptEvent(event);
+}
+
void OverlayScrollBar::OnMouseEntered(const ui::MouseEvent& event) {
- Show();
+ // Note that events are only accepted when the scrollbar is already visible
+ // (due to a change in the scroll value). Don't let the scrollbar vanish from
+ // under the mouse pointer.
+ hide_timer_.Stop();
}
void OverlayScrollBar::OnMouseExited(const ui::MouseEvent& event) {
@@ -163,17 +183,4 @@ void OverlayScrollBar::StartHideCountdown() {
base::Bind(&OverlayScrollBar::Hide, base::Unretained(this)));
}
-void OverlayScrollBar::Layout() {
- gfx::Rect thumb_bounds = GetTrackBounds();
- BaseScrollBarThumb* thumb = GetThumb();
- if (IsHorizontal()) {
- thumb_bounds.set_x(thumb->x());
- thumb_bounds.set_width(thumb->width());
- } else {
- thumb_bounds.set_y(thumb->y());
- thumb_bounds.set_height(thumb->height());
- }
- thumb->SetBoundsRect(thumb_bounds);
-}
-
} // namespace views
« no previous file with comments | « ui/views/controls/scrollbar/overlay_scroll_bar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698