Skip to content

Commit 09dc9c6

Browse files
committed
Better handle incomplete display lists during hit testing
Our custom hit testing code tries to find the root node of a pipeline. There can be references to non-existant pipelines if hit testing is performed at a time when not all display lists have arrived to WebRender yet. This changes handles that situation more gracefully instead of panicking.
1 parent f4b81af commit 09dc9c6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

webrender/src/hit_test.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,9 @@ impl HitTester {
445445
result
446446
}
447447

448-
fn get_pipeline_root(&self, pipeline_id: PipelineId) -> &HitTestSpatialNode {
449-
&self.spatial_nodes[&self.pipeline_root_nodes[&pipeline_id]]
448+
fn get_pipeline_root(&self, pipeline_id: PipelineId) -> Option<&HitTestSpatialNode> {
449+
let root_node = &self.pipeline_root_nodes.get(&pipeline_id)?;
450+
self.spatial_nodes.get(root_node)
450451
}
451452

452453
}
@@ -481,7 +482,7 @@ impl HitTest {
481482
self.pipeline_id
482483
.and_then(|id|
483484
hit_tester
484-
.get_pipeline_root(id)
485+
.get_pipeline_root(id)?
485486
.world_viewport_transform
486487
.transform_point2d(point)
487488
)

0 commit comments

Comments
 (0)