From 49cd5a1fff8aabcdfd72974c59443ee835103ffc Mon Sep 17 00:00:00 2001 From: "glazman%netscape.com" Date: Fri, 8 Nov 2002 09:14:00 +0000 Subject: [PATCH] show tooltip for href (links), src (images) and name (named anchors) in Composer; b=47519, fix by glazman@netscape.com and neil@parkwaycc.co.uk, r=brade, r=glazman for kin's changes, sr=kin git-svn-id: svn://10.0.0.236/trunk@133391 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/ui/composer/content/editor.js | 24 +++++++++++++++++-- mozilla/editor/ui/composer/content/editor.xul | 5 +++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mozilla/editor/ui/composer/content/editor.js b/mozilla/editor/ui/composer/content/editor.js index 4e3e901baaf..237c12d9573 100644 --- a/mozilla/editor/ui/composer/content/editor.js +++ b/mozilla/editor/ui/composer/content/editor.js @@ -3073,8 +3073,11 @@ function GetSelectionContainer() var editor = GetCurrentEditor(); if (!editor) return null; - var selection = editor.selection; - if (!selection) return null; + try { + var selection = editor.selection; + if (!selection) return null; + } + catch (e) { return null; } var result = { oneElementSelected:false }; @@ -3139,3 +3142,20 @@ function GetSelectionContainer() return result; } + +function FillInHTMLTooltip(tooltip) +{ + var tooltipText = null; + for (var node = document.tooltipNode; node; node = node.parentNode) { + if (node instanceof Components.interfaces.nsIDOMHTMLImageElement || + node instanceof Components.interfaces.nsIDOMHTMLInputElement) + tooltipText = node.getAttribute("src"); + else if (node instanceof Components.interfaces.nsIDOMHTMLAnchorElement) + tooltipText = node.getAttribute("href") || node.name; + if (tooltipText) { + tooltip.setAttribute("label", tooltipText); + return true; + } + } + return false; +} diff --git a/mozilla/editor/ui/composer/content/editor.xul b/mozilla/editor/ui/composer/content/editor.xul index 6ebc268f4be..5a5f9a8dc11 100644 --- a/mozilla/editor/ui/composer/content/editor.xul +++ b/mozilla/editor/ui/composer/content/editor.xul @@ -97,6 +97,8 @@ + + @@ -245,7 +247,8 @@ which breaks deck frame-hiding mechanism --> - +