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

Implement home end key scrolling #14141

Merged
merged 1 commit into from Jan 23, 2017
Merged

Conversation

@samuknet
Copy link
Contributor

samuknet commented Nov 8, 2016

  • Refactor all scroll related code to use a new ScrollLocation struct which can either be a delta (as before) or a Start or End request, to represent the desire to scroll to the start and end of the page.
    Effectively, everywhere a delta was used, there is now a ScrollLocation struct instead.

  • Add key press listeners for HOME and END keys so as to cause a scroll to be queued with ScrollLocation::Start (in HOME case) or ScrollLocation::End (in END case).

  • These changes depend on added support for the new ScrollLocation in webrender and webrender_traits. See servo/webrender#540.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • [ x] These changes fix #13082 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because scrolling I/O

This change is Reviewable

@highfive
Copy link

highfive commented Nov 8, 2016

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @nox (or someone else) soon.

@samuknet samuknet changed the title Home end key scroll2 Implement home end key scrolling Nov 8, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Nov 9, 2016

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

@jdm jdm mentioned this pull request Nov 14, 2016
2 of 4 tasks complete
bors-servo added a commit to servo/webrender that referenced this pull request Nov 28, 2016
Implement Home end key scroll

Addressing issue servo/servo#13082.
Supporting servo/servo#14141.

* Adds `ScrollLocation` type in `webrender_traits`.
* Refactor api to use new `ScrollLocation`
* Implement home/end scrolling in `webrender/src/frame.rs` `fn scroll(...)` using new `ScrollLocation` struct passed in.

<!-- 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/540)
<!-- Reviewable:end -->
@gterzian
Copy link
Member

gterzian commented Dec 17, 2016

@samuknet Have you considered rebasing off the latest Servo? I think it might make the build pass, since this PR is using webrender_traits 0.8.0, and the ScrollLocation you added to webrender was not part of it at version 0.8.0. Since Servo itself has been upgraded to use 0.11.0, rebasing might be just enough.

I'm waiting for this one to land to be able to further test servo/webrender#599 😄

@samuknet
Copy link
Contributor Author

samuknet commented Dec 19, 2016

@gterzian Working on it, should be up soon. servo/webrender#599 looks cool :)

@samuknet
Copy link
Contributor Author

samuknet commented Dec 20, 2016

@gterzian
I've done the rebase although when testing the home/end key scrolling doesn't actually happen on the webrender side. The webrender_traits repos has not yet been updated to use the new ScrollLocation instead of deltas - https://github.com/servo/webrender_traits/blob/master/src/api.rs#L184. Should I go ahead and PR the changes separately on webrender_traits?

So what's happening is the render_backend is just sending through the deltas with:
if self.frame.scroll(delta, cursor, move_phase)
which is the old way without ScrollLocation.

Although what's unusual is that fn scroll(...) in frame.rs is taking a ScrollLocation which seems different from the way render_backend is calling it? I see that webrender is using the types from the un-updated webrender_traits separate repos although I don't see how fn scroll can be used with a delta signature in render_backend.rs but defined with a ScrollLocation in frame.rs.

@gterzian
Copy link
Member

gterzian commented Dec 20, 2016

@samuknet thanks for doing all this research! I think the webrender_traits repo you are looking at is not used anymore(last update seems to have been 5 months ago), and the code has been moved into the webrender repo.

You can see in the new repo that the ScrollLocation is indeed used in ApiMsg::Scroll

Also you could take a look at this PR because it looks like @glennw has done some work on the Servo side to integrate webrender_traits::ScrollLocation.

I'm not sure why "when testing the home/end key scrolling doesn't actually happen", but maybe with the info above you can get an idea why?

@samuknet
Copy link
Contributor Author

samuknet commented Dec 20, 2016

@gterzian - thanks for this info. Found the issue - changes to coordinates in WR meant the home/end safety checks were stopping the scroll in the wrong when they should have been allowing it.

Waiting now on servo/webrender#656.

@samuknet samuknet force-pushed the samuknet:home-end-key-scroll2 branch from d9f6ae8 to 5914600 Dec 21, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Dec 21, 2016

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

@jdm
Copy link
Member

jdm commented Dec 21, 2016

That PR merged, so this is ready for review.

@jdm
Copy link
Member

jdm commented Dec 21, 2016

It looks like this PR updates a bunch of other dependencies, though, which we probably want to avoid!

