mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
constellation: focusing and closing webviews (#30842)
* constellation: focusing, closing, and native window visibility * rename “browser” to “webview”, “unfocus” to “blur” * remove native window visibility from constellation * rename more “browser” to “webview” * guard clauses * don’t automatically focus when no webviews are focused * comment spec steps for window.close() * use format interpolation Co-authored-by: Martin Robinson <mrobinson@igalia.com> * fix formatting * rename “Webview” to “WebView” in types and type parameters * remove unused method * fix libsimpleservo --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
6baaa82826
commit
eb95703325
16 changed files with 533 additions and 285 deletions
|
@ -790,13 +790,14 @@ impl WindowMethods for Window {
|
|||
let window = this.root();
|
||||
let document = window.Document();
|
||||
// https://html.spec.whatwg.org/multipage/#closing-browsing-contexts
|
||||
// Step 1, prompt to unload.
|
||||
// Step 1, check if traversable is closing, was already done above.
|
||||
// Steps 2 and 3, prompt to unload for all inclusive descendant navigables.
|
||||
// TODO: We should be prompting for all inclusive descendant navigables,
|
||||
// but we pass false here, which suggests we are not doing that. Why?
|
||||
if document.prompt_to_unload(false) {
|
||||
// Step 2, unload.
|
||||
// Step 4, unload.
|
||||
document.unload(false);
|
||||
// Step 3, remove from the user interface
|
||||
let _ = window.send_to_embedder(EmbedderMsg::CloseBrowser);
|
||||
// Step 4, discard browsing context.
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
|
||||
// which calls into https://html.spec.whatwg.org/multipage/#discard-a-document.
|
||||
window.discard_browsing_context();
|
||||
|
|
|
@ -293,7 +293,7 @@ impl WindowProxy {
|
|||
.and_then(|id| ScriptThread::find_document(id))
|
||||
.and_then(|doc| Some(DomRoot::from_ref(doc.window())))
|
||||
.unwrap();
|
||||
let msg = EmbedderMsg::AllowOpeningBrowser(chan);
|
||||
let msg = EmbedderMsg::AllowOpeningWebView(chan);
|
||||
window.send_to_embedder(msg);
|
||||
if port.recv().unwrap() {
|
||||
let new_top_level_browsing_context_id = TopLevelBrowsingContextId::new();
|
||||
|
@ -337,7 +337,7 @@ impl WindowProxy {
|
|||
let constellation_msg = ScriptMsg::ScriptNewAuxiliary(load_info, pipeline_sender);
|
||||
window.send_to_constellation(constellation_msg);
|
||||
ScriptThread::process_attach_layout(new_layout_info, document.origin().clone());
|
||||
let msg = EmbedderMsg::BrowserCreated(new_top_level_browsing_context_id);
|
||||
let msg = EmbedderMsg::WebViewOpened(new_top_level_browsing_context_id);
|
||||
window.send_to_embedder(msg);
|
||||
// TODO: if noopener is false, copy the sessionStorage storage area of the creator origin.
|
||||
// See step 14 of https://html.spec.whatwg.org/multipage/#creating-a-new-browsing-context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue