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 upHow to prevent Servo shutdown on Escape when iframe is focused #11194
Labels
Comments
|
Having a preference that disables shut down on escape sounds like the most sensible choice to me. |
bors-servo
added a commit
that referenced
this issue
May 16, 2016
Make quit-on-escape optional For browserhtml, we don't want Servo to shut down when the user presses the escape key. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #11194 Either: - [ ] There are tests for these changes OR - [x] These changes do not require tests because I don't know how to test shutdown and how to dispatch a non-DOM key event <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11200) <!-- Reviewable:end -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For browserhtml, when we get a keypress event and key is the Escape key, we call
event.preventDefault()to prevent Servo to shutdown.When the user presses escape when an iframe is focused, the event doesn't go through the browserhtml document, so the compositor handles the keyevent and shuts down Servo.
I think the proper way to handle this is to let the event go through the containing pipeline if the iframe is a mozbrowser iframe, to allow the container the stop the propagation during the capturing phase, or, in our case,
preventDefault()the event during the bubbling phase. Then the event would not go back the compositor right away.Another option, a lot simpler, is to just not quit the application on Escape when the focused pipeline is not the top level pipeline. Not sure how that could work, maybe just not send back the key event to the compositor if the pipeline is not the top one:
servo/components/script/dom/document.rs
Line 1129 in 2c674d0
Also, it's a bit annoying we have to prevent the escape event to reach the glutin window object. Maybe the best way is just to have an option (in
resources/prefs.json) to allow/disallow shut down on escape (that we would disable for browserhtml).Please advise.