Skip to content

Add a keyboard shortcut to reload the current page #11686

@jdm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/scriptRelated to the script threadA-gfx/compositingC-assignedThere is someone working on resolving the issueE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the iss

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions