Commit 5d4468b7 authored by vollick@chromium.org's avatar vollick@chromium.org

Use correct proportion when computing the thumb length

This CL checks used total size before computing the thumb
size. If it's zero, we'll show no thumb.

BUG=421869

Review URL: https://codereview.chromium.org/662593004

git-svn-id: svn://svn.chromium.org/blink/trunk@183919 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ffaa2984
......@@ -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));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment