Bug 188045 - [WebIDL] Element's scrollLeft and scrollTop should be unrestricted double
Summary: [WebIDL] Element's scrollLeft and scrollTop should be unrestricted double
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 5991
  Show dependency treegraph
 
Reported: 2018-07-26 06:53 PDT by Frédéric Wang (:fredw)
Modified: 2022-08-10 10:59 PDT (History)
16 users (show)

See Also:


Attachments
Patch (4.46 KB, patch)
2018-07-26 08:17 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2018-07-26 06:53:29 PDT
Follow-up of bug 161610:

(In reply to Simon Fraser (smfr) from comment #3)
> > > Source/WebCore/dom/Element.idl:75
> > > -    attribute long scrollLeft;
> > > -    attribute long scrollTop;
> > > +    attribute long scrollLeft; // FIXME: should be unrestricted double
> > > +    attribute long scrollTop; // FIXME: should be unrestricted double
> > 
> > Seems relatively straightforward to fix this.
> 
> I didn't want to make a web-facing change here in the same patch.
Comment 1 Frédéric Wang (:fredw) 2018-07-26 08:17:38 PDT
Created attachment 345845 [details]
Patch

Just some quick patch for testing purpose...
Comment 2 Frédéric Wang (:fredw) 2018-08-31 01:36:33 PDT
> (In reply to Simon Fraser (smfr) from comment #3)
> > > > Source/WebCore/dom/Element.idl:75
> > > > -    attribute long scrollLeft;
> > > > -    attribute long scrollTop;
> > > > +    attribute long scrollLeft; // FIXME: should be unrestricted double
> > > > +    attribute long scrollTop; // FIXME: should be unrestricted double
> > > 
> > > Seems relatively straightforward to fix this.
> > 
> > I didn't want to make a web-facing change here in the same patch.

@Simon: Any idea how this change could be visible to the user? And hence whether we can can/should test it?

I tried using values larger than the max long or non-integer values, but scrollable overflow elements/frames seem to have a limited size and to round up scroll position, so that does not seem easy.
Comment 3 Emilio Cobos Álvarez (:emilio) 2020-11-02 01:44:56 PST
This should be user-visible, see https://bugzilla.mozilla.org/show_bug.cgi?id=1674687 for a test-case.

Modulo compat I'm probably going to try changing Gecko to follow the spec.
Comment 4 Rado 2021-01-15 08:58:35 PST
Please fix this, because it makes a Scroll Snap Points carousel extremely hard to achieve. Thanks.
Comment 5 Simon Fraser (smfr) 2021-01-15 09:38:25 PST
How so?
Comment 6 Rado 2021-01-15 10:30:49 PST
The container must be scrolled programmatically or with snapping to increments of its width. If the width is sub pixel, this is impossible as the browsers can only scroll to integer.
Comment 7 Ahmad Saleem 2022-08-09 13:40:13 PDT
I am able to reproduce this bug using test case from Mozilla bug:

Test case - https://bug1674687.bmoattachments.org/attachment.cgi?id=9185098

Here are outputs across browsers:

*** Safari 15.6 on macOS 12.5 ***

max scrollTop is: 50 
rect offset (real scroll top)is: 50 
dpi is: 2

*** Firefox Nightly 105 ***

max scrollTop is: 50
rect offset (real scroll top)is: 49.5
dpi is: 2

*** Chrome Canary 106 ***

max scrollTop is: 49.5
rect offset (real scroll top)is: 49.5
dpi is: 2

______

As per Mozilla bug, it should be 49.5 for both like Chrome. Just wanted to share updated testing results. Thanks!
Comment 8 Radar WebKit Bug Importer 2022-08-10 10:59:36 PDT
<rdar://problem/98460291>