mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add flag for epoch mismatch
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
parent
ddad26f6c8
commit
54d37638b4
2 changed files with 9 additions and 2 deletions
|
@ -814,10 +814,13 @@ impl IOCompositor {
|
|||
let Some(webview_renderer) = self.webview_renderers.get_mut(webview_id) else {
|
||||
return warn!("Could not find WebView for incoming display list");
|
||||
};
|
||||
webview_renderer.epoch_not_synchronized.set(true);
|
||||
|
||||
let pipeline_id = display_list_info.pipeline_id;
|
||||
let details = webview_renderer.ensure_pipeline_details(pipeline_id.into());
|
||||
|
||||
details.most_recent_display_list_epoch = Some(display_list_info.epoch);
|
||||
|
||||
details.hit_test_items = display_list_info.hit_test_info;
|
||||
details.install_new_scroll_tree(display_list_info.scroll_tree);
|
||||
|
||||
|
@ -1662,6 +1665,7 @@ impl IOCompositor {
|
|||
// Process all pending events
|
||||
self.webview_renderers.iter().for_each(|webview| {
|
||||
webview.dispatch_pending_input_events();
|
||||
webview.epoch_not_synchronized.set(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::hash_map::Keys;
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::rc::Rc;
|
||||
|
@ -100,6 +100,8 @@ pub(crate) struct WebViewRenderer {
|
|||
animating: bool,
|
||||
/// Pending input events queue. Priavte and only this thread pushes events to it.
|
||||
pending_input_events: RefCell<VecDeque<InputEvent>>,
|
||||
/// Flag to indicate that the epoch has been not synchronized yet.
|
||||
pub epoch_not_synchronized: Cell<bool>,
|
||||
}
|
||||
|
||||
impl Drop for WebViewRenderer {
|
||||
|
@ -135,6 +137,7 @@ impl WebViewRenderer {
|
|||
hidpi_scale_factor: Scale::new(hidpi_scale_factor.0),
|
||||
animating: false,
|
||||
pending_input_events: Default::default(),
|
||||
epoch_not_synchronized: Cell::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +322,7 @@ impl WebViewRenderer {
|
|||
return;
|
||||
};
|
||||
|
||||
if self.pending_input_events.borrow().len() > 0 {
|
||||
if self.epoch_not_synchronized.get() {
|
||||
self.pending_input_events.borrow_mut().push_back(event);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue