mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
script: Pass more information to the MouseEvent
constructor (#37672)
- Instead of eagerly computing `pageX` and `pageY`, collect the offset from the content's initial containing block in the compositor and pass that information through to `MouseEvent`. This prevents a layout flush that was happening when eagerly trying to fetch `Document` scroll offsets. - Pass keyboard modifiers properly to `MouseEvent`. - Now all this information is stored and passed as `Point2D` (typed) and `Modifiers` which greatly reduces the amount of arguments that need to be passed around. Testing: It is difficult to test input events as they require WebDriver which isn't completely working yet. I have manually run Speedometer 2.1 and I have verified that this fixes the regression from #37601. Fixes: #37601. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
50cf01cf3d
commit
0346a62214
11 changed files with 374 additions and 369 deletions
|
@ -336,11 +336,23 @@ impl ServoRenderer {
|
|||
_ => return None,
|
||||
}
|
||||
|
||||
let offset = details
|
||||
.scroll_tree
|
||||
.scroll_offset(pipeline_id.root_scroll_id())
|
||||
.unwrap_or_default();
|
||||
let point_in_initial_containing_block =
|
||||
(item.point_in_viewport + offset).to_untyped();
|
||||
|
||||
let info = &details.hit_test_items[item.tag.0 as usize];
|
||||
Some(CompositorHitTestResult {
|
||||
pipeline_id,
|
||||
point_in_viewport: item.point_in_viewport.to_untyped(),
|
||||
point_relative_to_item: item.point_relative_to_item.to_untyped(),
|
||||
point_in_viewport: Point2D::from_untyped(item.point_in_viewport.to_untyped()),
|
||||
point_relative_to_initial_containing_block: Point2D::from_untyped(
|
||||
point_in_initial_containing_block,
|
||||
),
|
||||
point_relative_to_item: Point2D::from_untyped(
|
||||
item.point_relative_to_item.to_untyped(),
|
||||
),
|
||||
node: UntrustedNodeAddress(info.node as *const c_void),
|
||||
cursor: info.cursor,
|
||||
scroll_tree_node: info.scroll_tree_node,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue