Rename nsISelection to nsIFrameSelection

This commit is contained in:
akkana%netscape.com 1999-02-11 23:12:28 +00:00
Родитель 8d5d1fad54
Коммит 7982a421d6
34 изменённых файлов: 189 добавлений и 179 удалений

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

@ -48,7 +48,7 @@ class nsIParser;
class nsIDOMNode;
class nsXIFConverter;
class nsINameSpaceManager;
class nsISelection;
class nsIDOMSelection;
class nsIDOMDocumentFragment;
// IID for the nsIDocument interface
@ -223,7 +223,7 @@ public:
/**
* Returns the Selection Object
*/
NS_IMETHOD GetSelection(nsISelection ** aSelection) = 0;
NS_IMETHOD GetSelection(nsIDOMSelection ** aSelection) = 0;
/**
* Selects all the Content
*/
@ -242,7 +242,7 @@ public:
* NOTE: we may way to place the result in a stream,
* but we will use a string for now -- gpk
*/
virtual void CreateXIF(nsString & aBuffer, nsISelection* aSelection = nsnull) = 0;
virtual void CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0;
virtual void ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
virtual void BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
virtual void ConvertChildrenToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
@ -251,7 +251,7 @@ public:
/* Helper methods to help determine the logical positioning of content */
virtual PRBool IsInRange(const nsIContent *aStartContent, const nsIContent* aEndContent, const nsIContent* aContent) const = 0;
virtual PRBool IsBefore(const nsIContent *aNewContent, const nsIContent* aCurrentContent) const = 0;
virtual PRBool IsInSelection(nsISelection* aSelection, const nsIContent *aContent) const = 0;
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const = 0;
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const = 0;
virtual nsIContent* GetNextContent(const nsIContent *aContent) const = 0;
virtual void SetDisplaySelection(PRBool aToggle) = 0;

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

@ -63,7 +63,7 @@
#include "nsIServiceManager.h"
#include "nsLayoutCID.h"
#include "nsISelection.h"
#include "nsIDOMSelection.h"
#include "nsIDOMRange.h"
#include "nsIEnumerator.h"
@ -1899,7 +1899,7 @@ void nsDocument::Finalize(JSContext *aContext)
/**
* Returns the Selection Object
*/
NS_IMETHODIMP nsDocument::GetSelection(nsISelection ** aSelection) {
NS_IMETHODIMP nsDocument::GetSelection(nsIDOMSelection ** aSelection) {
if (!aSelection)
return NS_ERROR_NULL_POINTER;
return NS_ERROR_FAILURE;
@ -2034,7 +2034,7 @@ void nsDocument::FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNod
void nsDocument::ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
{
nsISelection* sel = aConverter.GetSelection();
nsIDOMSelection* sel = aConverter.GetSelection();
if (sel != nsnull)
{
@ -2066,7 +2066,7 @@ void nsDocument::ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
}
}
void nsDocument::CreateXIF(nsString & aBuffer, nsISelection* aSelection)
void nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
{
nsXIFConverter converter(aBuffer);
@ -2154,7 +2154,7 @@ PRBool nsDocument::IsInRange(const nsIContent *aStartContent, const nsIContent*
* @param param -- description
* @return PR_TRUE if the content is found within the selection
*/
PRBool nsDocument::IsInSelection(nsISelection* aSelection, const nsIContent* aContent) const
PRBool nsDocument::IsInSelection(nsIDOMSelection* aSelection, const nsIContent* aContent) const
{
PRBool result = PR_FALSE;

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

@ -31,7 +31,7 @@
class nsIEventListenerManager;
class nsDOMStyleSheetCollection;
class nsISelection;
class nsIDOMSelection;
class nsPostData : public nsIPostData {
@ -230,7 +230,7 @@ public:
/**
* Returns the Selection Object
*/
NS_IMETHOD GetSelection(nsISelection ** aSelection);
NS_IMETHOD GetSelection(nsIDOMSelection ** aSelection);
/**
* Selects all the Content
*/
@ -246,7 +246,7 @@ public:
* document to XIF (XML Interchange Format)
* and places the result in aBuffer.
*/
virtual void CreateXIF(nsString & aBuffer, nsISelection* aSelection);
virtual void CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
virtual void ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
virtual void BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
virtual void ConvertChildrenToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
@ -312,7 +312,7 @@ public:
virtual PRBool IsInRange(const nsIContent *aStartContent, const nsIContent* aEndContent, const nsIContent* aContent) const;
virtual PRBool IsInSelection(nsISelection* aSelection, const nsIContent *aContent) const;
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
virtual PRBool IsBefore(const nsIContent *aNewContent, const nsIContent* aCurrentContent) const;
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const;
virtual nsIContent* GetNextContent(const nsIContent *aContent) const;

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

@ -28,7 +28,7 @@
#include "nsSelectionRange.h"
#include "nsRange.h"
#include "nsISelection.h"
#include "nsIDOMSelection.h"
#include "nsIEnumerator.h"
@ -478,7 +478,7 @@ nsresult
nsGenericDOMDataNode::ConvertContentToXIF(nsXIFConverter& aConverter) const
{
const nsIContent* content = mContent;
nsISelection* sel = aConverter.GetSelection();
nsIDOMSelection* sel = aConverter.GetSelection();
if (sel != nsnull && mDocument->IsInSelection(sel,content))
{

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

@ -67,7 +67,7 @@ nsresult nsMarkupDocument::CreateShell(nsIPresContext* aContext,
return rv;
}
if (NS_OK != shell->Init(this, aContext, aViewManager, aStyleSet)) {
if (NS_OK != (rv = shell->Init(this, aContext, aViewManager, aStyleSet))) {
NS_RELEASE(shell);
return rv;
}
@ -243,7 +243,7 @@ void nsMarkupDocument::FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode
void nsMarkupDocument::ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
{
nsISelection* sel = aConverter.GetSelection();
nsIDOMSelection* sel = aConverter.GetSelection();
if (sel != nsnull)
{
@ -275,7 +275,7 @@ void nsMarkupDocument::ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
}
void nsMarkupDocument::CreateXIF(nsString & aBuffer, nsISelection* aSelection)
void nsMarkupDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
{
nsDocument::CreateXIF(aBuffer,aSelection);
}

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

@ -49,7 +49,7 @@ public:
* NOTE: we may way to place the result in a stream,
* but we will use a string for now -- gpk
*/
virtual void CreateXIF(nsString & aBuffer, nsISelection* aSelection);
virtual void CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
virtual void ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
virtual void FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);

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

@ -55,7 +55,7 @@
#include "nsIRDFService.h"
#include "nsIRDFXMLDataSource.h"
#include "nsIScriptContextOwner.h"
#include "nsISelection.h"
#include "nsIDOMSelection.h"
#include "nsIServiceManager.h"
#include "nsIStreamListener.h"
#include "nsIStyleSet.h"
@ -92,7 +92,7 @@ static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
static NS_DEFINE_IID(kIRDFXMLDataSourceIID, NS_IRDFXMLDATASOURCE_IID);
static NS_DEFINE_IID(kISelectionIID, NS_ISELECTION_IID);
static NS_DEFINE_IID(kIDOMSelectionIID, NS_IDOMSELECTION_IID);
static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID);
static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -402,13 +402,13 @@ public:
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
NS_IMETHOD GetSelection(nsISelection** aSelection);
NS_IMETHOD GetSelection(nsIDOMSelection** aSelection);
NS_IMETHOD SelectAll();
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
virtual void CreateXIF(nsString & aBuffer, nsISelection* aSelection);
virtual void CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
virtual void ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
@ -422,7 +422,7 @@ public:
virtual PRBool IsBefore(const nsIContent *aNewContent, const nsIContent* aCurrentContent) const;
virtual PRBool IsInSelection(nsISelection* aSelection, const nsIContent *aContent) const;
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const;
@ -498,7 +498,7 @@ protected:
nsIScriptContextOwner* mScriptContextOwner;
nsString* mCharSetID;
nsVoidArray mStyleSheets;
nsISelection* mSelection;
nsIDOMSelection* mSelection;
PRBool mDisplaySelection;
nsVoidArray mPresShells;
nsINameSpaceManager* mNameSpaceManager;
@ -637,7 +637,7 @@ XULDocumentImpl::XULDocumentImpl(void)
// construct a selection object
if (NS_FAILED(rv = nsRepository::CreateInstance(kRangeListCID,
nsnull,
kISelectionIID,
kIDOMSelectionIID,
(void**) &mSelection)))
PR_ASSERT(0);
@ -1382,7 +1382,7 @@ XULDocumentImpl::StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
}
NS_IMETHODIMP
XULDocumentImpl::GetSelection(nsISelection** aSelection)
XULDocumentImpl::GetSelection(nsIDOMSelection** aSelection)
{
if (!mSelection) {
PR_ASSERT(0);
@ -1473,7 +1473,7 @@ XULDocumentImpl::FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool
}
void
XULDocumentImpl::CreateXIF(nsString & aBuffer, nsISelection* aSelection)
XULDocumentImpl::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
{
PR_ASSERT(0);
}
@ -1537,7 +1537,7 @@ XULDocumentImpl::IsBefore(const nsIContent *aNewContent, const nsIContent* aCurr
}
PRBool
XULDocumentImpl::IsInSelection(nsISelection* aSelection, const nsIContent *aContent) const
XULDocumentImpl::IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const
{
PRBool result = PR_FALSE;

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

@ -20,7 +20,6 @@
#include "editor.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMSelection.h"
#include "nsISelection.h"
#include "nsIPresShell.h"
static NS_DEFINE_IID(kInsertTextTxnIID, INSERT_TEXT_TXN_IID);
@ -48,14 +47,10 @@ nsresult InsertTextTxn::Do(void)
{
nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
nsCOMPtr<nsISelection> frameSelection;
res = mPresShell->GetSelection(getter_AddRefs(frameSelection));
nsCOMPtr<nsIDOMSelection> selection;
res = mPresShell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(res))
{
nsCOMPtr<nsIDOMSelection> selection;
res = frameSelection->QueryInterface(kIDOMSelectionIID,
getter_AddRefs(selection));
if (NS_SUCCEEDED(res))
res = selection->Collapse(mElement, mOffset+mStringToInsert.Length());
// We know mOffset+Length should be there
// because we just added that many characters.

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

@ -34,7 +34,6 @@
#include "nsITransactionManager.h"
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsISelection.h"
#include "nsIDOMSelection.h"
#include "nsICollection.h"
#include "nsIEnumerator.h"
@ -714,32 +713,13 @@ nsresult nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aParent,
return result;
}
//
// Convenience routine since we use it here and there
//
static nsCOMPtr<nsIDOMSelection>
getDOMSelection(nsIPresShell* presShell)
{
nsCOMPtr<nsIDOMSelection> selection; // will be the return value
nsresult result;
nsCOMPtr<nsISelection> frameSelection;
result = presShell->GetSelection(getter_AddRefs(frameSelection));
if ((!NS_SUCCEEDED(result)) || !frameSelection)
return selection;
frameSelection->QueryInterface(kIDOMSelectionIID,
getter_AddRefs(selection));
return selection;
}
nsresult
nsEditor::InsertText(const nsString& aStringToInsert)
{
nsresult result;
nsCOMPtr<nsIDOMSelection> selection = getDOMSelection(mPresShell);
if (selection)
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(result) && selection)
{
PRBool collapsed;
result = selection->IsCollapsed(&collapsed);
@ -759,7 +739,7 @@ nsresult nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
InsertTextTxn ** aTxn)
{
nsresult result;
nsCOMPtr<nsISelection> selection;
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if ((NS_SUCCEEDED(result)) && selection)
{
@ -857,7 +837,7 @@ nsresult nsEditor::CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn)
{
return result;
}
nsCOMPtr<nsISelection> selection;
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if ((NS_SUCCEEDED(result)) && selection)
{
@ -929,9 +909,10 @@ nsEditor::DeleteSelection(nsIEditor::Direction aDir)
#else
// XXX Warning, this should be moved to a transaction since
// calling it this way means undo won't work.
nsCOMPtr<nsIDOMSelection> domSelection = getDOMSelection(mPresShell);
if (domSelection)
result = domSelection->DeleteFromDocument();
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(result) && selection)
result = selection->DeleteFromDocument();
#endif
return result;
@ -947,7 +928,7 @@ nsresult nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
{
return result;
}
nsCOMPtr<nsISelection> selection;
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if ((NS_SUCCEEDED(result)) && selection)
{

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

@ -20,7 +20,6 @@
#include "editor.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMSelection.h"
#include "nsISelection.h"
#include "nsIPresShell.h"
static NS_DEFINE_IID(kInsertTextTxnIID, INSERT_TEXT_TXN_IID);
@ -48,14 +47,10 @@ nsresult InsertTextTxn::Do(void)
{
nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
nsCOMPtr<nsISelection> frameSelection;
res = mPresShell->GetSelection(getter_AddRefs(frameSelection));
nsCOMPtr<nsIDOMSelection> selection;
res = mPresShell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(res))
{
nsCOMPtr<nsIDOMSelection> selection;
res = frameSelection->QueryInterface(kIDOMSelectionIID,
getter_AddRefs(selection));
if (NS_SUCCEEDED(res))
res = selection->Collapse(mElement, mOffset+mStringToInsert.Length());
// We know mOffset+Length should be there
// because we just added that many characters.

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

@ -32,7 +32,7 @@ class nsIReflowCommand;
class nsIDeviceContext;
class nsIRenderingContext;
class nsIPageSequenceFrame;
class nsISelection;
class nsIDOMSelection;
class nsString;
class nsStringArray;
@ -75,10 +75,10 @@ public:
*/
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList) = 0;
/** GetSelection will return the selection that the presentation shell may implement.
/** GetSelection will return the selection in the presentation shell.
* @param aSelection will hold the return value
*/
virtual nsresult GetSelection(nsISelection **aSelection) = 0;
virtual nsresult GetSelection(nsIDOMSelection **aSelection) = 0;
NS_IMETHOD EnterReflowLock() = 0;

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

@ -40,7 +40,8 @@
#include "nsIEventStateManager.h"
#include "nsDOMEvent.h"
#include "nsHTMLParts.h"
#include "nsISelection.h"
#include "nsIFrameSelection.h"
#include "nsIDOMSelection.h"
#include "nsLayoutCID.h"
#include "nsIDOMRange.h"
#include "nsIDOMDocument.h"
@ -158,7 +159,8 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIPresShellIID, NS_IPRESSHELL_IID);
static NS_DEFINE_IID(kIDocumentObserverIID, NS_IDOCUMENT_OBSERVER_IID);
static NS_DEFINE_IID(kIViewObserverIID, NS_IVIEWOBSERVER_IID);
static NS_DEFINE_IID(kISelectionIID, NS_ISELECTION_IID);
static NS_DEFINE_IID(kIFrameSelectionIID, NS_IFRAMESELECTION_IID);
static NS_DEFINE_IID(kIDOMSelectionIID, NS_IDOMSELECTION_IID);
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIDOMRangeIID, NS_IDOMRANGE_IID);
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
@ -243,7 +245,7 @@ public:
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle);
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle);
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList);
virtual nsresult GetSelection(nsISelection **aSelection);
virtual nsresult GetSelection(nsIDOMSelection **aSelection);
NS_IMETHOD EnterReflowLock();
NS_IMETHOD ExitReflowLock();
NS_IMETHOD BeginObservingDocument();
@ -308,7 +310,7 @@ protected:
nsIFrame* mCurrentEventFrame;
nsIFrame* mFocusEventFrame; //keeps track of which frame has focus.
nsIFrame* mAnchorEventFrame; //keeps track of which frame has focus.
nsCOMPtr <nsISelection>mSelection;
nsCOMPtr <nsIFrameSelection>mSelection;
FrameHashTable* mPlaceholderMap;
};
@ -490,10 +492,17 @@ PresShell::Init(nsIDocument* aDocument,
mStyleSet = aStyleSet;
NS_ADDREF(aStyleSet);
nsCOMPtr<nsISelection>selection;
nsresult result = nsRepository::CreateInstance(kRangeListCID, nsnull, kISelectionIID, getter_AddRefs(selection));
nsCOMPtr<nsIDOMSelection>domselection;
nsresult result = nsRepository::CreateInstance(kRangeListCID, nsnull,
kIDOMSelectionIID,
getter_AddRefs(domselection));
if (!NS_SUCCEEDED(result))
return result;
result = domselection->QueryInterface(kIDOMSelectionIID,
getter_AddRefs(mSelection));
if (!NS_SUCCEEDED(result))
return result;
// XXX This code causes the document object (and the entire content model) to be leaked...
#if 0
nsCOMPtr<nsIDOMRange>range;
@ -516,7 +525,6 @@ PresShell::Init(nsIDocument* aDocument,
}
}
#endif
mSelection = selection;
return NS_OK;
}
@ -654,11 +662,11 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
}
nsresult
PresShell::GetSelection(nsISelection **aSelection)
PresShell::GetSelection(nsIDOMSelection **aSelection)
{
if (!aSelection || !mSelection)
return NS_ERROR_NULL_POINTER;
return mSelection->QueryInterface(kISelectionIID,(void **)aSelection);
return mSelection->QueryInterface(kIDOMSelectionIID,(void **)aSelection);
}

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

@ -9,6 +9,7 @@ nsIDocumentObserver.h
nsIDOMSelection.h
nsIFocusTracker.h
nsIFrame.h
nsIFrameSelection.h
nsIFrameUtil.h
nsIFrameImageLoader.h
nsINameSpace.h
@ -17,7 +18,6 @@ nsIPageSequenceFrame.h
nsIPresContext.h
nsIPresShell.h
nsIReflowCommand.h
nsISelection.h
nsISpaceManager.h
nsLayoutAtoms.h
nsStyleCoord.h

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

@ -41,7 +41,7 @@ EXPORTS = \
nsIPresContext.h \
nsIPresShell.h \
nsIReflowCommand.h \
nsISelection.h \
nsIFrameSelection.h \
nsIDOMSelection.h \
nsISpaceManager.h \
nsIStyleContext.h \

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

@ -34,7 +34,7 @@ EXPORTS = \
nsIPresContext.h \
nsIPresShell.h \
nsIReflowCommand.h \
nsISelection.h \
nsIFrameSelection.h \
nsIDOMSelection.h \
nsISpaceManager.h \
nsIStyleContext.h \

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

@ -48,7 +48,7 @@ class nsIParser;
class nsIDOMNode;
class nsXIFConverter;
class nsINameSpaceManager;
class nsISelection;
class nsIDOMSelection;
class nsIDOMDocumentFragment;
// IID for the nsIDocument interface
@ -223,7 +223,7 @@ public:
/**
* Returns the Selection Object
*/
NS_IMETHOD GetSelection(nsISelection ** aSelection) = 0;
NS_IMETHOD GetSelection(nsIDOMSelection ** aSelection) = 0;
/**
* Selects all the Content
*/
@ -242,7 +242,7 @@ public:
* NOTE: we may way to place the result in a stream,
* but we will use a string for now -- gpk
*/
virtual void CreateXIF(nsString & aBuffer, nsISelection* aSelection = nsnull) = 0;
virtual void CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0;
virtual void ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
virtual void BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
virtual void ConvertChildrenToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
@ -251,7 +251,7 @@ public:
/* Helper methods to help determine the logical positioning of content */
virtual PRBool IsInRange(const nsIContent *aStartContent, const nsIContent* aEndContent, const nsIContent* aContent) const = 0;
virtual PRBool IsBefore(const nsIContent *aNewContent, const nsIContent* aCurrentContent) const = 0;
virtual PRBool IsInSelection(nsISelection* aSelection, const nsIContent *aContent) const = 0;
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const = 0;
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const = 0;
virtual nsIContent* GetNextContent(const nsIContent *aContent) const = 0;
virtual void SetDisplaySelection(PRBool aToggle) = 0;

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

@ -32,7 +32,7 @@ class nsIReflowCommand;
class nsIDeviceContext;
class nsIRenderingContext;
class nsIPageSequenceFrame;
class nsISelection;
class nsIDOMSelection;
class nsString;
class nsStringArray;
@ -75,10 +75,10 @@ public:
*/
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList) = 0;
/** GetSelection will return the selection that the presentation shell may implement.
/** GetSelection will return the selection in the presentation shell.
* @param aSelection will hold the return value
*/
virtual nsresult GetSelection(nsISelection **aSelection) = 0;
virtual nsresult GetSelection(nsIDOMSelection **aSelection) = 0;
NS_IMETHOD EnterReflowLock() = 0;

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

@ -63,7 +63,7 @@
#include "nsIServiceManager.h"
#include "nsLayoutCID.h"
#include "nsISelection.h"
#include "nsIDOMSelection.h"
#include "nsIDOMRange.h"
#include "nsIEnumerator.h"
@ -1899,7 +1899,7 @@ void nsDocument::Finalize(JSContext *aContext)
/**
* Returns the Selection Object
*/
NS_IMETHODIMP nsDocument::GetSelection(nsISelection ** aSelection) {
NS_IMETHODIMP nsDocument::GetSelection(nsIDOMSelection ** aSelection) {
if (!aSelection)
return NS_ERROR_NULL_POINTER;
return NS_ERROR_FAILURE;
@ -2034,7 +2034,7 @@ void nsDocument::FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNod
void nsDocument::ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
{
nsISelection* sel = aConverter.GetSelection();
nsIDOMSelection* sel = aConverter.GetSelection();
if (sel != nsnull)
{
@ -2066,7 +2066,7 @@ void nsDocument::ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
}
}
void nsDocument::CreateXIF(nsString & aBuffer, nsISelection* aSelection)
void nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
{
nsXIFConverter converter(aBuffer);
@ -2154,7 +2154,7 @@ PRBool nsDocument::IsInRange(const nsIContent *aStartContent, const nsIContent*
* @param param -- description
* @return PR_TRUE if the content is found within the selection
*/
PRBool nsDocument::IsInSelection(nsISelection* aSelection, const nsIContent* aContent) const
PRBool nsDocument::IsInSelection(nsIDOMSelection* aSelection, const nsIContent* aContent) const
{
PRBool result = PR_FALSE;

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

@ -31,7 +31,7 @@
class nsIEventListenerManager;
class nsDOMStyleSheetCollection;
class nsISelection;
class nsIDOMSelection;
class nsPostData : public nsIPostData {
@ -230,7 +230,7 @@ public:
/**
* Returns the Selection Object
*/
NS_IMETHOD GetSelection(nsISelection ** aSelection);
NS_IMETHOD GetSelection(nsIDOMSelection ** aSelection);
/**
* Selects all the Content
*/
@ -246,7 +246,7 @@ public:
* document to XIF (XML Interchange Format)
* and places the result in aBuffer.
*/
virtual void CreateXIF(nsString & aBuffer, nsISelection* aSelection);
virtual void CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
virtual void ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
virtual void BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
virtual void ConvertChildrenToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
@ -312,7 +312,7 @@ public:
virtual PRBool IsInRange(const nsIContent *aStartContent, const nsIContent* aEndContent, const nsIContent* aContent) const;
virtual PRBool IsInSelection(nsISelection* aSelection, const nsIContent *aContent) const;
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
virtual PRBool IsBefore(const nsIContent *aNewContent, const nsIContent* aCurrentContent) const;
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const;
virtual nsIContent* GetNextContent(const nsIContent *aContent) const;

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

@ -28,7 +28,7 @@
#include "nsSelectionRange.h"
#include "nsRange.h"
#include "nsISelection.h"
#include "nsIDOMSelection.h"
#include "nsIEnumerator.h"
@ -478,7 +478,7 @@ nsresult
nsGenericDOMDataNode::ConvertContentToXIF(nsXIFConverter& aConverter) const
{
const nsIContent* content = mContent;
nsISelection* sel = aConverter.GetSelection();
nsIDOMSelection* sel = aConverter.GetSelection();
if (sel != nsnull && mDocument->IsInSelection(sel,content))
{

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

@ -23,7 +23,7 @@
#include "nsIFactory.h"
#include "nsIEnumerator.h"
#include "nsIDOMRange.h"
#include "nsISelection.h"
#include "nsIFrameSelection.h"
#include "nsIDOMSelection.h"
#include "nsIFocusTracker.h"
#include "nsRepository.h"
@ -38,7 +38,7 @@
static NS_DEFINE_IID(kIEnumeratorIID, NS_IENUMERATOR_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kISelectionIID, NS_ISELECTION_IID);
static NS_DEFINE_IID(kIFrameSelectionIID, NS_IFRAMESELECTION_IID);
static NS_DEFINE_IID(kIDOMSelectionIID, NS_IDOMSELECTION_IID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_IID(kIDOMRangeIID, NS_IDOMRANGE_IID);
@ -62,7 +62,7 @@ enum {FORWARD =1, BACKWARD = 0};
class nsRangeListIterator;
class nsRangeList : public nsISelection,
class nsRangeList : public nsIFrameSelection,
public nsIDOMSelection
{
public:
@ -70,11 +70,11 @@ public:
NS_DECL_ISUPPORTS
/*BEGIN nsISelection interfaces*/
/*BEGIN nsIFrameSelection interfaces*/
NS_IMETHOD HandleKeyEvent(nsIFocusTracker *aTracker, nsGUIEvent *aGuiEvent, nsIFrame *aFrame);
NS_IMETHOD TakeFocus(nsIFocusTracker *aTracker, nsIFrame *aFrame, PRInt32 aOffset, PRInt32 aContentOffset, PRBool aContinueSelection);
NS_IMETHOD ResetSelection(nsIFocusTracker *aTracker, nsIFrame *aStartFrame);
/*END nsISelection interfacse*/
/*END nsIFrameSelection interfacse*/
/*BEGIN nsIDOMSelection interface implementations*/
NS_IMETHOD DeleteFromDocument();
@ -153,13 +153,13 @@ private:
nsresult NS_NewRangeList(nsISelection **);
nsresult NS_NewRangeList(nsISelection **aRangeList)
nsresult NS_NewRangeList(nsIDOMSelection **aRangeList)
{
nsRangeList *rlist = new nsRangeList;
if (!rlist)
return NS_ERROR_OUT_OF_MEMORY;
nsresult result = rlist->QueryInterface(kISelectionIID , (void **)aRangeList);
nsresult result = rlist->QueryInterface(kIDOMSelectionIID ,
(void **)aRangeList);
if (!NS_SUCCEEDED(result))
{
delete rlist;
@ -294,12 +294,17 @@ nsRangeListIterator::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kISupportsIID)) {
nsISelection* tmp = mRangeList;
nsIDOMSelection* tmp = mRangeList;
*aInstancePtr = (void*)tmp;
NS_ADDREF(mRangeList);
return NS_OK;
}
if (aIID.Equals(kISelectionIID)) {
if (aIID.Equals(kIDOMSelectionIID)) {
*aInstancePtr = (void *)mRangeList;
NS_ADDREF(mRangeList);
return NS_OK;
}
if (aIID.Equals(kIFrameSelectionIID)) {
*aInstancePtr = (void *)mRangeList;
NS_ADDREF(mRangeList);
return NS_OK;
@ -354,7 +359,7 @@ nsRangeList::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kISupportsIID)) {
nsISupports* tmp = (nsISupports *)(nsISelection *)this;
nsISupports* tmp = (nsISupports *)(nsIDOMSelection *)this;
*aInstancePtr = (void*)tmp;
NS_ADDREF_THIS();
return NS_OK;
@ -364,8 +369,8 @@ nsRangeList::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals( kISelectionIID)) {
*aInstancePtr = (void*)(nsISelection *)this;
if (aIID.Equals( kIFrameSelectionIID)) {
*aInstancePtr = (void*)(nsIFrameSelection *)this;
NS_ADDREF_THIS();
return NS_OK;
}
@ -461,7 +466,7 @@ nsRangeList::Clear()
//BEGIN nsISelection methods
//BEGIN nsIFrameSelection methods
void printRange(nsIDOMRange *aDomRange)
@ -478,9 +483,10 @@ void printRange(nsIDOMRange *aDomRange)
aDomRange->GetStartOffset(&startOffset);
aDomRange->GetEndParent(getter_AddRefs(endNode));
aDomRange->GetEndOffset(&endOffset);
printf("print DOMRANGE 0x%x\t start: 0x%x %ld, \t end: 0x%x,%ld \n",
aDomRange,(nsIDOMNode *)startNode, (long)startOffset,
(nsIDOMNode *)endNode, (long)endOffset);
printf("print DOMRANGE 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld \n",
(unsigned long)aDomRange,
(unsigned long)(nsIDOMNode*)startNode, (long)startOffset,
(unsigned long)(nsIDOMNode*)endNode, (long)endOffset);
}
@ -538,7 +544,7 @@ nsRangeList::HandleKeyEvent(nsIFocusTracker *aTracker, nsGUIEvent *aGuiEvent, ns
#ifdef DEBUG
void nsRangeList::printSelection()
{
printf("nsRangeList 0x%x: %d items\n", this,
printf("nsRangeList 0x%lx: %d items\n", (unsigned long)this,
mRangeArray ? mRangeArray->Count() : -99);
// Get an iterator
@ -563,8 +569,10 @@ void nsRangeList::printSelection()
iter.Next();
}
printf("Anchor is 0x%x, %ld\n", GetAnchorNode(), GetAnchorOffset());
printf("Focus is 0x%x, %ld\n", GetFocusNode(), GetFocusOffset());
printf("Anchor is 0x%lx, %d\n",
(unsigned long)(nsIDOMNode*)GetAnchorNode(), GetAnchorOffset());
printf("Focus is 0x%lx, %d\n",
(unsigned long)(nsIDOMNode*)GetFocusNode(), GetFocusOffset());
printf(" ... end of selection\n");
}
#endif /* DEBUG */
@ -934,7 +942,7 @@ nsRangeList::ResetSelection(nsIFocusTracker *aTracker, nsIFrame *aStartFrame)
return NS_OK;
}
//END nsISelection methods
//END nsIFrameSelection methods
//BEGIN nsIDOMSelection interface implementations
#pragma mark -

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

@ -20,7 +20,7 @@
#include "nsString.h"
class nsISelection;
class nsIDOMSelection;
class nsXIFConverter
{
@ -54,7 +54,7 @@ private:
nsString mEndComment;
nsString mQuote;
nsString mEqual;
nsISelection* mSelection;
nsIDOMSelection* mSelection;
public:
@ -114,10 +114,10 @@ public:
// Output routines
void Write();
void SetSelection(nsISelection* aSelection) {
void SetSelection(nsIDOMSelection* aSelection) {
mSelection = aSelection;
}
nsISelection* GetSelection() {
nsIDOMSelection* GetSelection() {
return mSelection;
}

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

@ -24,7 +24,7 @@
#include "nsIHTMLContent.h"
#include "nsITextContent.h"
#include "nsIPresShell.h"
#include "nsISelection.h"
#include "nsIDOMSelection.h"
#include "nsIFrameUtil.h"
#include "nsHTMLAtoms.h"
@ -50,14 +50,13 @@ static NS_DEFINE_IID(kCRangeListCID, NS_RANGELIST_CID);
static NS_DEFINE_IID(kCRangeCID, NS_RANGE_CID);
static NS_DEFINE_CID(kPresShellCID, NS_PRESSHELL_CID);
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kSelectionCID, NS_SELECTION_CID);
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
static NS_DEFINE_CID(kFrameUtilCID, NS_FRAME_UTIL_CID);
static NS_DEFINE_CID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_CID(kEventListenerManagerCID, NS_EVENTLISTENERMANAGER_CID);
extern nsresult NS_NewRangeList(nsISelection **);
extern nsresult NS_NewRangeList(nsIDOMSelection **);
extern nsresult NS_NewRange(nsIDOMRange **);
extern nsresult NS_NewFrameUtil(nsIFrameUtil** aResult);
@ -196,16 +195,10 @@ nsresult nsLayoutFactory::CreateInstance(nsISupports *aOuter,
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kCRangeListCID)) {
nsISelection *coll;
res = NS_NewRangeList(&coll);
res = NS_NewRangeList((nsIDOMSelection**)&inst);
if (!NS_SUCCEEDED(res)) {
return res;
}
res = coll->QueryInterface(kISupportsIID, (void **)&inst);
if (!NS_SUCCEEDED(res)) {
return res;
}
NS_IF_RELEASE(coll);
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kCRangeCID)) {

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

@ -39,9 +39,10 @@
#include "nsIDOMText.h"
#include "nsDocument.h"
#include "nsIDeviceContext.h"
#include "nsIPresShell.h"
#include "nsHTMLIIDs.h"
#include "nsIEventStateManager.h"
#include "nsIDOMSelection.h"
#include "nsIFrameSelection.h"
#include "nsIFocusTracker.h"
#include "nsHTMLParts.h"
#include "nsLayoutAtoms.h"
@ -138,6 +139,7 @@ nsIFrame::GetLogModuleInfo()
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
static NS_DEFINE_IID(kIFocusTracker, NS_IFOCUSTRACKER_IID);
static NS_DEFINE_IID(kIFrameSelection, NS_IFRAMESELECTION_IID);
nsresult
NS_NewEmptyFrame(nsIFrame** aInstancePtrResult)
{
@ -704,11 +706,16 @@ NS_IMETHODIMP nsFrame::HandlePress(nsIPresContext& aPresContext,
PRInt32 startPos = 0;
PRUint32 contentOffset = 0;
if (NS_SUCCEEDED(GetPosition(aPresContext, acx, aEvent, this, contentOffset, startPos))){
nsISelection *selection = nsnull;
nsIDOMSelection *selection = nsnull;
if (NS_SUCCEEDED(shell->GetSelection(&selection))){
nsIFocusTracker *tracker;
if (NS_SUCCEEDED(shell->QueryInterface(kIFocusTracker,(void **)&tracker))){
selection->TakeFocus(tracker, this, startPos, contentOffset, PR_FALSE);
nsIFrameSelection *frameselection = nsnull;
if (NS_SUCCEEDED(selection->QueryInterface(kIFrameSelection,
(void **)&frameselection))) {
frameselection->TakeFocus(tracker, this, startPos, contentOffset, PR_FALSE);
NS_RELEASE(frameselection);
}
NS_RELEASE(tracker);
}
NS_RELEASE(selection);
@ -918,11 +925,15 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
PRInt32 startPos = 0;
PRUint32 contentOffset = 0;
if (NS_SUCCEEDED(GetPosition(aPresContext, acx, aEvent, this, contentOffset, startPos))){
nsISelection *selection = nsnull;
nsIDOMSelection *selection = nsnull;
if (NS_SUCCEEDED(shell->GetSelection(&selection))){
nsIFocusTracker *tracker;
if (NS_SUCCEEDED(shell->QueryInterface(kIFocusTracker,(void **)&tracker))){
selection->TakeFocus(tracker, this, startPos, contentOffset, PR_TRUE); //TRUE IS THE DIFFERENCE
if (NS_SUCCEEDED(shell->QueryInterface(kIFocusTracker,(void **)&tracker))) {
nsIFrameSelection* frameselection;
if (NS_SUCCEEDED(selection->QueryInterface(kIFrameSelection, (void **)&frameselection))) {
frameselection->TakeFocus(tracker, this, startPos, contentOffset, PR_TRUE); //TRUE IS THE DIFFERENCE
NS_RELEASE(frameselection);
}
NS_RELEASE(tracker);
}
NS_RELEASE(selection);

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

@ -21,7 +21,6 @@
#include "nsIFrame.h"
#include "nsIHTMLReflow.h"
#include "nsRect.h"
#include "nsISelection.h"
#include "nsSelectionRange.h"
#include "nsSelectionPoint.h"
#include "nsString.h"

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

@ -38,6 +38,7 @@
#include "nsIDOMText.h"
#include "nsIDocument.h"
#include "nsIDeviceContext.h"
#include "nsIFocusTracker.h"
#include "nsXIFConverter.h"
#include "nsHTMLAtoms.h"

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

@ -39,9 +39,10 @@
#include "nsIDOMText.h"
#include "nsDocument.h"
#include "nsIDeviceContext.h"
#include "nsIPresShell.h"
#include "nsHTMLIIDs.h"
#include "nsIEventStateManager.h"
#include "nsIDOMSelection.h"
#include "nsIFrameSelection.h"
#include "nsIFocusTracker.h"
#include "nsHTMLParts.h"
#include "nsLayoutAtoms.h"
@ -138,6 +139,7 @@ nsIFrame::GetLogModuleInfo()
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
static NS_DEFINE_IID(kIFocusTracker, NS_IFOCUSTRACKER_IID);
static NS_DEFINE_IID(kIFrameSelection, NS_IFRAMESELECTION_IID);
nsresult
NS_NewEmptyFrame(nsIFrame** aInstancePtrResult)
{
@ -704,11 +706,16 @@ NS_IMETHODIMP nsFrame::HandlePress(nsIPresContext& aPresContext,
PRInt32 startPos = 0;
PRUint32 contentOffset = 0;
if (NS_SUCCEEDED(GetPosition(aPresContext, acx, aEvent, this, contentOffset, startPos))){
nsISelection *selection = nsnull;
nsIDOMSelection *selection = nsnull;
if (NS_SUCCEEDED(shell->GetSelection(&selection))){
nsIFocusTracker *tracker;
if (NS_SUCCEEDED(shell->QueryInterface(kIFocusTracker,(void **)&tracker))){
selection->TakeFocus(tracker, this, startPos, contentOffset, PR_FALSE);
nsIFrameSelection *frameselection = nsnull;
if (NS_SUCCEEDED(selection->QueryInterface(kIFrameSelection,
(void **)&frameselection))) {
frameselection->TakeFocus(tracker, this, startPos, contentOffset, PR_FALSE);
NS_RELEASE(frameselection);
}
NS_RELEASE(tracker);
}
NS_RELEASE(selection);
@ -918,11 +925,15 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
PRInt32 startPos = 0;
PRUint32 contentOffset = 0;
if (NS_SUCCEEDED(GetPosition(aPresContext, acx, aEvent, this, contentOffset, startPos))){
nsISelection *selection = nsnull;
nsIDOMSelection *selection = nsnull;
if (NS_SUCCEEDED(shell->GetSelection(&selection))){
nsIFocusTracker *tracker;
if (NS_SUCCEEDED(shell->QueryInterface(kIFocusTracker,(void **)&tracker))){
selection->TakeFocus(tracker, this, startPos, contentOffset, PR_TRUE); //TRUE IS THE DIFFERENCE
if (NS_SUCCEEDED(shell->QueryInterface(kIFocusTracker,(void **)&tracker))) {
nsIFrameSelection* frameselection;
if (NS_SUCCEEDED(selection->QueryInterface(kIFrameSelection, (void **)&frameselection))) {
frameselection->TakeFocus(tracker, this, startPos, contentOffset, PR_TRUE); //TRUE IS THE DIFFERENCE
NS_RELEASE(frameselection);
}
NS_RELEASE(tracker);
}
NS_RELEASE(selection);

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

@ -21,7 +21,6 @@
#include "nsIFrame.h"
#include "nsIHTMLReflow.h"
#include "nsRect.h"
#include "nsISelection.h"
#include "nsSelectionRange.h"
#include "nsSelectionPoint.h"
#include "nsString.h"

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

@ -40,7 +40,8 @@
#include "nsIEventStateManager.h"
#include "nsDOMEvent.h"
#include "nsHTMLParts.h"
#include "nsISelection.h"
#include "nsIFrameSelection.h"
#include "nsIDOMSelection.h"
#include "nsLayoutCID.h"
#include "nsIDOMRange.h"
#include "nsIDOMDocument.h"
@ -158,7 +159,8 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIPresShellIID, NS_IPRESSHELL_IID);
static NS_DEFINE_IID(kIDocumentObserverIID, NS_IDOCUMENT_OBSERVER_IID);
static NS_DEFINE_IID(kIViewObserverIID, NS_IVIEWOBSERVER_IID);
static NS_DEFINE_IID(kISelectionIID, NS_ISELECTION_IID);
static NS_DEFINE_IID(kIFrameSelectionIID, NS_IFRAMESELECTION_IID);
static NS_DEFINE_IID(kIDOMSelectionIID, NS_IDOMSELECTION_IID);
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIDOMRangeIID, NS_IDOMRANGE_IID);
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
@ -243,7 +245,7 @@ public:
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle);
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle);
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList);
virtual nsresult GetSelection(nsISelection **aSelection);
virtual nsresult GetSelection(nsIDOMSelection **aSelection);
NS_IMETHOD EnterReflowLock();
NS_IMETHOD ExitReflowLock();
NS_IMETHOD BeginObservingDocument();
@ -308,7 +310,7 @@ protected:
nsIFrame* mCurrentEventFrame;
nsIFrame* mFocusEventFrame; //keeps track of which frame has focus.
nsIFrame* mAnchorEventFrame; //keeps track of which frame has focus.
nsCOMPtr <nsISelection>mSelection;
nsCOMPtr <nsIFrameSelection>mSelection;
FrameHashTable* mPlaceholderMap;
};
@ -490,10 +492,17 @@ PresShell::Init(nsIDocument* aDocument,
mStyleSet = aStyleSet;
NS_ADDREF(aStyleSet);
nsCOMPtr<nsISelection>selection;
nsresult result = nsRepository::CreateInstance(kRangeListCID, nsnull, kISelectionIID, getter_AddRefs(selection));
nsCOMPtr<nsIDOMSelection>domselection;
nsresult result = nsRepository::CreateInstance(kRangeListCID, nsnull,
kIDOMSelectionIID,
getter_AddRefs(domselection));
if (!NS_SUCCEEDED(result))
return result;
result = domselection->QueryInterface(kIDOMSelectionIID,
getter_AddRefs(mSelection));
if (!NS_SUCCEEDED(result))
return result;
// XXX This code causes the document object (and the entire content model) to be leaked...
#if 0
nsCOMPtr<nsIDOMRange>range;
@ -516,7 +525,6 @@ PresShell::Init(nsIDocument* aDocument,
}
}
#endif
mSelection = selection;
return NS_OK;
}
@ -654,11 +662,11 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
}
nsresult
PresShell::GetSelection(nsISelection **aSelection)
PresShell::GetSelection(nsIDOMSelection **aSelection)
{
if (!aSelection || !mSelection)
return NS_ERROR_NULL_POINTER;
return mSelection->QueryInterface(kISelectionIID,(void **)aSelection);
return mSelection->QueryInterface(kIDOMSelectionIID,(void **)aSelection);
}

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

@ -38,6 +38,7 @@
#include "nsIDOMText.h"
#include "nsIDocument.h"
#include "nsIDeviceContext.h"
#include "nsIFocusTracker.h"
#include "nsXIFConverter.h"
#include "nsHTMLAtoms.h"

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

@ -67,7 +67,7 @@ nsresult nsMarkupDocument::CreateShell(nsIPresContext* aContext,
return rv;
}
if (NS_OK != shell->Init(this, aContext, aViewManager, aStyleSet)) {
if (NS_OK != (rv = shell->Init(this, aContext, aViewManager, aStyleSet))) {
NS_RELEASE(shell);
return rv;
}
@ -243,7 +243,7 @@ void nsMarkupDocument::FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode
void nsMarkupDocument::ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
{
nsISelection* sel = aConverter.GetSelection();
nsIDOMSelection* sel = aConverter.GetSelection();
if (sel != nsnull)
{
@ -275,7 +275,7 @@ void nsMarkupDocument::ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
}
void nsMarkupDocument::CreateXIF(nsString & aBuffer, nsISelection* aSelection)
void nsMarkupDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
{
nsDocument::CreateXIF(aBuffer,aSelection);
}

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

@ -49,7 +49,7 @@ public:
* NOTE: we may way to place the result in a stream,
* but we will use a string for now -- gpk
*/
virtual void CreateXIF(nsString & aBuffer, nsISelection* aSelection);
virtual void CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
virtual void ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
virtual void FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);

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

@ -55,7 +55,7 @@
#include "nsIRDFService.h"
#include "nsIRDFXMLDataSource.h"
#include "nsIScriptContextOwner.h"
#include "nsISelection.h"
#include "nsIDOMSelection.h"
#include "nsIServiceManager.h"
#include "nsIStreamListener.h"
#include "nsIStyleSet.h"
@ -92,7 +92,7 @@ static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
static NS_DEFINE_IID(kIRDFXMLDataSourceIID, NS_IRDFXMLDATASOURCE_IID);
static NS_DEFINE_IID(kISelectionIID, NS_ISELECTION_IID);
static NS_DEFINE_IID(kIDOMSelectionIID, NS_IDOMSELECTION_IID);
static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID);
static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -402,13 +402,13 @@ public:
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
NS_IMETHOD GetSelection(nsISelection** aSelection);
NS_IMETHOD GetSelection(nsIDOMSelection** aSelection);
NS_IMETHOD SelectAll();
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
virtual void CreateXIF(nsString & aBuffer, nsISelection* aSelection);
virtual void CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
virtual void ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
@ -422,7 +422,7 @@ public:
virtual PRBool IsBefore(const nsIContent *aNewContent, const nsIContent* aCurrentContent) const;
virtual PRBool IsInSelection(nsISelection* aSelection, const nsIContent *aContent) const;
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const;
@ -498,7 +498,7 @@ protected:
nsIScriptContextOwner* mScriptContextOwner;
nsString* mCharSetID;
nsVoidArray mStyleSheets;
nsISelection* mSelection;
nsIDOMSelection* mSelection;
PRBool mDisplaySelection;
nsVoidArray mPresShells;
nsINameSpaceManager* mNameSpaceManager;
@ -637,7 +637,7 @@ XULDocumentImpl::XULDocumentImpl(void)
// construct a selection object
if (NS_FAILED(rv = nsRepository::CreateInstance(kRangeListCID,
nsnull,
kISelectionIID,
kIDOMSelectionIID,
(void**) &mSelection)))
PR_ASSERT(0);
@ -1382,7 +1382,7 @@ XULDocumentImpl::StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
}
NS_IMETHODIMP
XULDocumentImpl::GetSelection(nsISelection** aSelection)
XULDocumentImpl::GetSelection(nsIDOMSelection** aSelection)
{
if (!mSelection) {
PR_ASSERT(0);
@ -1473,7 +1473,7 @@ XULDocumentImpl::FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool
}
void
XULDocumentImpl::CreateXIF(nsString & aBuffer, nsISelection* aSelection)
XULDocumentImpl::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
{
PR_ASSERT(0);
}
@ -1537,7 +1537,7 @@ XULDocumentImpl::IsBefore(const nsIContent *aNewContent, const nsIContent* aCurr
}
PRBool
XULDocumentImpl::IsInSelection(nsISelection* aSelection, const nsIContent *aContent) const
XULDocumentImpl::IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const
{
PRBool result = PR_FALSE;

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

@ -101,7 +101,7 @@
#endif
// For Copy
#include "nsISelection.h"
#include "nsIDOMSelection.h"
// XXX For font setting below
#include "nsFont.h"
@ -2150,7 +2150,7 @@ nsBrowserWindow::DoCopy()
if (nsnull != doc) {
nsString buffer;
nsISelection* sel = nsnull;
nsIDOMSelection* sel = nsnull;
shell->GetSelection(&sel);
if (sel != nsnull)