Newlines in links should be stripped when selecting "Copy Link Location"

bug 77522 r=harishd sr=jst a=asa patch=tmutreja@netscape.com
This commit is contained in:
badami@netscape.com
2002-03-12 05:29:31 +00:00
parent 76a2c848d7
commit 263d89d97f
2 changed files with 8 additions and 0 deletions

View File

@@ -4246,6 +4246,7 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
NS_ENSURE_ARG_POINTER(aNode); NS_ENSURE_ARG_POINTER(aNode);
nsresult rv; nsresult rv;
nsAutoString anchorText; nsAutoString anchorText;
static char strippedChars[] = {'\t','\r','\n'};
// are we an anchor? // are we an anchor?
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(aNode)); nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(aNode));
@@ -4309,6 +4310,9 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv)); clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
//Remove all the '\t', '\r' and '\n' from 'anchorText'
anchorText.StripChars(strippedChars);
// copy the href onto the clipboard // copy the href onto the clipboard
return clipboard->CopyString(anchorText); return clipboard->CopyString(anchorText);
} }

View File

@@ -4246,6 +4246,7 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
NS_ENSURE_ARG_POINTER(aNode); NS_ENSURE_ARG_POINTER(aNode);
nsresult rv; nsresult rv;
nsAutoString anchorText; nsAutoString anchorText;
static char strippedChars[] = {'\t','\r','\n'};
// are we an anchor? // are we an anchor?
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(aNode)); nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(aNode));
@@ -4309,6 +4310,9 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv)); clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
//Remove all the '\t', '\r' and '\n' from 'anchorText'
anchorText.StripChars(strippedChars);
// copy the href onto the clipboard // copy the href onto the clipboard
return clipboard->CopyString(anchorText); return clipboard->CopyString(anchorText);
} }