New issue
Advanced search Search tips

Issue 890345 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug

Blocked on:
issue 414283



Sign in to add a comment

Can't set scrollTop value precisely if zoom setting is not 100%

Reported by d.alexa...@gmail.com, Sep 28

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

Steps to reproduce the problem:
1. Change browser Zoom setting to 110%
2. Create scrollable container with scrollHeight more than clientHeight enough
3. Set scrollTop programmatically to some value (75)
4. Read scrollTop value

What is the expected behavior?
The results of (3) and (4) must be the same. Setting viewport.scrollTop = 75 must lead to "75" when console.log(viewport.scrollTop) right after the assignment.

What went wrong?
The results of (3) and (4) are different depend on Zoom setting:

50%	  -   74
75%	  -   74.66666412353516
80%  -   75
90%  -   74.44444274902344
100%  -  75
110%  -   74.54545593261719
125%  -   74.4000015258789
150%  -   74.66666412353516
175%  -   74.85713958740234
200% -   75

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 69.0.3497.100  Channel: stable
OS Version: OS X 10.13.6
Flash Version: 

I created demo: https://jsfiddle.net/dhilt/mo4zveka/27/
Just change zoom and run it.

Also, here is the stackoverflow post: https://stackoverflow.com/questions/52470549/subpixel-scroll-issue-cant-set-scrolltop-properly-on-chrome-69

Chrome only issue.
 
Components: Blink>Scroll
Labels: Needs-Triage-M69
Cc: phanindra.mandapaka@chromium.org
Labels: Triaged-ET Target-71 FoundIn-71 FoundIn-70 FoundIn-69 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on reported chrome version 69.0.3497.100 also on latest chrome 71.0.3567.0 using Mac 10.13.6, Ubuntu 14.04 and Windows 10.  
 
Same behavior is seen on M60(60.0.3112.113) hence considering it as non-regression and marking it as Untriaged.

Thanks..! 
Cc: bokan@chromium.org
Owner: chaopeng@chromium.org
Status: Assigned (was: Untriaged)
This seems to be a floating error by browser zoom.

https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/dom/element.cc?rcl=9f265202bb4eb3245f8ea815c50610e9136c3f1e&l=993
I have to say that the issue could also be reproduced by the OS screen scaling.
Blockedon: 414283
This issue is because Chrome does not fully support fractional scroll offset.

See https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/dom/element.cc?rcl=9f265202bb4eb3245f8ea815c50610e9136c3f1e&l=993

```
    FloatPoint end_point(box->ScrollLeft().ToFloat(),
                         new_top * box->Style()->EffectiveZoom());
    ...
    box->SetScrollTop(LayoutUnit::FromFloatRound(end_point.Y()));
```

Here we calc the scroll with zoom then round it to a int offset.

For example with 1.25* zoom giving it 75 offset. It will actually scroll for 93 not 93.75. Then we query the scroll top it would be 93/1.25 = 74.4.

It can not be fixed before we fully support fractional scroll offset.

Sign in to add a comment