Skip to content

Add a keyboard shortcut to reload the current page #11686

Closed

Description

@jdm

We would like Ctr+R/Apple+R to reload the current page (with a preference to disable this behaviour, too). We'll need to:

  1. add a new WindowEvent variant
  2. add a handler to Window::handle_key that enqueues the new event type (guarded by a preference check like the one for handling escape)
  3. add a new ConstellationMsg variant
  4. add a handler for the new window event in Compositor::handle_window_message that sends the new message to the constellation (see on_navigation_window_event for a good model)
  5. add a new ConstellationControlMsg variant that includes a PipelineId argument
  6. add a handler for the new constellation message in Constellation::handle_request_from_compositor that gets the root pipeline and sends the new message to its script channel (see Constellation::handle_key_msg for an example), passing the root pipeline id
  7. add a handler for the new message sent from the constellation to ScriptThread::handle_msg_from_constellation that replicates the behaviour of handle_reload in devtools.rs

There's no way to write an automated test for this as far as I know, so testing manually will be our only option here.

Code: components/compositing/windowing.rs, ports/glutin/window.rs, components/compositing/compositor.rs, components/constellation/constellation.rs, components/script/script_thread.rs, components/msg/constellation_msg.rs, components/script_traits/lib.rs

Activity

  1. added
    E-more-complex
    A-content/script
    on Jun 9, 2016
  2. mrmiywj commented on Jun 9, 2016

    @mrmiywj
    Contributor

    I'll pick this up.

  3. paulrouget commented on Jun 10, 2016

    @paulrouget
    Contributor

    We don't want this to affect browserhtml. So maybe we should rename the preference shell.quit-on-escape.enabled to shell.builtin-key-shortcuts.enabled, and allow quit on escape and reload on ctrl-r only if that pref is enabled.

    "shell.quit-on-escape.enabled": true

  4. added
    C-assigned
    on Jun 10, 2016
  5. jdm commented on Jun 10, 2016

    @jdm
    MemberAuthor

    @mrmiywj Go for it :)

  6. mrmiywj commented on Jun 11, 2016

    @mrmiywj
    Contributor

    Hmm, WindowEvent::Refresh does not matched the event here?

  7. added a commit that references this issue on Jun 23, 2016
    eeed5b6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/scriptA-gfx/compositingC-assignedE-more-complex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions