Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for background-attachment:fixed #1301

Closed
staktrace opened this issue May 29, 2017 · 3 comments
Closed

Add support for background-attachment:fixed #1301

staktrace opened this issue May 29, 2017 · 3 comments

Comments

@staktrace
Copy link
Contributor

@staktrace staktrace commented May 29, 2017

As far as I can tell the only mechanism for anything "fixed" in WR is the ScrollPolicy on stacking contexts, which looks like it is for position:fixed. We would like to handle other "fixed" things like background-attachment:fixed. Servo doesn't appear to handle background-attachment:fixed either. Here is a test page: https://mozilla.staktrace.com/bug/1368496/ that demonstrates how it is supposed to work. Just load the page and scroll - observe how the background item remains "fixed" while the div (1000px tall) is visible and then gets clipped when you scroll past the end of the div.

Right now in Gecko this works ok with APZ disabled because the main-thread code positions the background item where it's expected to be. With APZ enabled the background item doesn't update properly. We can probably work around it but WR will likely want to provide support for this anyway for Servo, so I would prefer to see it fixed in WR than worked around in Gecko.

/cc @mrobinson

@staktrace
Copy link
Contributor Author

@staktrace staktrace commented May 30, 2017

After discussing with mrobinson on IRC, it appears that the push_clip_and_scroll_info API should be used for this. In particular, if there is a background-attachment:fixed item inside scrollframe S, we should push a ClipAndScrollInfo with a clip_node_id of S, and a scroll_node_id of S's parent. That way the item will be fixed relative to S (but still scroll with any ancestor scrollframes), but would also be clipped as S scrolled.

I haven't tried this yet but I will give it a shot.

@staktrace
Copy link
Contributor Author

@staktrace staktrace commented May 31, 2017

It took some contortions but I managed to get this working locally. Closing this issue, I might reopen it later if I run into problems.

@staktrace staktrace closed this May 31, 2017
@pyfisch
Copy link
Contributor

@pyfisch pyfisch commented Dec 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.