mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Blocks all background webview interactions when a dialog is open (#35671)
Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
parent
b4e2037dbe
commit
56fbfc9d27
3 changed files with 26 additions and 8 deletions
|
@ -292,15 +292,22 @@ impl RunningAppState {
|
|||
inner_mut.need_update = true;
|
||||
}
|
||||
|
||||
fn has_active_dialog(&self) -> bool {
|
||||
let Some(webview) = self.focused_webview() else {
|
||||
pub(crate) fn has_active_dialog(&self) -> bool {
|
||||
let last_created_webview_id = self.inner().creation_order.last().cloned();
|
||||
let Some(webview_id) = self
|
||||
.focused_webview()
|
||||
.as_ref()
|
||||
.map(WebView::id)
|
||||
.or(last_created_webview_id)
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
|
||||
let inner = self.inner();
|
||||
let Some(dialogs) = inner.dialogs.get(&webview.id()) else {
|
||||
return false;
|
||||
};
|
||||
!dialogs.is_empty()
|
||||
inner
|
||||
.dialogs
|
||||
.get(&webview_id)
|
||||
.is_some_and(|dialogs| !dialogs.is_empty())
|
||||
}
|
||||
|
||||
pub(crate) fn get_focused_webview_index(&self) -> Option<usize> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue