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)); |