Only access hit test items for the current epoch in the compositor (#30491)

When display lists update quickly, a hit test result might be returned
for a previous display list / list of hit test items. When that happens,
ignore the hit test result.

This fixes a crash, but there might be situations where we can do
something better, such as wait for display list processing to finish
before performing the hit test. A future change might do this for events
like mouse clicks and touch events that should never be thrown away.
Ultimately, the best thing is likely moving hit testing back to layout
or script so a valid hit test can always be performed against the
current DOM.

Fixes #29796.
This commit is contained in:
Martin Robinson 2023-10-04 18:33:18 +02:00 committed by GitHub
parent 38a325cc1c
commit ce183d8581
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 3 deletions

View file

@ -9,6 +9,7 @@ use embedder_traits::Cursor;
use euclid::{Point2D, SideOffsets2D, Size2D};
use fnv::FnvHashMap;
use gfx::text::glyph::GlyphStore;
use gfx_traits::WebRenderEpochToU16;
use msg::constellation_msg::BrowsingContextId;
use net_traits::image_cache::UsePlaceholder;
use script_traits::compositor::{CompositorDisplayListInfo, ScrollTreeNodeId};
@ -180,7 +181,10 @@ impl<'a> DisplayListBuilder<'a> {
Some(cursor(inherited_ui.cursor.keyword, auto_cursor)),
self.current_scroll_node_id,
);
Some((hit_test_index as u64, 0u16))
Some((
hit_test_index as u64,
self.display_list.compositor_info.epoch.as_u16(),
))
}
}