New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 633602 link

Starred by 7 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Scrollbars aren't removed unless content shrinks to the size of the scrollable minus the width of a scrollbar

Reported by joolscha...@gmail.com, Aug 2 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36

Example URL:
https://jsfiddle.net/JoolsCaesar/mr5k477t/

Steps to reproduce the problem:
1. Navigate to jsfiddle above
2. Use buttons to change content size
3. Press "Tiny", "Small", "Goldilocks", "Big", "Goldilocks", "Small" "Tiny"

What is the expected behavior?
The scrollbars should disappear whenever you press "Small" or "Goldilocks", even if you previously press "Big".

What went wrong?
Scrollbars won't disappear until you press "Tiny" because this makes the content 20px (> a 17px scrollbar) less than the scrollable div.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 52.0.2743.82  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 22.0 r0

Works properly in Firefox, IE11, Edge
 

Comment 1 by kochi@chromium.org, Aug 3 2016

Components: -Blink Blink>Layout>Scrollbars
Status: Available (was: Unconfirmed)
The reproduction confirmed.

This seems to have become even more broken in the latest release of Chrome. Once you make the content too big for the container, removing the scroll bars by shrinking the content has essentially become a brain teaser. You have to play with the different content heights switching from one unnecessary scrollbar to another until your unnecessary scrollbar is a horizontal one and then hit "Tiny".
Chrome scrollbars.gif
122 KB View Download
^ That's an animated gif btw. You'll need to click through to view it.
Fortunately in my case I have complete control over the size of the content and scrollable so I was able to use this workaround, which just sets the overflow to hidden whenever I know there shouldn't be scrollbars. Adding it here in case it's useful to anyone waiting for a fix:

https://jsfiddle.net/JoolsCaesar/mr5k477t/2/

Obviously this will only work if your content doesn't have any overflow and if you want to support a dynamic sized viewer, you'll need to run it in some kind of resize handler.


I've just realised that my jsfiddle reveals a second bug, which is probably related to the worsening of the original bug. Chrome has stopped detecting when you should have scrollbars, rather than just failing to detect when you shouldn't have them. 

If you click the "Big" button in the original jsfiddle (https://jsfiddle.net/JoolsCaesar/mr5k477t/), you should get both horizontal and vertical scrollbars. This is because the introduction of the vertical scrollbar means that your view narrow enough to require a horizontal scrollbar. However Chrome only gives you a vertical scrollbar and if you inspect the content element in the debugger, you will see that there is a portion of it that you can't view.

All other major browsers give you both horizontal and vertical scrollbars.
Raised https://bugs.chromium.org/p/chromium/issues/detail?id=652694 to cover bug of false negatives in scrollbar detection.
Cc: skobes@chromium.org szager@chromium.org
Labels: Hotlist-Interop
This works in Firefox and Internet Explorer 11. Interoperability issue.
Project Member

Comment 9 by sheriffbot@chromium.org, Oct 20 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 10 by e...@chromium.org, Oct 30 2017

Owner: szager@chromium.org
Status: Assigned (was: Untriaged)
press Big, we shall see vertical scrollbar as the height changes to 110, now press Goldilocks we expect no scrollbars should be present as height resumes back to 100. Instead, we observe horizontal scrollbar without thumb been created.

Reason:

In UpdateAfterLayout for LayoutBlockFlow DIV id='scroller' , computeScrollbarExistence , computes needs_horizontal_scrollbar as true, because of which we create the horizontalScrollbar.

Now again because of in_overflow_relayout_, we UpdateAfterLayout, now this time we recompute scrollbar existence, now it computes needs_horizontal_scrollbar as false. But this is not applied because scrollbars are frozen in the overflow relayout.

  scrollbars_are_frozen = true as in_overflow_relayout_ = true;
  scrollbars_will_change is false though horizontal_scrollbar_should_change is true;
  as scrollbars_will_change is false we are not able to destory createdHorizontalScrollbar.

  bool scrollbars_are_frozen =
      (in_overflow_relayout_ && !allow_second_overflow_relayout_) ||
      FreezeScrollbarsScope::ScrollbarsAreFrozen();
  allow_second_overflow_relayout_ = false; // 


  bool scrollbars_will_change =
      !scrollbars_are_frozen &&
      (horizontal_scrollbar_should_change || vertical_scrollbar_should_change);

  if (scrollbars_will_change) {
      SetHasHorizontalScrollbar(needs_horizontal_scrollbar);
      SetHasVerticalScrollbar(needs_vertical_scrollbar);
   }


Owner: satay...@samsung.com
Status: Started (was: Assigned)
https://chromium-review.googlesource.com/c/chromium/src/+/750530
Cc: pdr@chromium.org
Implementing 

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp?rcl=db884f9b13453f9401433df7784f5838cbad96b6&l=1366

  // TODO(pdr): Extend this logic to work with all overflow boxes.

This TODO could solve the problem. overflow:auto scrollbars are not removed in the first layout for the div scrollbar. wdyt ?
I made a fixup @ https://chromium-review.googlesource.com/c/chromium/src/+/750530

please share inputs on this.


Project Member

Comment 15 by bugdroid1@chromium.org, Nov 21 2017

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

commit d846997cba4ba0b47e521aa30a3fcdf7f4afbe20
Author: MuVen <sataya.m@samsung.com>
Date: Tue Nov 21 06:51:59 2017

Create scrollbar's if scroll size is greater than visible size.

Create scrollbar's if scroll width/height is greater than the visible
size width/height with scrollbars.

Bug:  633602 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Iccbda9a28c4406868a31be3691b729678ab6644f
Reviewed-on: https://chromium-review.googlesource.com/750530
Commit-Queue: Mu Ven <sataya.m@samsung.com>
Reviewed-by: Stefan Zager <szager@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518159}
[add] https://crrev.com/d846997cba4ba0b47e521aa30a3fcdf7f4afbe20/third_party/WebKit/LayoutTests/scrollbars/destroy-scrollbar-if-scrollsizes-lesser-than-contentsizes.html
[modify] https://crrev.com/d846997cba4ba0b47e521aa30a3fcdf7f4afbe20/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Project Member

