Bug 161611 - Support ScrollIntoViewOptions for Element.scrollIntoView
Summary: Support ScrollIntoViewOptions for Element.scrollIntoView
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: http://w3c-test.org/css/cssom-view/sc...
Keywords: WebExposed
: 167336 196787 (view as bug list)
Depends on: 189258
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-05 11:42 PDT by Simon Fraser (smfr)
Modified: 2019-04-12 17:52 PDT (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Simon Fraser (smfr) 2017-01-25 07:23:04 PST
*** Bug 167336 has been marked as a duplicate of this bug. ***
Comment 2 Justin Mecham 2017-01-25 07:35:51 PST
(In reply to comment #1)
> *** Bug 167336 has been marked as a duplicate of this bug. ***

I'm not certain this is a duplicate, although implementation of this bug (161611) would also allow the `scroll-behavior` CSS to be implemented. My apologies for filing a separate issue if this was understood.
Comment 3 Simon Pieters 2017-09-12 04:10:42 PDT
Also see https://github.com/w3c/csswg-drafts/pull/1505
Comment 4 jonjohnjohnson 2018-04-09 17:56:53 PDT
Just want to ensure general history traversal is affected with webkits implementation
https://github.com/w3c/csswg-drafts/issues/2454
Comment 5 Frédéric Wang (:fredw) 2018-07-26 06:49:15 PDT
(In reply to Justin Mecham from comment #2)
> (In reply to comment #1)
> > *** Bug 167336 has been marked as a duplicate of this bug. ***
> 
> I'm not certain this is a duplicate, although implementation of this bug
> (161611) would also allow the `scroll-behavior` CSS to be implemented. My
> apologies for filing a separate issue if this was understood.

I personally don't think it was a duplicate. The `scroll-behavior` and ScrollBehavior could probably be implemented independently but it makes sense to do them together, given that the hard part is really doing smooth scrolling, not parsing new CSS properties or DOM parameter. I opened a separate bug 188043 for that.

ScrollIntoViewOptions has some ScrollLogicalPosition parameters to specify alignments, which I think can be implemented here independently of the scroll behavior feature (and vice-versa), similarly to what was done in bug 161610 for ScrollToOptions.
Comment 6 Frédéric Wang (:fredw) 2018-09-04 00:24:39 PDT
(In reply to Frédéric Wang (:fredw) from comment #5)
> ScrollIntoViewOptions has some ScrollLogicalPosition parameters to specify
> alignments, which I think can be implemented here independently of the
> scroll behavior feature (and vice-versa), similarly to what was done in bug
> 161610 for ScrollToOptions.

So thinking about it, I think it will be more convenient to introduce ScrollIntoViewOptions before implementing scroll-behavior.

I think this can be a first basic implementation (that maybe does not match exactly CSSOM View): just map block/inline parameters into the proper parameters of scrollRectToVisible, with "nearest" interpreted as ScrollAlignment::alignToEdgeIfNeeded and perhaps ignoring directionality/orientation for now. This would at least make thing compatible with the current one-parameter implementation and avoid losing the alignment features when one passes ScrollBehavior.
Comment 7 Frédéric Wang (:fredw) 2018-09-12 07:23:36 PDT
Random thought for whoever is going to work on this: Converting logical to non-logical alignments as currently done in Element::scrollIntoView won't probably work in the general case (i.e. if we have nested scrollable elements with different orientation/direction). Instead my guess is that ScrollRectToVisibleOptions should contain the logicial alignments and RenderLayer::scrollRectToVisible should interpret them for each scrollable ancestor according to the applied style.
Comment 8 Frédéric Wang (:fredw) 2018-09-17 02:22:41 PDT
We should import WPT test css/cssom-view/scrollIntoView-vertical-rl-writing-mode.html
Comment 9 Frédéric Wang (:fredw) 2019-04-12 17:52:42 PDT
*** Bug 196787 has been marked as a duplicate of this bug. ***