Bug 546808 - "focusing a link title on the result page of google.fr should highlight the entire link" [r=mark.finkle]
authorVivien Nicolas <21@vingtetun.org>
Thu, 16 Sep 2010 16:24:00 -0400
changeset 66727 b9bbadbcde71fc9081282f27ae7d7aeff8476d37
parent 66726 c61be6016e7eddaa6ef20cbf66bb613ad5a0dbfe
child 66728 a82b1849d414090a316dddf43085afd77f7af40a
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmark
bugs546808
Bug 546808 - "focusing a link title on the result page of google.fr should highlight the entire link" [r=mark.finkle]
mobile/chrome/content/content.js
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -374,20 +374,24 @@ Content.prototype = {
         }
         break;
 
       case "Browser:MouseDown": {
         let element = elementFromPoint(x, y);
         if (!element)
           return;
 
-        if (element.mozMatchesSelector("*:link,*:visited,*:link *,*:visited *,*[role=button],button,input,option,select,textarea,label")) {
-          let rects = getContentClientRects(element);
-          sendAsyncMessage("Browser:Highlight", { rects: rects, messageId: json.messageId });
-        }
+        let highlightRects = null;
+        if (element.mozMatchesSelector("*:link,*:visited,*[role=button],button,input,option,select,textarea,label"))
+          highlightRects = getContentClientRects(element);
+        else if (element.mozMatchesSelector("*:link *, *:visited *"))
+          highlightRects = getContentClientRects(element.parentNode);
+
+        if (highlightRects)
+          sendAsyncMessage("Browser:Highlight", { rects: highlightRects, messageId: json.messageId });
 
         ContextHandler.messageId = json.messageId;
 
         let event = content.document.createEvent("PopupEvents");
         event.initEvent("contextmenu", true, true);
         element.dispatchEvent(event);
         break;
       }