Comment 16 by bugdroid1@chromium.org, Nov 21 2017

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

commit 264ffbd68fbac550b9d953b4a793aa7db9bb5d92
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Tue Nov 21 08:55:22 2017

Revert "Create scrollbar's if scroll size is greater than visible size."

This reverts commit d846997cba4ba0b47e521aa30a3fcdf7f4afbe20.

Reason for revert: Speculatively revert to make bots green

Original change's description:
> Create scrollbar's if scroll size is greater than visible size.
> 
> Create scrollbar's if scroll width/height is greater than the visible
> size width/height with scrollbars.
> 
> Bug:  633602 
> Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
> Change-Id: Iccbda9a28c4406868a31be3691b729678ab6644f
> Reviewed-on: https://chromium-review.googlesource.com/750530
> Commit-Queue: Mu Ven <sataya.m@samsung.com>
> Reviewed-by: Stefan Zager <szager@chromium.org>
> Reviewed-by: Philip Rogers <pdr@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#518159}

TBR=szager@chromium.org,pdr@chromium.org,skobes@chromium.org,sataya.m@samsung.com

Change-Id: If60bcbbfd28448c15166c09a1ea625b4318b194f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  633602 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Reviewed-on: https://chromium-review.googlesource.com/781559
Reviewed-by: Takeshi Yoshino <tyoshino@chromium.org>
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518187}
[delete] https://crrev.com/97f486c4cd3842ef0982e8b3c61e8d3ce7094e43/third_party/WebKit/LayoutTests/scrollbars/destroy-scrollbar-if-scrollsizes-lesser-than-contentsizes.html
[modify] https://crrev.com/264ffbd68fbac550b9d953b4a793aa7db9bb5d92/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Project Member

Comment 17 by bugdroid1@chromium.org, Nov 23 2017

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

commit 85c962694ffc1db6310c5eafce79e9ce9f05915a
Author: MuVen <sataya.m@samsung.com>
Date: Thu Nov 23 04:43:20 2017

Create scrollbar's if scroll size is greater than visible size.

Create scrollbar's if scroll width/height is greater than the visible
size width/height with scrollbars.

Bug:  633602 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: If57417a92493b6445eb6948eb99ce5e7e1d23b0b
Reviewed-on: https://chromium-review.googlesource.com/781639
Commit-Queue: Mu Ven <sataya.m@samsung.com>
Reviewed-by: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518850}
[add] https://crrev.com/85c962694ffc1db6310c5eafce79e9ce9f05915a/third_party/WebKit/LayoutTests/scrollbars/destroy-scrollbar-if-scrollsizes-lesser-than-contentsizes.html
[modify] https://crrev.com/85c962694ffc1db6310c5eafce79e9ce9f05915a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Status: Fixed (was: Started)

Sign in to add a comment