Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement scroll handoff #533
Conversation
|
@glennw @mrobinson Any input appreciated, pls tell me more about how this would fit in the approach chosen in #517 If we all agree it's 'good enough', we could ask @pcwalton for a review as originally planned? |
|
@mrobinson is probably best to comment on this stuff. |
|
@gterzian You'll need to scroll all the layers that have the same scroll root. Otherwise the contents of scrollable divs will be out of sync. I'll be on #servo if you want to discuss in real-time. |
1abd21e
to
deddeb5
|
@glennw OK I have taken @mrobinson feedback into account, should we ask for a review? |
deddeb5
to
624aff8
|
r? @pcwalton (I think this looks OK, but I don't know the overscroll stuff super well). |
| let scroll_root_id = match (switch_layer, scroll_layer_id.info, root_scroll_layer_id.info) { | ||
| (true, _, ScrollLayerInfo::Scrollable(_, scroll_root_id)) => scroll_root_id, | ||
| (true, ScrollLayerInfo::Scrollable(_, scroll_root_id), ScrollLayerInfo::Fixed) => scroll_root_id, | ||
| (false, ScrollLayerInfo::Scrollable(_, scroll_root_id), _) => scroll_root_id, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
624aff8
to
ecf7e16
|
@pcwalton I have noticed, that when I 'switch layer', the overscrolling layer that I am switching out 'jumps' up and comes down only when the scroll has ended, perhaps because I am interfering with some of the overscroll behavior? And this seems to be intermittent by the way... |
|
@gterzian Sorry this has languished for a bit - Unfortunately the overscrolling is on mac only (and the only mac I have available is a mac mini without trackpad). Do you know if that intermittent behaviour you mention above also happens without your patch? If it does, it's probably fine to merge this. |
b58fe56
to
20b500a
|
@glennw @pcwalton I finally found what caused that intermittent 'jumping' behaviour, it was the mutation of Since the |
|
Looks good! A few minor things to fix then this should be good to go. |
| }, | ||
| (ScrollEventPhase::Start, None, _) => return false, | ||
| (_, _, Some(scroll_layer_id)) => scroll_layer_id, | ||
| (_, _, None) => return false, |
This comment has been minimized.
This comment has been minimized.
glennw
Nov 21, 2016
Member
We should probably have a condition here that sets the current scroll layer back to None at the end of the scroll event?
This comment has been minimized.
This comment has been minimized.
gterzian
Nov 21, 2016
Author
Member
I have tried this, and on Mac it makes the scroll stop right in it's track when you stop scrolling, as opposed to the default 'natural continuous scroll'. I think we can consider leaving things as they are, to retain the default behavior on Mac.
| }; | ||
|
|
||
| let mut scrolled_a_layer = false; | ||
| for (layer_id, layer) in self.layers.iter_mut() { | ||
| let mut inner_delta = delta; |
This comment has been minimized.
This comment has been minimized.
glennw
Nov 21, 2016
Member
Perhaps call this layer_delta? And we should be able to remove the mut from the function parameter for delta, I think?
This comment has been minimized.
This comment has been minimized.
| @@ -380,12 +416,11 @@ impl Frame { | |||
| if CAN_OVERSCROLL { | |||
| layer.stretch_overscroll_spring(); | |||
| } | |||
|
|
|||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| let scroll_root_id = match scroll_layer_id.info { | ||
| ScrollLayerInfo::Scrollable(_, scroll_root_id) => scroll_root_id, | ||
| ScrollLayerInfo::Fixed => unreachable!("Tried to scroll a fixed position layer."), | ||
| let switch_layer = match phase { |
This comment has been minimized.
This comment has been minimized.
glennw
Nov 21, 2016
Member
I don't completely understand what the non_root_overscroll is doing - could you add some comments explaining?
This comment has been minimized.
This comment has been minimized.
20b500a
to
4a79187
| pub struct ScrollingState { | ||
| pub offset: Point2D<f32>, | ||
| pub spring: Spring, | ||
| pub started_bouncing_back: bool, | ||
| pub bouncing_back: bool, | ||
| pub should_handoff_scroll: bool |
This comment has been minimized.
This comment has been minimized.
gterzian
Nov 21, 2016
Author
Member
@glennw I renamed the field on layer, so that it simply states it's purpose from the layer's point of view...
7426272
to
6fbc6f9
|
I was just doing some testing with this, but it seems to break scrolling on Linux altogether. I'm not sure if that's because of the Linux scroll implementation, or because I rebased this on top of master before testing. Are you able to test this on a Linux machine? (You may be able to repro it on a mac by switching the CAN_OVERSCROLL constant, which is set based on mac/linux). |
|
@glennw thanks for testing. I don't have a Linux machine readily available, however I might be able to run it into a VM of some sorts, given more time. I did already follow your suggestion of setting
Can I rebase/edit and push the above mentioned changes? I guess it should not create any problems unless you were to work off the branch that you pulled for testing... |
|
UPDATE: I have now also tested after a rebase off master (using servo/servo#14286 on the servo side), and it seems to work on Mac, even with overscrolling turned off. @glennw could you describe the Linux problems in more details? Does the scrolling simply not work at all? |
|
@gterzian Yep - the scrolling was completely broken. Even on a really simple page with a single scroll layer (like https://news.ycombinator.com) I was unable to scroll at all. But when I reverted the commits in this branch and ran, I could scroll again. That's quite strange that changing CAN_OVERSCROLL doesn't reproduce it - I'm not aware of any other obvious differences between the linux/mac scrolling implementations... |
|
@glennw thanks for the update! Ok, I guess I will need to debug that using linux on virtualbox... |
|
|
…he parent
0f15516
to
ecaec50
ecaec50
to
26a3b05
|
@glennw Due to resource constraints on my current machine, I'm having some troubles building and running Servo in a Linux VM for testing. In an attempt to try to move things forward while I find a solution, I've broken up this PR into two ones, since we're actually doing two separate things here, and I have a feeling it's only one of the two that has the potential to completely break scrolling on Linux. Could I ask you to please test this one on your machine: #599 ? I am hopeful it will work on Linux, while I will have to further debug this one later: #600 |
|
@gterzian Sure, I'll test those patches on Linux today and report back the results. |
gterzian commentedNov 6, 2016
•
edited
WIP for servo/servo#13249
To summarize what was discussed in the issue:
This change is