mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #18181 - paulrouget:close_browser, r=cbrewster
Make it possible to close a browsing context from the embedder <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #18006 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18181) <!-- Reviewable:end -->
This commit is contained in:
commit
5b4c9c7c77
4 changed files with 23 additions and 1 deletions
|
@ -974,9 +974,14 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
// Create a new top level browsing context. Will use response_chan to return
|
||||
// the browsing context id.
|
||||
FromCompositorMsg::NewBrowser(url, response_chan) => {
|
||||
debug!("constellation got init load URL message");
|
||||
debug!("constellation got NewBrowser message");
|
||||
self.handle_new_top_level_browsing_context(url, response_chan);
|
||||
}
|
||||
// Close a top level browsing context.
|
||||
FromCompositorMsg::CloseBrowser(top_level_browsing_context_id) => {
|
||||
debug!("constellation got CloseBrowser message");
|
||||
self.handle_close_top_level_browsing_context(top_level_browsing_context_id);
|
||||
}
|
||||
// Send frame tree to WebRender. Make it visible.
|
||||
FromCompositorMsg::SelectBrowser(top_level_browsing_context_id) => {
|
||||
self.send_frame_tree(top_level_browsing_context_id);
|
||||
|
@ -1544,6 +1549,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
});
|
||||
}
|
||||
|
||||
fn handle_close_top_level_browsing_context(&mut self, top_level_browsing_context_id: TopLevelBrowsingContextId) {
|
||||
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
|
||||
self.close_browsing_context(browsing_context_id, ExitPipelineMode::Normal);
|
||||
}
|
||||
|
||||
fn handle_iframe_size_msg(&mut self,
|
||||
iframe_sizes: Vec<(BrowsingContextId, TypedSize2D<f32, CSSPixel>)>) {
|
||||
for (browsing_context_id, size) in iframe_sizes {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue