Remove selection methods from nsIDocument -- they were bogus anyway, real selection lives in the pres shell

This commit is contained in:
akkana%netscape.com 1999-06-22 21:47:45 +00:00
parent 1cd82c810c
commit c91c3d0b61
9 changed files with 3 additions and 210 deletions

View File

@ -48,10 +48,10 @@ class nsIParser;
class nsIDOMNode;
class nsXIFConverter;
class nsINameSpaceManager;
class nsIDOMSelection;
class nsIDOMDocumentFragment;
class nsILineBreaker;
class nsIWordBreaker;
class nsIDOMSelection;
// IID for the nsIDocument interface
#define NS_IDOCUMENT_IID \
@ -260,15 +260,6 @@ public:
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule) = 0;
/**
* Returns the Selection Object
*/
NS_IMETHOD GetSelection(nsIDOMSelection ** aSelection) = 0;
/**
* Selects all the Content
*/
NS_IMETHOD SelectAll() = 0;
/**
* Finds text in content
*/

View File

@ -2538,80 +2538,6 @@ void nsDocument::Finalize(JSContext *aContext)
{
}
/**
* Returns the Selection Object
*/
NS_IMETHODIMP nsDocument::GetSelection(nsIDOMSelection ** aSelection) {
if (!aSelection)
return NS_ERROR_NULL_POINTER;
return NS_ERROR_FAILURE;
}
/**
* Selects all the Content
*/
NS_IMETHODIMP nsDocument::SelectAll() {
nsIContent * start = nsnull;
nsIContent * end = nsnull;
nsIContent * body = nsnull;
nsString bodyStr("BODY");
PRInt32 i, n;
mRootContent->ChildCount(n);
for (i=0;i<n;i++) {
nsIContent * child;
mRootContent->ChildAt(i, child);
PRBool isSynthetic;
child->IsSynthetic(isSynthetic);
if (!isSynthetic) {
nsIAtom * atom;
child->GetTag(atom);
if (bodyStr.EqualsIgnoreCase(atom)) {
body = child;
break;
}
NS_IF_RELEASE(atom);
}
NS_RELEASE(child);
}
if (body == nsnull) {
return NS_ERROR_FAILURE;
}
start = body;
// Find Very first Piece of Content
NS_ADDREF(start); //to balance release below
for (;;) {
start->ChildCount(n);
if (n <= 0) {
break;
}
nsIContent * child = start;
child->ChildAt(0, start);
NS_RELEASE(child);
}
end = body;
NS_ADDREF(end); //to balance release below
// Last piece of Content
for (;;) {
end->ChildCount(n);
if (n <= 0) {
break;
}
nsIContent * child = end;
child->ChildAt(n-1, end);
NS_RELEASE(child);
}
NS_RELEASE(body);
SetDisplaySelection(PR_TRUE);
return NS_OK;
}
/**
* Finds text in content
*/

View File

@ -34,7 +34,6 @@
class nsIEventListenerManager;
class nsDOMStyleSheetCollection;
class nsIDOMSelection;
class nsIOutputStream;
class nsDocument;
@ -280,15 +279,6 @@ public:
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
/**
* Returns the Selection Object
*/
NS_IMETHOD GetSelection(nsIDOMSelection ** aSelection);
/**
* Selects all the Content
*/
NS_IMETHOD SelectAll();
/**
* Finds text in content
*/

View File

@ -48,10 +48,10 @@ class nsIParser;
class nsIDOMNode;
class nsXIFConverter;
class nsINameSpaceManager;
class nsIDOMSelection;
class nsIDOMDocumentFragment;
class nsILineBreaker;
class nsIWordBreaker;
class nsIDOMSelection;
// IID for the nsIDocument interface
#define NS_IDOCUMENT_IID \
@ -260,15 +260,6 @@ public:
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule) = 0;
/**
* Returns the Selection Object
*/
NS_IMETHOD GetSelection(nsIDOMSelection ** aSelection) = 0;
/**
* Selects all the Content
*/
NS_IMETHOD SelectAll() = 0;
/**
* Finds text in content
*/

View File

@ -2538,80 +2538,6 @@ void nsDocument::Finalize(JSContext *aContext)
{
}
/**
* Returns the Selection Object
*/
NS_IMETHODIMP nsDocument::GetSelection(nsIDOMSelection ** aSelection) {
if (!aSelection)
return NS_ERROR_NULL_POINTER;
return NS_ERROR_FAILURE;
}
/**
* Selects all the Content
*/
NS_IMETHODIMP nsDocument::SelectAll() {
nsIContent * start = nsnull;
nsIContent * end = nsnull;
nsIContent * body = nsnull;
nsString bodyStr("BODY");
PRInt32 i, n;
mRootContent->ChildCount(n);
for (i=0;i<n;i++) {
nsIContent * child;
mRootContent->ChildAt(i, child);
PRBool isSynthetic;
child->IsSynthetic(isSynthetic);
if (!isSynthetic) {
nsIAtom * atom;
child->GetTag(atom);
if (bodyStr.EqualsIgnoreCase(atom)) {
body = child;
break;
}
NS_IF_RELEASE(atom);
}
NS_RELEASE(child);
}
if (body == nsnull) {
return NS_ERROR_FAILURE;
}
start = body;
// Find Very first Piece of Content
NS_ADDREF(start); //to balance release below
for (;;) {
start->ChildCount(n);
if (n <= 0) {
break;
}
nsIContent * child = start;
child->ChildAt(0, start);
NS_RELEASE(child);
}
end = body;
NS_ADDREF(end); //to balance release below
// Last piece of Content
for (;;) {
end->ChildCount(n);
if (n <= 0) {
break;
}
nsIContent * child = end;
child->ChildAt(n-1, end);
NS_RELEASE(child);
}
NS_RELEASE(body);
SetDisplaySelection(PR_TRUE);
return NS_OK;
}
/**
* Finds text in content
*/

View File

@ -34,7 +34,6 @@
class nsIEventListenerManager;
class nsDOMStyleSheetCollection;
class nsIDOMSelection;
class nsIOutputStream;
class nsDocument;
@ -280,15 +279,6 @@ public:
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
/**
* Returns the Selection Object
*/
NS_IMETHOD GetSelection(nsIDOMSelection ** aSelection);
/**
* Selects all the Content
*/
NS_IMETHOD SelectAll();
/**
* Finds text in content
*/

View File

@ -641,7 +641,7 @@ void JSConsole::OnEditDelete()
//
void JSConsole::OnEditSelectAll()
{
SendMessage(mEditWindow, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
//SendMessage(mEditWindow, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
}
//

View File

@ -497,10 +497,6 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
DoPaste();
break;
case VIEWER_EDIT_SELECTALL:
DoSelectAll();
break;
case VIEWER_EDIT_FINDINPAGE:
DoFind();
break;
@ -982,22 +978,6 @@ nsBrowserWindow::DoFind()
}
void
nsBrowserWindow::DoSelectAll()
{
nsIPresShell* shell = GetPresShell();
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (doc) {
doc->SelectAll();
ForceRefresh();
}
NS_RELEASE(shell);
}
}
//----------------------------------------------------------------------

View File

@ -156,7 +156,6 @@ public:
nsIPresShell* GetPresShell();
void DoFind();
void DoSelectAll();
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
NS_IMETHOD ForceRefresh();