New issue
Advanced search Search tips

Issue 709062 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

Android overlay scrollbars paint incorrect

Project Member Reported by chaopeng@chromium.org, Apr 6 2017

Issue description

Chrome Version: 57.0.2987.132 (32-bit)
OS: Android

Can also reproduce on Linux (git latest build) mobile emulator.

What steps will reproduce the problem?
(1) open ht.chaopeng.me

What is the expected result?
No horizontal scrollbar.

It should be works correct before.

Also I checked the log, only one SolidColorScrollbarLayer created.
 
Screenshot_20170406-111821.png
292 KB View Download

Comment 1 by bokan@chromium.org, Apr 6 2017

Does this happen on all pages or just some?
Just some.

Comment 3 by bokan@chromium.org, Apr 6 2017

Cc: -chaopeng@chromium.org
Components: Blink>Scroll
Labels: -Pri-3 Hotlist-Input-Dev OS-Android Pri-1
Owner: chaopeng@chromium.org
Status: Assigned (was: Untriaged)
This issue is a float precision related issue.

We determined do we need to apply opacity change in ScrollbarLayerImplBase::CanScrollOrientation.
https://cs.chromium.org/chromium/src/cc/layers/scrollbar_layer_impl_base.cc?l=65

Refresh:
clip_layer_length_ = 980.000000, scroll_layer_length_ = 980.000000
CanScrollOrientation return false.

Scrolling:
clip_layer_length_ = 979.999939, scroll_layer_length_ = 980.000000
CanScrollOrientation return true.

Comment 5 by bokan@chromium.org, Apr 7 2017

Can you look into why the clip layer is in fractional offsets at all? I think layer sizes are usually whole numbers - it may be related to page scale, the outer viewport is sized according to the minimum page scale factor. At least on the main thread, that's rounded up though: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/web/WebViewImpl.cpp?type=cs&l=3134

I'd guess there's a multiplication/division by page scale somewhere that isn't being properly snapped.
After Refresh, CanScrollOrientation call happens before |LayerTreeImpl::SetViewportLayersFromIds|. So it skip the pagescale division.

https://cs.chromium.org/chromium/src/cc/trees/layer_tree_impl.cc?l=242

979.999939 is from the pagescale division.

Should we just ignore the round-off error.

Comment 7 by bokan@chromium.org, Apr 7 2017

I think it'd make sense to ceil() the value, so that any error prevents scrolling rather than introduces it. Does that fix the issue?
Is it possible we really have less than 1px difference between clip_layer_length_ and scroll_layer_length_.

This method maybe more safety.
https://cs.chromium.org/chromium/src/cc/base/math_util.cc?type=cs&q=near+float+package:%5Echromium$&l=158

Comment 9 by bokan@chromium.org, Apr 7 2017

I'm not sure I see how that helps, we're not checking for equality. We already ceil these values in other places so I'm not sure it's a problem. Anyway, happy to look at a patch if you have a better idea.
Project Member

Comment 10 by bugdroid1@chromium.org, Apr 23 2017

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

commit beb19669855bab47cda70ea40fbbe154eb3bfdc5
Author: chaopeng <chaopeng@chromium.org>
Date: Sun Apr 23 23:09:55 2017

Ignore rounding error between clip_layer_length_ and scroll_layer_length_

We determined overlay scrollbar should show by comparing
clip_layer_length with scroll_layer_length of scrollbar_layer_impl.
clip_layer_length_ has rounding error form  pagescale division. The
scrollbar will appear when the rounding error makes clip_layer_length <
scroll_layer_length.

In this patch, we change to use ceil of clip length in device pixel and
floor of scroll length in device pixel for
compare. That means we only appear the scrollbar when clip_layer_length
is at least 1 physical px smaller than scroll_layer_length.

BUG= 709062 
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

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

[modify] https://crrev.com/beb19669855bab47cda70ea40fbbe154eb3bfdc5/cc/base/math_util.cc
[modify] https://crrev.com/beb19669855bab47cda70ea40fbbe154eb3bfdc5/cc/base/math_util.h
[modify] https://crrev.com/beb19669855bab47cda70ea40fbbe154eb3bfdc5/cc/base/math_util_unittest.cc
[modify] https://crrev.com/beb19669855bab47cda70ea40fbbe154eb3bfdc5/cc/layers/scrollbar_layer_impl_base.cc
[modify] https://crrev.com/beb19669855bab47cda70ea40fbbe154eb3bfdc5/cc/layers/scrollbar_layer_unittest.cc
[modify] https://crrev.com/beb19669855bab47cda70ea40fbbe154eb3bfdc5/cc/test/layer_test_common.h
[modify] https://crrev.com/beb19669855bab47cda70ea40fbbe154eb3bfdc5/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl_unittest.cc

Status: Fixed (was: Assigned)

Sign in to add a comment