@samuknet samuknet force-pushed the samuknet:home-end-key-scroll2 branch from 5914600 to 21c5bf8 Dec 21, 2016
@jdm jdm removed the S-needs-rebase label Dec 21, 2016
@samuknet samuknet force-pushed the samuknet:home-end-key-scroll2 branch 2 times, most recently from d1977a3 to 259d4c2 Jan 13, 2017
@samuknet
Copy link
Contributor Author

samuknet commented Jan 15, 2017

@jdm any idea why the travis CI build failed? I suspect something is wrong with the Cargo.lock on this branch.

Thanks! :)

Copy link
Member

jdm left a comment

The travis error is because our script that verifies that no accidental Cargo.lock changes were committed triggered.

@@ -15,6 +15,7 @@ gfx_traits = {path = "../gfx_traits"}
gleam = "0.2.8"
image = "0.12"
ipc-channel = "0.5"
layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]}

This comment has been minimized.

@jdm

jdm Jan 15, 2017

Member

This line was added and is not necessary. Probably a mistake while rebasing?

@jdm jdm added the S-needs-squash label Jan 15, 2017
@jdm
Copy link
Member

jdm commented Jan 15, 2017

r? @glennw

@samuknet samuknet force-pushed the samuknet:home-end-key-scroll2 branch 2 times, most recently from 1a8c5c3 to 0c9c343 Jan 21, 2017
@samuknet
Copy link
Contributor Author

samuknet commented Jan 23, 2017

@glennw All done and squashed - ready to go hopefully

@jdm
Copy link
Member

jdm commented Jan 23, 2017

@bors-servo: r=glennw

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2017

📌 Commit 0c9c343 has been approved by glennw

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2017

Testing commit 0c9c343 with merge 3535d5b...

bors-servo added a commit that referenced this pull request Jan 23, 2017
Implement home end key scrolling

<!-- Please describe your changes on the following line: -->
* Refactor all scroll related code to use a new `ScrollLocation` struct which can either be a `delta` (as before) or a `Start` or `End` request, to represent the desire to scroll to the start and end of the page.
Effectively, everywhere a delta was used, there is now a `ScrollLocation` struct instead.

* Add key press listeners for HOME and END keys so as to cause a scroll to be queued with `ScrollLocation::Start` (in HOME case) or `ScrollLocation::End` (in END case).

* These changes depend on added support for the new `ScrollLocation` in webrender and webrender_traits. See servo/webrender#540.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ x] These changes fix #13082 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because scrolling I/O

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->

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

bors-servo commented Jan 23, 2017

💔 Test failed - mac-dev-unit

@samuknet
Copy link
Contributor Author

samuknet commented Jan 23, 2017

@jdm Looks like this could be fixed by changing the macro in browser_hosts.rs on line 474 to be:

this.downcast().send_window_event(WindowEvent::Scroll(ScrollLocation::Delta(delta),
                                                                  origin,
                                                                  TouchEventType::Move))

This compilation error doesn't occur on my machine, I'm guessing because it depends on the platform?

@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 23, 2017

Have you tried running ./mach build-cef?

Sam
@samuknet samuknet force-pushed the samuknet:home-end-key-scroll2 branch from 0c9c343 to 7e4255e Jan 23, 2017
@samuknet
Copy link
Contributor Author

samuknet commented Jan 23, 2017

@Ms2ger Thanks for this - I've just pushed the nescessary changes in browser_hosts.rs.

@jdm
Copy link
Member

jdm commented Jan 23, 2017

@bors-servo: r=glennw

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2017

📌 Commit 7e4255e has been approved by glennw

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2017

Testing commit 7e4255e with merge 1706ffd...

bors-servo added a commit that referenced this pull request Jan 23, 2017
Implement home end key scrolling

<!-- Please describe your changes on the following line: -->
* Refactor all scroll related code to use a new `ScrollLocation` struct which can either be a `delta` (as before) or a `Start` or `End` request, to represent the desire to scroll to the start and end of the page.
Effectively, everywhere a delta was used, there is now a `ScrollLocation` struct instead.

* Add key press listeners for HOME and END keys so as to cause a scroll to be queued with `ScrollLocation::Start` (in HOME case) or `ScrollLocation::End` (in END case).

* These changes depend on added support for the new `ScrollLocation` in webrender and webrender_traits. See servo/webrender#540.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ x] These changes fix #13082 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because scrolling I/O

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->

---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14141)
<!-- Reviewable:end -->
@bors-servo bors-servo merged commit 7e4255e into servo:master Jan 23, 2017
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
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.

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