aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-02-20 20:19:13 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-03-02 20:01:41 +0100
commitb1f05816373f5e68ce242e0b1a45a50851f868bb (patch)
tree2eb8c7ddedefb7cb5c1767883836e386a9270795 /components/layout
parent9ceda7de509d3dff01a766077011207f94ffadfd (diff)
downloadservo-b1f05816373f5e68ce242e0b1a45a50851f868bb.tar.gz
servo-b1f05816373f5e68ce242e0b1a45a50851f868bb.zip
script: Fix MouseOver handling
Now we only query for the topmost node, and apply the hover state to all of the parent elements. This fixes things like #9705, where the hover state was applied only to the children. This also makes us more conformant with other browsers in the case of taking in account margins and paddings. For example, prior to this PR, when your mouse was over the inner element, in the bottom part, `hover` styles didn't apply to the parent. ```html <style> div { padding: 10px; margin: 10px; height: 15px; background: blue; } div:hover { background: red; } </style> <div> <div></div> </div> ``` Fixes #9705
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/query.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/components/layout/query.rs b/components/layout/query.rs
index 348a3ad556d..54acfe92e90 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -107,11 +107,8 @@ impl LayoutRPC for LayoutRPCImpl {
if mouse_over_list.is_empty() {
Err(())
} else {
- let response_list =
- mouse_over_list.iter()
- .map(|metadata| metadata.node.to_untrusted_node_address())
- .collect();
- Ok(MouseOverResponse(response_list))
+ let response = mouse_over_list[0].node.to_untrusted_node_address();
+ Ok(MouseOverResponse(response))
}
}