mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
compositing: Implement cursor
per CSS3-UI § 8.1.1 in the CEF/Mac port.
I'm not sure how we want to handle Linux cursors, and GLFW has no ability to set cursors (short of disabling it and managing it yourself).
This commit is contained in:
parent
636641f905
commit
7371e0b8e3
23 changed files with 564 additions and 171 deletions
|
@ -1150,7 +1150,6 @@ impl ScriptTask {
|
|||
let page = get_page(&*self.page.borrow(), pipeline_id);
|
||||
match page.get_nodes_under_mouse(&point) {
|
||||
Some(node_address) => {
|
||||
|
||||
let mut target_list = vec!();
|
||||
let mut target_compare = false;
|
||||
|
||||
|
@ -1166,23 +1165,19 @@ impl ScriptTask {
|
|||
}
|
||||
|
||||
for node_address in node_address.iter() {
|
||||
|
||||
let temp_node =
|
||||
node::from_untrusted_node_address(
|
||||
self.js_runtime.ptr, *node_address);
|
||||
node::from_untrusted_node_address(self.js_runtime.ptr, *node_address);
|
||||
|
||||
let maybe_node = temp_node.root().ancestors().find(|node| node.is_element());
|
||||
match maybe_node {
|
||||
Some(node) => {
|
||||
node.set_hover_state(true);
|
||||
|
||||
match *mouse_over_targets {
|
||||
Some(ref mouse_over_targets) => {
|
||||
if !target_compare {
|
||||
target_compare = !mouse_over_targets.contains(&JS::from_rooted(node));
|
||||
}
|
||||
Some(ref mouse_over_targets) if !target_compare => {
|
||||
target_compare =
|
||||
!mouse_over_targets.contains(&JS::from_rooted(node));
|
||||
}
|
||||
None => {}
|
||||
_ => {}
|
||||
}
|
||||
target_list.push(JS::from_rooted(node));
|
||||
}
|
||||
|
@ -1192,15 +1187,15 @@ impl ScriptTask {
|
|||
match *mouse_over_targets {
|
||||
Some(ref mouse_over_targets) => {
|
||||
if mouse_over_targets.len() != target_list.len() {
|
||||
target_compare = true;
|
||||
target_compare = true
|
||||
}
|
||||
}
|
||||
None => { target_compare = true; }
|
||||
None => target_compare = true,
|
||||
}
|
||||
|
||||
if target_compare {
|
||||
if mouse_over_targets.is_some() {
|
||||
self.force_reflow(&*page);
|
||||
self.force_reflow(&*page)
|
||||
}
|
||||
*mouse_over_targets = Some(target_list);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue