New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Window.open and related infrastructure #20678
Merged
+830
−528
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f408b79
implement window.open, create auxiliary browsing context
gterzian 21bf5a3
implement opener, disowning
gterzian e27ba16
share event-loops based on eTLD+1
gterzian a0082c5
iframe: use value of name attr to set nested bc name
gterzian fee5428
make auxiliary browsing-context script-closeable
gterzian 96f7546
rudimentary handling of tabs
gterzian e784f5a
Refactor embedder NewBrowser flow
gterzian File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
rudimentary handling of tabs
- Loading branch information
commit 96f75465cfddc616721ea24cbc2e011611e432f9
| @@ -26,6 +26,12 @@ pub struct Browser { | ||
| /// are not supported yet. None until created. | ||
| browser_id: Option<BrowserId>, | ||
|
|
||
| // A rudimentary stack of "tabs". | ||
| // EmbedderMsg::BrowserCreated will push onto it. | ||
| // EmbedderMsg::CloseBrowser will pop from it, | ||
| // and exit if it is empty afterwards. | ||
| browsers: Vec<BrowserId>, | ||
|
|
||
| title: Option<String>, | ||
| status: Option<String>, | ||
| favicon: Option<ServoUrl>, | ||
| @@ -47,6 +53,7 @@ impl Browser { | ||
| title: None, | ||
| current_url: None, | ||
| browser_id: None, | ||
| browsers: Vec::new(), | ||
| status: None, | ||
| favicon: None, | ||
| loading_state: None, | ||
| @@ -62,6 +69,7 @@ impl Browser { | ||
|
|
||
| pub fn set_browser_id(&mut self, browser_id: BrowserId) { | ||
| self.browser_id = Some(browser_id); | ||
| self.browsers.push(browser_id); | ||
| } | ||
|
|
||
| pub fn handle_window_events(&mut self, events: Vec<WindowEvent>) { | ||
| @@ -293,7 +301,7 @@ impl Browser { | ||
| } | ||
| EmbedderMsg::BrowserCreated(new_browser_id) => { | ||
| // TODO: properly handle a new "tab" | ||
| self.browser_id = Some(new_browser_id); | ||
| self.browsers.push(new_browser_id); | ||
| self.event_queue.push(WindowEvent::SelectBrowser(new_browser_id)); | ||
| } | ||
| EmbedderMsg::KeyEvent(ch, key, state, modified) => { | ||
| @@ -321,10 +329,13 @@ impl Browser { | ||
| self.loading_state = Some(LoadingState::Loaded); | ||
| } | ||
| EmbedderMsg::CloseBrowser => { | ||
| self.browser_id = None; | ||
| // Nothing left to do for now, | ||
| // but could hide a tab, and show another one, instead of quitting. | ||
| self.event_queue.push(WindowEvent::Quit); | ||
| // TODO: close the appropriate "tab". | ||
gterzian
Author
Member
|
||
| let _ = self.browsers.pop(); | ||
| if let Some(prev_browser_id) = self.browsers.last() { | ||
| self.event_queue.push(WindowEvent::SelectBrowser(*prev_browser_id)); | ||
| } else { | ||
| self.event_queue.push(WindowEvent::Quit); | ||
| } | ||
| }, | ||
| EmbedderMsg::Shutdown => { | ||
| self.shutdown_requested = true; | ||
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
I'm not sure what this todo is about.