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

Unified Diff: Source/platform/scroll/ScrollbarTheme.cpp

Issue 662593004: Use correct proportion when computing the thumb length (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ScrollbarTheme.cpp
diff --git a/Source/platform/scroll/ScrollbarTheme.cpp b/Source/platform/scroll/ScrollbarTheme.cpp
index 075fdc2030a56eb46aeff03beb33caf9e4ed1d14..dad7555f608770521dcc7b04816b9c1aa65e28fb 100644
--- a/Source/platform/scroll/ScrollbarTheme.cpp
+++ b/Source/platform/scroll/ScrollbarTheme.cpp
@@ -268,7 +268,11 @@ int ScrollbarTheme::thumbLength(ScrollbarThemeClient* scrollbar)
overhang = -scrollbar->currentPos();
else if (scrollbar->visibleSize() + scrollbar->currentPos() > scrollbar->totalSize())
overhang = scrollbar->currentPos() + scrollbar->visibleSize() - scrollbar->totalSize();
- float proportion = (scrollbar->visibleSize() - overhang) / usedTotalSize(scrollbar);
+ float proportion = 0.0f;
+ float totalSize = usedTotalSize(scrollbar);
+ if (totalSize > 0.0f) {
+ proportion = (scrollbar->visibleSize() - overhang) / totalSize;
+ }
int trackLen = trackLength(scrollbar);
int length = round(proportion * trackLen);
length = std::max(length, minimumThumbLength(scrollbar));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698