mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use WebRender to compute text index on click events
This is the second half of switching over to WebRender for hit testing. Now that WebRender gives us the location of the hit tested point in the display item, we can use that to calculate text index.
This commit is contained in:
parent
ca08271345
commit
770b348091
11 changed files with 191 additions and 276 deletions
|
@ -702,20 +702,20 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
None => return,
|
||||
};
|
||||
|
||||
let point = result.point_in_viewport.to_untyped();
|
||||
let node_address = Some(UntrustedNodeAddress(result.tag.0 as *const c_void));
|
||||
let event_to_send = match mouse_window_event {
|
||||
MouseWindowEvent::Click(button, _) => {
|
||||
MouseButtonEvent(MouseEventType::Click, button, point, node_address)
|
||||
}
|
||||
MouseWindowEvent::MouseDown(button, _) => {
|
||||
MouseButtonEvent(MouseEventType::MouseDown, button, point, node_address)
|
||||
}
|
||||
MouseWindowEvent::MouseUp(button, _) => {
|
||||
MouseButtonEvent(MouseEventType::MouseUp, button, point, node_address)
|
||||
}
|
||||
let (button, event_type) = match mouse_window_event {
|
||||
MouseWindowEvent::Click(button, _) => (button, MouseEventType::Click),
|
||||
MouseWindowEvent::MouseDown(button, _) => (button, MouseEventType::MouseDown),
|
||||
MouseWindowEvent::MouseUp(button, _) => (button, MouseEventType::MouseUp),
|
||||
};
|
||||
|
||||
let event_to_send = MouseButtonEvent(
|
||||
event_type,
|
||||
button,
|
||||
result.point_in_viewport.to_untyped(),
|
||||
Some(UntrustedNodeAddress(result.tag.0 as *const c_void)),
|
||||
Some(result.point_relative_to_item.to_untyped()),
|
||||
);
|
||||
|
||||
let pipeline_id = PipelineId::from_webrender(result.pipeline);
|
||||
let msg = ConstellationMsg::ForwardEvent(pipeline_id, event_to_send);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue