Skip to content

"Home" and "End" keys don't scroll to top/bottom of page #13082

Closed

Description

@StringEpsilon

Like the title says.

Steps to reproduce:

  • Open reddit.com
  • scroll down a bit
  • Press "home"
  • Press "end"

Expectation:
You are now at the bottom of the page.

Actual:
You are still where you manually scrolled to.

OS:
Arch Linux, 64 bit.

Servo version: Latest nightly build as of 08/27/2016 @ 12:41pm (UTC)

Activity

  1. paulrouget commented on Aug 29, 2016

    @paulrouget
    Contributor

    This should not be too hard to implement. See fn handle_key() in ports/glutin/window.rs.

  2. added
    E-less-complex
    on Aug 29, 2016
  3. highfive commented on Aug 29, 2016

    @highfive

    Please make a comment here if you intend to work on this issue. Thank you!

  4. jdm commented on Aug 29, 2016

    @jdm
    Member

    This isn't appropriate for E-easy unless we also explain how to do the relevant scrolling as well.

  5. added and removed
    E-less-complex
    on Aug 29, 2016
  6. changed the title [-]"Home" and "End" keys don't scroll all the way up / down the page[/-] [+]"Home" and "End" keys don't scroll to top/bottom of page[/+] on Aug 29, 2016
  7. paulrouget commented on Aug 29, 2016

    @paulrouget
    Contributor

    You're right. I thought that'd be an easy one, but it doesn't appear to be that straight forward.

    webrender expects a delta (Point2D<f32>). Do we want to change that to:

    enum ScrollAction {
        Delta(Point2D<f32>),
        ToStart,
        ToEnd,
    }

    Does it make sense?

    Or do we want to pass f32::INFINITY and f32::NEG_INFINITY ?

  8. paulrouget commented on Aug 30, 2016

    @paulrouget
    Contributor
  9. glennw commented on Aug 30, 2016

    @glennw
    Member

    Having an enum sounds good. The Start/End types should probably allow you to specify x and/or y direction though?

    So perhaps something like:

    enum ScrollLocation {
      Delta(f32),
      Start,
      End,
    }
    

    and then:

    struct ScrollRequest {
      vertical: ScrollLocation,
      horizontal: ScrollLocation,
    }
    

    Or something like that?

  10. samuknet commented on Sep 7, 2016

    @samuknet
    Contributor

    Once we have decided these ScrollRequest details, would this be something I could potentially work on? Thanks!

  11. paulrouget commented on Sep 8, 2016

    @paulrouget
    Contributor

    Once we have decided these ScrollRequest details

    We should do what Glenn is suggesting.

    would this be something I could potentially work on?

    Go for it. Thank you!

    I'm not sure how much I can help here, but feel free to ask questions.

  12. added
    C-assigned
    on Sep 8, 2016
  13. samuknet commented on Sep 8, 2016

    @samuknet
    Contributor

    Ok this sounds good. So would WindowEvent::Scroll be changed to:

    Scroll(ScrollRequest, TypedPoint2D<i32, DevicePixel>, TouchEventType)

    ?

    Or alternately the new ScrollRequest could also encapsulate the TypedPoint2D<i32, DevicePixel> and TouchEventType, meaning WindowEvent::Scroll would just be Scroll(ScrollRequest).

    So, this detail aside, I'm thinking the general things to be done are:

    • add two more match arms to fn handle_key in ports/glutin/window.rs to queue scroll start/end requests when the home/end keys are pressed.
    • Modify WindowEvent::Scroll to be made up of the ScrollRequest struct described above.
    • Refactor fn scroll in webrender_traits to accept the new ScrollRequest struct
    • Refactor this case to accept a ScrollRequest and refactor other related code involving webrender.scroll calls, namely, fn process_pending_scroll_events

    I guess one thing I'm not sure about is at what point we should convert from a ScrollLocation to just a Point2D? I.e. the part where a ScrollLocation::Start is converted to a delta. How far the Delta -> ScrollRequest refactoring should go?

    I'm guessing we will still want WebRender::frame's fn scroll to take a delta rather than pass the ScrollRequest (in some form) all the way through to there.

  14. paulrouget commented on Sep 9, 2016

    @paulrouget
    Contributor

    Or alternately the new ScrollRequest could also encapsulate the TypedPoint2D

    I think it makes sense.

    So, this detail aside, I'm thinking the general things to be done are […]

    Looks about right.

    How far the Delta -> ScrollRequest refactoring should go?

    I'm not sure. Where ever there's an easy access to the page size. Which might be in WebRender.

    @glennw ?

  15. 11 remaining items

  16. paulrouget commented on Nov 4, 2016

    @paulrouget
    Contributor

    @samuknet do you want to keep working on this? Do need any help? Or do you want someone else to take over?

  17. samuknet commented on Nov 4, 2016

    @samuknet
    Contributor

    @paulrouget
    I have got a working implementation but there are a few details I had to make assumptions for, so I'm going to submit a PR, if that sounds good? The home/end key scrolling is working as expected.

    I currently have servo using my webrender fork however I'm unsure how to get servo to use my webrender_traits fork? Am I right in thinking this is what I need to do? So my PR's would be done in the order of webrender_traits, then webrender, then Servo.

    Currently I have just webrender_traits directly in the webrender fork but am unsure how to use a my webrender traits fork.

    Currently in servo/.cargo/config I have:

    paths = ["/Users/Sam/servo_fork/webrender/", "/Users/Sam/servo_fork/webrender_traits/"]

    Although when I compile and run it, it uses the webrender_traits from /Users/Sam/servo_fork/webrender/webrender_traits instead. So for now, the webrender_traits changes I have are in /Users/Sam/servo_fork/webrender/webrender_traits. But if I understand correctly, I need to make it use the forked webrender traits if I am to do the PR's.

  18. jdm commented on Nov 4, 2016

    @jdm
    Member

    You should be able to make a single PR for both WR and WR_traits changes,then make a PR for servo after that merges and use ./mach cargo-update -p webrender (possibly the same for webrender_traits, too).

  19. samuknet commented on Nov 8, 2016

    @samuknet
    Contributor

    I've updated my webrender fork branch ('home-end-key-scroll') to be up to date with the latest webrender, and I am using paths = [..] in config to select webrender and webrender_traits, however when building Servo I get the error:

    Package webrender_traits v0.8.0 (file:///Users/sam/servo/servo_fork/webrender/webrender) does not have these features: serde_macros.

    I noticed this is a problem mentioned here, but I couldn't find a fix.

    I've also tried the Cargo.toml [replace] method, using:
    [replace] "webrender:0.6.0" = { path = '/Users/sam/servo/servo_fork/webrender/webrender/' } "webrender_traits:0.6.0" = { path = '/Users/sam/servo/servo_fork/webrender/webrender_traits/' }
    but this didn't work either.

    Any ideas?

    Thanks 😃

  20. paulrouget commented on Nov 8, 2016

    @paulrouget
    Contributor

    Does it work better with webrender:0.8.0 instead of webrender:0.6.0?

  21. gterzian commented on Nov 8, 2016

    @gterzian
    Member

    @samuknet I had this problem before as well I remember, I think you need to update your servo repo, and then as @paulrouget says indeed replace webrender in Cargo.toml and please make sure it's version 0.8.0

  22. samuknet commented on Nov 8, 2016

    @samuknet
    Contributor

    I've tried this, I still get the error unfortunately. I removed paths=[..] in config and added the [replace] in Cargo.toml with 0.8.0 although I get the same error.

  23. paulrouget commented on Nov 8, 2016

    @paulrouget
    Contributor

    You use a clone of webrender from servo/webrender?

    And in components/servo/Cargo.toml, you added:

    [replace]
    "webrender:0.8.0" = { path = '/Users/sam/servo/servo_fork/webrender/webrender/' }
    "webrender_traits:0.8.0" = { path = '/Users/sam/servo/servo_fork/webrender/webrender_traits' }
    

    ?

  24. gterzian commented on Nov 8, 2016

    @gterzian
    Member

    I had exactly this problem here: #13249 (comment)

    But that should have been fixed in Servo by now(#13249 (comment)), @samuknet are you 100% sure you are building your webrender fork using the latest version of the servo repo?

    just to make sure, you would have to do something like:
    git fetch --all
    git rebase upstream/master (assuming you set up the original repo as the 'upstream' remote on your machine...

  25. samuknet commented on Nov 8, 2016

    @samuknet
    Contributor

    @gterzian Thanks, I think I've got it now. I had to make changes to my old work to account for the latest Servo code.

    So now is the procedure to submit a webrender PR alongisde the Servo PR?

    Edit:
    Servo PR fork: https://github.com/samuknet/servo/tree/home-end-key-scroll2
    Webrender PR fork: https://github.com/samuknet/webrender/tree/home-end-key-scroll2

  26. jdm commented on Nov 8, 2016

    @jdm
    Member

    Yep!

  27. added a commit that references this issue on Nov 28, 2016
  28. added 2 commits that reference this issue on Jan 23, 2017
    3535d5b
    1706ffd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions