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 basic overlay scrollbar support. #397

Merged
merged 1 commit into from Sep 15, 2016
Merged

Conversation

@glennw
Copy link
Member

glennw commented Sep 8, 2016

This adds the infrastructure for adding scrollbars to any scroll root,
however for now it only draws a scrollbar for the root frame. Once we
are happy with the implementation and design, we can easily enable it
for iframes and other scroll roots.

The idea is to insert a primitive of any kind into the primitive tree
and tag it as being a scroll bar primitive for a given layer. This
means we can allow styling of the scrollbar in the future, making use
of any of the display item features that are supported (e.g. border
corners, gradients, images, anti-aliasing).


This change is Reviewable

@glennw
Copy link
Member Author

glennw commented Sep 8, 2016

scrollbars

@glennw
Copy link
Member Author

glennw commented Sep 8, 2016

@glennw glennw force-pushed the glennw:scrollbars branch from 7bfb582 to f16f031 Sep 14, 2016
context.builder.add_solid_rectangle(&scrollbar_rect,
&scrollbar_rect,
None,
&ColorF::new(0.3, 0.3, 0.3, 0.6),

This comment has been minimized.

Copy link
@pcwalton

pcwalton Sep 15, 2016

Collaborator

Factor this out into a static.

let scrollable_distance = scroll_layer.content_size.height - scroll_layer.local_viewport_rect.size.height;

if scrollable_distance <= 0.0 {
prim.local_clip_rect.size = Size2D::zero();

This comment has been minimized.

Copy link
@pcwalton

pcwalton Sep 15, 2016

Collaborator

suggest continue here to avoid rightward drift

prim.rect.size.width -
distance_from_edge;

prim.rect.origin.y = min_y + f * (max_y - min_y);

This comment has been minimized.

Copy link
@pcwalton

pcwalton Sep 15, 2016

Collaborator

Isn't there a lerp function for this?


prim.rect.origin.y = min_y + f * (max_y - min_y);
prim.local_clip_rect.origin = prim.rect.origin;
prim.local_clip_rect.size = prim.rect.size;

This comment has been minimized.

Copy link
@pcwalton

pcwalton Sep 15, 2016

Collaborator

Could just be prim.local_clip_rect = prim.rect;

@glennw glennw force-pushed the glennw:scrollbars branch from f16f031 to 3b6e784 Sep 15, 2016
@glennw
Copy link
Member Author

glennw commented Sep 15, 2016

@bors-servo r=pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Sep 15, 2016

📌 Commit 3b6e784 has been approved by pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Sep 15, 2016

🔒 Merge conflict

@bors-servo
Copy link
Contributor

bors-servo commented Sep 15, 2016

The latest upstream changes (presumably #396) made this pull request unmergeable. Please resolve the merge conflicts.

This adds the infrastructure for adding scrollbars to any scroll root,
however for now it only draws a scrollbar for the root frame. Once we
are happy with the implementation and design, we can easily enable it
for iframes and other scroll roots.

The idea is to insert a primitive of any kind into the primitive tree
and tag it as being a scroll bar primitive for a given layer. This
means we can allow styling of the scrollbar in the future, making use
of any of the display item features that are supported (e.g. border
corners, gradients, images, anti-aliasing).
@glennw glennw force-pushed the glennw:scrollbars branch from 3b6e784 to d07a503 Sep 15, 2016
@glennw
Copy link
Member Author

glennw commented Sep 15, 2016

@bors-servo r=pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Sep 15, 2016

📌 Commit d07a503 has been approved by pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Sep 15, 2016

Testing commit d07a503 with merge b642600...

bors-servo added a commit that referenced this pull request Sep 15, 2016
Add basic overlay scrollbar support.

This adds the infrastructure for adding scrollbars to any scroll root,
however for now it only draws a scrollbar for the root frame. Once we
are happy with the implementation and design, we can easily enable it
for iframes and other scroll roots.

The idea is to insert a primitive of any kind into the primitive tree
and tag it as being a scroll bar primitive for a given layer. This
means we can allow styling of the scrollbar in the future, making use
of any of the display item features that are supported (e.g. border
corners, gradients, images, anti-aliasing).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/397)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 15, 2016

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit d07a503 into servo:master Sep 15, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@glennw glennw deleted the glennw:scrollbars branch Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.