mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Remove the unused arguments to hit_test and mouse_over.
I don't think this code is called when there is no document element, but I added assertions to make sure we notice in case I was wrong.
This commit is contained in:
parent
0293aa2e52
commit
4e60412c6d
3 changed files with 9 additions and 21 deletions
|
@ -57,7 +57,7 @@ impl LayoutRPC for LayoutRPCImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Requests the node containing the point of interest.
|
/// Requests the node containing the point of interest.
|
||||||
fn hit_test(&self, _: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()> {
|
fn hit_test(&self, point: Point2D<f32>) -> Result<HitTestResponse, ()> {
|
||||||
let point = Point2D::new(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
|
let point = Point2D::new(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
|
||||||
let resp = {
|
let resp = {
|
||||||
let &LayoutRPCImpl(ref rw_data) = self;
|
let &LayoutRPCImpl(ref rw_data) = self;
|
||||||
|
@ -82,8 +82,7 @@ impl LayoutRPC for LayoutRPCImpl {
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mouse_over(&self, _: TrustedNodeAddress, point: Point2D<f32>)
|
fn mouse_over(&self, point: Point2D<f32>) -> Result<MouseOverResponse, ()> {
|
||||||
-> Result<MouseOverResponse, ()> {
|
|
||||||
let mut mouse_over_list: Vec<DisplayItemMetadata> = vec!();
|
let mut mouse_over_list: Vec<DisplayItemMetadata> = vec!();
|
||||||
let point = Point2D::new(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
|
let point = Point2D::new(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
|
||||||
{
|
{
|
||||||
|
|
|
@ -483,30 +483,19 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hit_test(&self, point: &Point2D<f32>) -> Option<UntrustedNodeAddress> {
|
pub fn hit_test(&self, point: &Point2D<f32>) -> Option<UntrustedNodeAddress> {
|
||||||
let root = self.GetDocumentElement();
|
assert!(self.GetDocumentElement().is_some());
|
||||||
let root = match root.r() {
|
match self.window.layout().hit_test(*point) {
|
||||||
Some(root) => root,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
let root = root.upcast::<Node>();
|
|
||||||
let address = match self.window.layout().hit_test(root.to_trusted_node_address(), *point) {
|
|
||||||
Ok(HitTestResponse(node_address)) => Some(node_address),
|
Ok(HitTestResponse(node_address)) => Some(node_address),
|
||||||
Err(()) => {
|
Err(()) => {
|
||||||
debug!("layout query error");
|
debug!("layout query error");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
address
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_nodes_under_mouse(&self, point: &Point2D<f32>) -> Vec<UntrustedNodeAddress> {
|
pub fn get_nodes_under_mouse(&self, point: &Point2D<f32>) -> Vec<UntrustedNodeAddress> {
|
||||||
let root = self.GetDocumentElement();
|
assert!(self.GetDocumentElement().is_some());
|
||||||
let root = match root.r() {
|
match self.window.layout().mouse_over(*point) {
|
||||||
Some(root) => root,
|
|
||||||
None => return vec!(),
|
|
||||||
};
|
|
||||||
let root = root.upcast::<Node>();
|
|
||||||
match self.window.layout().mouse_over(root.to_trusted_node_address(), *point) {
|
|
||||||
Ok(MouseOverResponse(node_address)) => node_address,
|
Ok(MouseOverResponse(node_address)) => node_address,
|
||||||
Err(()) => vec!(),
|
Err(()) => vec!(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,8 @@ pub trait LayoutRPC {
|
||||||
/// Requests the geometry of this node. Used by APIs such as `clientTop`.
|
/// Requests the geometry of this node. Used by APIs such as `clientTop`.
|
||||||
fn node_geometry(&self) -> NodeGeometryResponse;
|
fn node_geometry(&self) -> NodeGeometryResponse;
|
||||||
/// Requests the node containing the point of interest
|
/// Requests the node containing the point of interest
|
||||||
fn hit_test(&self, node: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()>;
|
fn hit_test(&self, point: Point2D<f32>) -> Result<HitTestResponse, ()>;
|
||||||
fn mouse_over(&self, node: TrustedNodeAddress, point: Point2D<f32>) -> Result<MouseOverResponse, ()>;
|
fn mouse_over(&self, point: Point2D<f32>) -> Result<MouseOverResponse, ()>;
|
||||||
/// Query layout for the resolved value of a given CSS property
|
/// Query layout for the resolved value of a given CSS property
|
||||||
fn resolved_style(&self) -> ResolvedStyleResponse;
|
fn resolved_style(&self) -> ResolvedStyleResponse;
|
||||||
fn offset_parent(&self) -> OffsetParentResponse;
|
fn offset_parent(&self) -> OffsetParentResponse;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue