From c7306462ea44bfc696e3d253b77184073c279344 Mon Sep 17 00:00:00 2001 From: "darin%netscape.com" Date: Wed, 31 Oct 2001 06:14:11 +0000 Subject: [PATCH] fixes bug 70519 "Select All (+ Copy) does not clobber the X primary selection" patch=jwbaker@acm.org r=akkana sr=kin git-svn-id: svn://10.0.0.236/trunk@106818 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDocumentViewer.cpp | 8 +------- mozilla/layout/base/nsAutoCopy.cpp | 6 ++++-- mozilla/layout/base/nsDocumentViewer.cpp | 8 +------- mozilla/layout/base/src/nsAutoCopy.cpp | 6 ++++-- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 9479aded0a1..438da264a61 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -4001,13 +4001,7 @@ NS_IMETHODIMP DocumentViewerImpl::SelectAll() rv = selection->RemoveAllRanges(); if (NS_FAILED(rv)) return rv; - static NS_DEFINE_CID(kCDOMRangeCID, NS_RANGE_CID); - nsCOMPtr range = do_CreateInstance(kCDOMRangeCID, &rv); - - rv = range->SelectNodeContents(bodyNode); - if (NS_FAILED(rv)) return rv; - - rv = selection->AddRange(range); + rv = selection->SelectAllChildren(bodyNode); return rv; } diff --git a/mozilla/layout/base/nsAutoCopy.cpp b/mozilla/layout/base/nsAutoCopy.cpp index 69869746966..ed071081aec 100644 --- a/mozilla/layout/base/nsAutoCopy.cpp +++ b/mozilla/layout/base/nsAutoCopy.cpp @@ -131,8 +131,10 @@ nsAutoCopyService::NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aS { nsresult rv; - if (!(aReason & nsISelectionListener::MOUSEUP_REASON)) - return NS_OK; //dont care if we are still dragging. or if its not from a mouseup + if (!(aReason & nsISelectionListener::MOUSEUP_REASON || + aReason & nsISelectionListener::SELECTALL_REASON || + aReason & nsISelectionListener::KEYPRESS_REASON)) + return NS_OK; //dont care if we are still dragging PRBool collapsed; if (!aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed)) || collapsed) { #ifdef DEBUG_CLIPBOARD diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 9479aded0a1..438da264a61 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -4001,13 +4001,7 @@ NS_IMETHODIMP DocumentViewerImpl::SelectAll() rv = selection->RemoveAllRanges(); if (NS_FAILED(rv)) return rv; - static NS_DEFINE_CID(kCDOMRangeCID, NS_RANGE_CID); - nsCOMPtr range = do_CreateInstance(kCDOMRangeCID, &rv); - - rv = range->SelectNodeContents(bodyNode); - if (NS_FAILED(rv)) return rv; - - rv = selection->AddRange(range); + rv = selection->SelectAllChildren(bodyNode); return rv; } diff --git a/mozilla/layout/base/src/nsAutoCopy.cpp b/mozilla/layout/base/src/nsAutoCopy.cpp index 69869746966..ed071081aec 100644 --- a/mozilla/layout/base/src/nsAutoCopy.cpp +++ b/mozilla/layout/base/src/nsAutoCopy.cpp @@ -131,8 +131,10 @@ nsAutoCopyService::NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aS { nsresult rv; - if (!(aReason & nsISelectionListener::MOUSEUP_REASON)) - return NS_OK; //dont care if we are still dragging. or if its not from a mouseup + if (!(aReason & nsISelectionListener::MOUSEUP_REASON || + aReason & nsISelectionListener::SELECTALL_REASON || + aReason & nsISelectionListener::KEYPRESS_REASON)) + return NS_OK; //dont care if we are still dragging PRBool collapsed; if (!aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed)) || collapsed) { #ifdef DEBUG_CLIPBOARD