diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-10-17 17:09:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-17 17:09:25 -0500 |
commit | ca08271345f78fa881c174545f5b69a8ccb78143 (patch) | |
tree | 6e1244687e960df40313b3a24a167135654dae31 /components/layout/query.rs | |
parent | 0e62a5829b7c29ae2667a21a439aff1e89201bf3 (diff) | |
parent | b5d51dd2636935471447fc741ffbb95c62e37f94 (diff) | |
download | servo-ca08271345f78fa881c174545f5b69a8ccb78143.tar.gz servo-ca08271345f78fa881c174545f5b69a8ccb78143.zip |
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 -->
Diffstat (limited to 'components/layout/query.rs')
-rw-r--r-- | components/layout/query.rs | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/components/layout/query.rs b/components/layout/query.rs index c08befb5b7a..e6d2e250468 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -10,16 +10,15 @@ use context::LayoutContext; use euclid::{Point2D, Vector2D, Rect, Size2D}; use flow::{self, Flow}; use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; -use gfx::display_list::{DisplayItemMetadata, DisplayList, OpaqueNode, ScrollOffsetMap}; +use gfx::display_list::{DisplayList, OpaqueNode, ScrollOffsetMap}; use inline::LAST_FRAGMENT_OF_ELEMENT; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; use opaque_node::OpaqueNodeMethods; -use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse}; -use script_layout_interface::rpc::{HitTestResponse, LayoutRPC}; +use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC}; use script_layout_interface::rpc::{MarginStyleResponse, NodeGeometryResponse}; -use script_layout_interface::rpc::{NodeOverflowResponse, OffsetParentResponse}; -use script_layout_interface::rpc::{NodeScrollRootIdResponse, ResolvedStyleResponse, TextIndexResponse}; +use script_layout_interface::rpc::{NodeOverflowResponse, NodeScrollRootIdResponse}; +use script_layout_interface::rpc::{OffsetParentResponse, ResolvedStyleResponse, TextIndexResponse}; use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use script_traits::LayoutMsg as ConstellationMsg; use script_traits::UntrustedNodeAddress; @@ -35,7 +34,6 @@ use style::properties::{style_structs, PropertyId, PropertyDeclarationId, Longha use style::properties::longhands::{display, position}; use style::selector_parser::PseudoElement; use style_traits::ToCss; -use style_traits::cursor::Cursor; use webrender_api::ClipId; use wrapper::LayoutNodeLayoutData; @@ -58,9 +56,6 @@ pub struct LayoutThreadData { /// A queued response for the client {top, left, width, height} of a node in pixels. pub client_rect_response: Rect<i32>, - /// A queued response for the node at a given point - pub hit_test_response: (Option<DisplayItemMetadata>, bool), - /// A queued response for the scroll root id for a given node. pub scroll_root_id_response: Option<ClipId>, @@ -119,24 +114,6 @@ impl LayoutRPC for LayoutRPCImpl { ContentBoxesResponse(rw_data.content_boxes_response.clone()) } - /// Requests the node containing the point of interest. - fn hit_test(&self) -> HitTestResponse { - let &LayoutRPCImpl(ref rw_data) = self; - let rw_data = rw_data.lock().unwrap(); - let &(ref result, update_cursor) = &rw_data.hit_test_response; - if update_cursor { - // Compute the new cursor. - let cursor = match *result { - None => Cursor::Default, - Some(dim) => dim.pointing.unwrap(), - }; - rw_data.constellation_chan.send(ConstellationMsg::SetCursor(cursor)).unwrap(); - } - HitTestResponse { - node_address: result.map(|dim| dim.node.to_untrusted_node_address()), - } - } - fn nodes_from_point_response(&self) -> Vec<UntrustedNodeAddress> { let &LayoutRPCImpl(ref rw_data) = self; let rw_data = rw_data.lock().unwrap(); |