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
|
@ -18,11 +18,13 @@ use bitflags::bitflags;
|
|||
use devtools_traits::NodeInfo;
|
||||
use dom_struct::dom_struct;
|
||||
use embedder_traits::UntrustedNodeAddress;
|
||||
use euclid::Point2D;
|
||||
use euclid::default::{Rect, Size2D};
|
||||
use html5ever::serialize::HtmlSerializer;
|
||||
use html5ever::{Namespace, Prefix, QualName, ns, serialize as html_serialize};
|
||||
use js::jsapi::JSObject;
|
||||
use js::rust::HandleObject;
|
||||
use keyboard_types::Modifiers;
|
||||
use layout_api::{
|
||||
GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType, QueryMsg,
|
||||
SVGSVGData, StyleData, TrustedNodeAddress,
|
||||
|
@ -479,14 +481,10 @@ impl Node {
|
|||
EventCancelable::Cancelable, // Step 3: cancelable
|
||||
Some(&window), // Step 7: view
|
||||
0, // detail uninitialized
|
||||
0, // coordinates uninitialized
|
||||
0, // coordinates uninitialized
|
||||
0, // coordinates uninitialized
|
||||
0, // coordinates uninitialized
|
||||
false, // ctrl_key
|
||||
false, // alt_key
|
||||
false, // shift_key
|
||||
false, // meta_key
|
||||
Point2D::zero(), // coordinates uninitialized
|
||||
Point2D::zero(), // coordinates uninitialized
|
||||
Point2D::zero(), // coordinates uninitialized
|
||||
Modifiers::empty(), // empty modifiers
|
||||
0, // button, left mouse button
|
||||
0, // buttons
|
||||
None, // related_target
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue