Fixed context menus to work when right clicking over image links. Detabbed file too. b=114427 r=chak@netscape.com sr=blizzard@mozilla.org

This commit is contained in:
locka%iol.ie 2002-01-08 12:15:09 +00:00
Родитель 61aed7e6fd
Коммит ab43b4f842
1 изменённых файлов: 208 добавлений и 195 удалений

Просмотреть файл

@ -361,8 +361,21 @@ void CBrowserFrame::BrowserFrameGlueObj::ShowContextMenu(PRUint32 aContextFlags,
// 1. We first get the nsIDOMHTMLAnchorElement
// 2. We then get the URL associated with the link
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLAnchorElement> linkElement(do_QueryInterface(aNode, &rv));
if(NS_FAILED(rv))
// Search for an anchor element
nsCOMPtr<nsIDOMHTMLAnchorElement> linkElement;
nsCOMPtr<nsIDOMNode> node = aNode;
while (node)
{
linkElement = do_QueryInterface(node);
if (linkElement)
break;
nsCOMPtr<nsIDOMNode> parentNode;
node->GetParentNode(getter_AddRefs(parentNode));
node = parentNode;
}
if (!linkElement)
return;
rv = linkElement->GetHref(strUrlUcs2);