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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp

Issue 1601303003: Fix smooth scroll overshooting when mouse held down in scrollbar track. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 int ScrollbarThemeOverlay::scrollbarMargin() const 66 int ScrollbarThemeOverlay::scrollbarMargin() const
67 { 67 {
68 return m_scrollbarMargin; 68 return m_scrollbarMargin;
69 } 69 }
70 70
71 bool ScrollbarThemeOverlay::usesOverlayScrollbars() const 71 bool ScrollbarThemeOverlay::usesOverlayScrollbars() const
72 { 72 {
73 return true; 73 return true;
74 } 74 }
75 75
76 int ScrollbarThemeOverlay::thumbPosition(const ScrollbarThemeClient& scrollbar) 76 int ScrollbarThemeOverlay::thumbPosition(const ScrollbarThemeClient& scrollbar, float scrollPosition)
77 { 77 {
78 if (!scrollbar.totalSize()) 78 if (!scrollbar.totalSize())
79 return 0; 79 return 0;
80 80
81 int trackLen = trackLength(scrollbar); 81 int trackLen = trackLength(scrollbar);
82 float proportion = static_cast<float>(scrollbar.currentPos()) / scrollbar.to talSize(); 82 float proportion = static_cast<float>(scrollPosition) / scrollbar.totalSize( );
83 return round(proportion * trackLen); 83 return round(proportion * trackLen);
84 } 84 }
85 85
86 int ScrollbarThemeOverlay::thumbLength(const ScrollbarThemeClient& scrollbar) 86 int ScrollbarThemeOverlay::thumbLength(const ScrollbarThemeClient& scrollbar)
87 { 87 {
88 int trackLen = trackLength(scrollbar); 88 int trackLen = trackLength(scrollbar);
89 89
90 if (!scrollbar.totalSize()) 90 if (!scrollbar.totalSize())
91 return trackLen; 91 return trackLen;
92 92
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 return ScrollbarTheme::hitTest(scrollbar, position); 171 return ScrollbarTheme::hitTest(scrollbar, position);
172 } 172 }
173 173
174 ScrollbarThemeOverlay& ScrollbarThemeOverlay::mobileTheme() 174 ScrollbarThemeOverlay& ScrollbarThemeOverlay::mobileTheme()
175 { 175 {
176 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, (3, 3, ScrollbarThemeOverl ay::DisallowHitTest, Color(128, 128, 128, 128))); 176 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, (3, 3, ScrollbarThemeOverl ay::DisallowHitTest, Color(128, 128, 128, 128)));
177 return theme; 177 return theme;
178 } 178 }
179 179
180 } // namespace blink 180 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698