Auto merge of #8326 - jdm:iframehover, r=glennw

Send mouse move events to the the previous layer when directing event…

…s to a new one for the first time. Resolves #7865.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8326)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-06 06:24:59 +05:30
commit 4067960ba5
4 changed files with 41 additions and 12 deletions

View file

@ -669,10 +669,12 @@ impl Document {
pub fn handle_mouse_move_event(&self,
js_runtime: *mut JSRuntime,
point: Point2D<f32>,
point: Option<Point2D<f32>>,
prev_mouse_over_targets: &mut RootedVec<JS<Element>>) {
// Build a list of elements that are currently under the mouse.
let mouse_over_addresses = self.get_nodes_under_mouse(&point);
let mouse_over_addresses = point.as_ref()
.map(|point| self.get_nodes_under_mouse(point))
.unwrap_or(vec![]);
let mut mouse_over_targets = mouse_over_addresses.iter().map(|node_address| {
node::from_untrusted_node_address(js_runtime, *node_address)
.inclusive_ancestors()
@ -691,7 +693,11 @@ impl Document {
let target = target_ref.upcast();
self.fire_mouse_event(point, &target, "mouseout".to_owned());
// FIXME: we should be dispatching this event but we lack an actual
// point to pass to it.
if let Some(point) = point {
self.fire_mouse_event(point, &target, "mouseout".to_owned());
}
}
}
}
@ -705,8 +711,9 @@ impl Document {
let target = target.upcast();
self.fire_mouse_event(point, target, "mouseover".to_owned());
if let Some(point) = point {
self.fire_mouse_event(point, target, "mouseover".to_owned());
}
}
}
@ -716,7 +723,9 @@ impl Document {
node::from_untrusted_node_address(js_runtime, mouse_over_addresses[0]);
let target = top_most_node.upcast();
self.fire_mouse_event(point, target, "mousemove".to_owned());
if let Some(point) = point {
self.fire_mouse_event(point, target, "mousemove".to_owned());
}
}
// Store the current mouse over targets for next frame