From 88b02d3d8dfef1c23adab55e9815c08623ceef65 Mon Sep 17 00:00:00 2001 From: David Kettler Date: Tue, 28 Oct 2008 14:00:54 -0400 Subject: [PATCH] Show more links on mouse over Previously only simple links were shown in the echo area when the mouse was hovered over the link. Now image links and links containing formatting will also be shown. An example where this makes a difference is at the conkeror webgit http://repo.or.cz/w/conkeror.git. The git image in the top right corner is clickable but without this patch it doesn't show the link on mouseover. This patch copies the parent chasing code from element_get_load_spec(). That's more expensive than the previous code, but I don't notice any performance degradation on my box. My main concern with the approach though, is that I want a guarantee that the link I see when I hover is what I'll get when I click. But the current code has seperate implementations for these two cases, so the result may differ. I considered calling element_get_load_spec() from the event handler, but it seems rather heavy weight. I wonder if it's possible to hook in while the DOM is being constructed and attach the href from an anchor element to its bottom level child. And do some of the other cases handled by element_get_load_spec() at that time too. Then the simplified element_get_load_spec() and the mouseover event handler need only check the element for a href; they will get the same result. --- modules/content-buffer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/content-buffer.js b/modules/content-buffer.js index dcb4a66..87c99d1 100644 --- a/modules/content-buffer.js +++ b/modules/content-buffer.js @@ -52,8 +52,11 @@ function content_buffer(window, element) }, true /* capture */, false /* ignore untrusted events */); this.browser.addEventListener("mouseover", function (event) { - if (event.target instanceof Ci.nsIDOMHTMLAnchorElement) { - content_buffer_overlink_change_hook.run(buffer, event.target.href); + var node = event.target; + while (node && !(node instanceof Ci.nsIDOMHTMLAnchorElement)) + node = node.parentNode; + if (node) { + content_buffer_overlink_change_hook.run(buffer, node.href); buffer.current_overlink = event.target; } }, true, false); -- 2.11.4.GIT