Auto merge of #18704 - mrobinson:wr-hit-testing, r=jdm,glennw,mbrubeck

Switch to using WebRender hit testing

This trades quite a bit of complicated code in Servo for few more
messages and a significant performance improvement. In particular,
WebRender can search the entire display list at once instead of
ping-ponging down the pipeline tree. This allows us to send mouse
events to the correct pipeline immediately.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they should not change behavior.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18704)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-17 17:09:25 -05:00 committed by GitHub
commit ca08271345
20 changed files with 381 additions and 555 deletions

View file

@ -1082,6 +1082,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
debug!("constellation got {:?} WebVR events", events.len());
self.handle_webvr_events(pipeline_ids, events);
}
FromCompositorMsg::ForwardEvent(destination_pipeline_id, event) => {
self.forward_event(destination_pipeline_id, event);
}
FromCompositorMsg::SetCursor(cursor) => {
self.handle_set_cursor_msg(cursor)
}
}
}
@ -1175,15 +1181,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
debug!("constellation got focus message");
self.handle_focus_msg(source_pipeline_id);
}
FromScriptMsg::ForwardEvent(dest_id, event) => {
let msg = ConstellationControlMsg::SendEvent(dest_id, event);
let result = match self.pipelines.get(&dest_id) {
None => { debug!("Pipeline {:?} got event after closure.", dest_id); return; }
Some(pipeline) => pipeline.event_loop.send(msg),
};
if let Err(e) = result {
self.handle_send_error(dest_id, e);
}
FromScriptMsg::ForwardEvent(destination_pipeline_id, event) => {
self.forward_event(destination_pipeline_id, event);
}
FromScriptMsg::GetClipboardContents(sender) => {
let contents = match self.clipboard_ctx {
@ -1250,13 +1249,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
debug!("constellation got Alert message");
self.handle_alert(source_top_ctx_id, message, sender);
}
FromScriptMsg::ScrollFragmentPoint(scroll_root_id, point, smooth) => {
self.compositor_proxy.send(ToCompositorMsg::ScrollFragmentPoint(scroll_root_id,
point,
smooth));
}
FromScriptMsg::GetClientWindow(send) => {
self.embedder_proxy.send(EmbedderMsg::GetClientWindow(source_top_ctx_id, send));
}
@ -1592,6 +1584,20 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
fn forward_event(&mut self, destination_pipeline_id: PipelineId, event: CompositorEvent) {
let msg = ConstellationControlMsg::SendEvent(destination_pipeline_id, event);
let result = match self.pipelines.get(&destination_pipeline_id) {
None => {
debug!("Pipeline {:?} got event after closure.", destination_pipeline_id);
return;
}
Some(pipeline) => pipeline.event_loop.send(msg),
};
if let Err(e) = result {
self.handle_send_error(destination_pipeline_id, e);
}
}
fn handle_new_top_level_browsing_context(&mut self, url: ServoUrl, reply: IpcSender<TopLevelBrowsingContextId>) {
let window_size = self.window_size.initial_viewport;
let pipeline_id = PipelineId::new();