mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
layout: Add a hit test item that covers all scroll frame contents (#34347)
When building scroll frames, add a special `StackingContextContent::Fragment` type for a hit test that covers all scroll frame contents. This makes it so that you don't have to be hovering over actual content to scroll the scroll frame. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
c60e4afbee
commit
c11e0e8e70
3 changed files with 104 additions and 55 deletions
|
@ -21,7 +21,7 @@ pub enum ScrollSensitivity {
|
|||
|
||||
/// Information that Servo keeps alongside WebRender display items
|
||||
/// in order to add more context to hit test results.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct HitTestInfo {
|
||||
/// The id of the node of this hit test item.
|
||||
pub node: u64,
|
||||
|
@ -327,17 +327,19 @@ impl CompositorDisplayListInfo {
|
|||
cursor: Option<Cursor>,
|
||||
scroll_tree_node: ScrollTreeNodeId,
|
||||
) -> usize {
|
||||
let hit_test_info = HitTestInfo {
|
||||
node,
|
||||
cursor,
|
||||
scroll_tree_node,
|
||||
};
|
||||
|
||||
if let Some(last) = self.hit_test_info.last() {
|
||||
if node == last.node && cursor == last.cursor {
|
||||
if hit_test_info == *last {
|
||||
return self.hit_test_info.len() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
self.hit_test_info.push(HitTestInfo {
|
||||
node,
|
||||
cursor,
|
||||
scroll_tree_node,
|
||||
});
|
||||
self.hit_test_info.push(hit_test_info);
|
||||
self.hit_test_info.len() - 1
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue