New issue
Advanced search Search tips

Issue 644463 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Bounded ScrollView Display Unnecessary Scroll Bars

Project Member Reported by qiangchen@chromium.org, Sep 6 2016

Issue description

By code reading, I found:

In [1], it set content_width to be the width of the ScrollView control.
In [2], it set viewport_bounds.width to be the content_width - 2 * border width. (Look into the implementation of GetContentBounds)

Then if in [3], the content view's Layout() function does not SetSize explicitly, a horizontal bar will be always visible, because the viewport_bounds.width < content_width.

Then look at [4], we compared |content_height| with |viewport_bounds.height - scroll_bar.height| to determine whether displaying vertical bar. So if the content just fill the container exactly, a vertical bar will be visible.


[1]https://cs.chromium.org/chromium/src/ui/views/controls/scroll_view.cc?q=scrollview&sq=package:chromium&l=298
[2]https://cs.chromium.org/chromium/src/ui/views/controls/scroll_view.cc?q=scrollview&sq=package:chromium&l=316
[3]https://cs.chromium.org/chromium/src/ui/views/controls/scroll_view.cc?q=scrollview&sq=package:chromium&l=343
[4]https://cs.chromium.org/chromium/src/ui/views/controls/scroll_view.cc?sq=package:chromium&rcl=1472733616&l=603
 
Cc: -qiangchen@chromium.org
Owner: qiangchen@chromium.org
Status: Assigned (was: Available)
Status: Fixed (was: Assigned)
Project Member

Comment 3 by bugdroid1@chromium.org, Sep 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8234584f65628f5f8c43341eaaa94dd0b1681f50

commit 8234584f65628f5f8c43341eaaa94dd0b1681f50
Author: qiangchen <qiangchen@chromium.org>
Date: Fri Sep 09 20:58:36 2016

Bug Fix: ScrollView Shows Unnecessary Scrollbar

1. For bounded ScrollView, if its content view does not call SetSize() explicitly in the Layout() implementation, horizontal scroll bar will always be visible even if no overflow.

2. With |hide_horizontal_scrollbar_| set to true, we may find that the vertical bar visible when the content height is equal to the container height.

This CL fixes the bugs.

BUG= 644463 

Review-Url: https://codereview.chromium.org/2324043002
Cr-Commit-Position: refs/heads/master@{#417704}

[modify] https://crrev.com/8234584f65628f5f8c43341eaaa94dd0b1681f50/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.cc
[modify] https://crrev.com/8234584f65628f5f8c43341eaaa94dd0b1681f50/ui/views/controls/scroll_view.cc
[modify] https://crrev.com/8234584f65628f5f8c43341eaaa94dd0b1681f50/ui/views/controls/scroll_view_unittest.cc

Sign in to add a comment