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

Create scroll bar primitives during display list construction. #21817

Open
gw3583 opened this issue Sep 26, 2018 · 7 comments
Open

Create scroll bar primitives during display list construction. #21817

gw3583 opened this issue Sep 26, 2018 · 7 comments
Labels
A-gfx/displaylist B-interesting-project Represents work that is expected to be interesting in some fashion

Comments

@gw3583
Copy link
Contributor

gw3583 commented Sep 26, 2018

WebRender provides an API for creating scroll bar primitives implicitly, if enabled. In hindsight, this API is a mistake.

The scroll bars are not very customizable (either visual or behavior). It introduces significant code complexity in WR that makes some current implementation work difficult.

Gecko doesn't use this functionality at all - scroll bars are implemented as normal primitives in the display list.

For the reasons above, I'd like to remove scroll bar APIs from WR, and have them implemented in Servo similarly to how they are done in Gecko.

@gw3583
Copy link
Contributor Author

gw3583 commented Sep 26, 2018

@jdm @paulrouget Thoughts? Do you have objections to me removing the scroll bar implementation from WR before support was added into Servo to draw them?

@gw3583
Copy link
Contributor Author

gw3583 commented Sep 27, 2018

FWIW, I just built current Servo and the existing scrollbars don't seem to work correctly anyway - they clip out on one page, didn't appear at all on another page, and flicker / change size incorrectly on the third page.

@gw3583
Copy link
Contributor Author

gw3583 commented Sep 27, 2018

They're also not clickable / draggable when they are implemented in WR.

@pcwalton
Copy link
Contributor

I have no objections to removing that support.

@paulrouget
Copy link
Contributor

I think that makes sense.

@gw3583
Copy link
Contributor Author

gw3583 commented Sep 27, 2018

Some rough guidelines on how to implement this in Servo below.

During display list building, you need to add a primitive that represents the scroll bar. This can be a normal rectangle, can have whatever clips you desire etc. It can also be an image, if you want to use native OS scrollbar styles etc.

There are two parts:
(a) Working out where to position the scrollbar primitive.
(b) Adding it to the correct part of the display list.

For (a) you can either track the current scroll location inside layout / compositor, or you can call the WR API GetScrollNodeState. This will return the current local space offset of a given scroll frame.

Long term, you'll want to add scroll bars for any scroll frame, but the existing implementation only works on the main scroll frame anyway, so implementing that first would be a good step.

For (b) you can start with just adding the primitive to the root stacking context, as the last primitive added. This will ensure it doesn't scroll with the scroll frame itself, and is drawn after everything else. Supporting child scroll frames is similar - add the primitive to the stacking context that establishes the scroll root, not inside the scroll frame itself.

Please ping me if you need more information!

@jdm jdm added B-interesting-project Represents work that is expected to be interesting in some fashion A-gfx/displaylist labels Sep 27, 2018
@hardBSDk
Copy link

Any update on the visible scrollbars support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-gfx/displaylist B-interesting-project Represents work that is expected to be interesting in some fashion
Projects
None yet
Development

No branches or pull requests

5 participants