diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index e44ee151be2..63e1485f990 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -30,11 +30,7 @@ class nsIDocumentContainer; class nsIDocumentObserver; class nsIPresContext; class nsIPresShell; -#if XP_NEW_SELECTION class nsICollection; -#else -class nsISelection; -#endif class nsIStreamListener; class nsIStreamObserver; @@ -207,11 +203,7 @@ public: /** * Returns the Selection Object */ -#if XP_NEW_SELECTION NS_IMETHOD GetSelection(nsICollection ** aSelection) = 0; -#else - NS_IMETHOD GetSelection(nsISelection *& aSelection) = 0; -#endif /** * Selects all the Content */ diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index a5ada2dd569..e9a111b16ed 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -63,6 +63,8 @@ public: virtual nsIStyleSet* GetStyleSet() = 0; + virtual nsresult SetFocus(nsIFrame *aFrame) = 0; + NS_IMETHOD EnterReflowLock() = 0; NS_IMETHOD ExitReflowLock() = 0; diff --git a/layout/base/public/nsIDocument.h b/layout/base/public/nsIDocument.h index e44ee151be2..63e1485f990 100644 --- a/layout/base/public/nsIDocument.h +++ b/layout/base/public/nsIDocument.h @@ -30,11 +30,7 @@ class nsIDocumentContainer; class nsIDocumentObserver; class nsIPresContext; class nsIPresShell; -#if XP_NEW_SELECTION class nsICollection; -#else -class nsISelection; -#endif class nsIStreamListener; class nsIStreamObserver; @@ -207,11 +203,7 @@ public: /** * Returns the Selection Object */ -#if XP_NEW_SELECTION NS_IMETHOD GetSelection(nsICollection ** aSelection) = 0; -#else - NS_IMETHOD GetSelection(nsISelection *& aSelection) = 0; -#endif /** * Selects all the Content */ diff --git a/layout/base/public/nsIPresShell.h b/layout/base/public/nsIPresShell.h index a5ada2dd569..e9a111b16ed 100644 --- a/layout/base/public/nsIPresShell.h +++ b/layout/base/public/nsIPresShell.h @@ -63,6 +63,8 @@ public: virtual nsIStyleSet* GetStyleSet() = 0; + virtual nsresult SetFocus(nsIFrame *aFrame) = 0; + NS_IMETHOD EnterReflowLock() = 0; NS_IMETHOD ExitReflowLock() = 0; diff --git a/layout/base/public/nsISelection.h b/layout/base/public/nsISelection.h index 552c4326d95..d9fb0130dcb 100644 --- a/layout/base/public/nsISelection.h +++ b/layout/base/public/nsISelection.h @@ -18,9 +18,9 @@ #ifndef nsISelection_h___ #define nsISelection_h___ -#include "nsSelectionRange.h" -#include "nslayout.h" #include "nsISupports.h" +#include "nsIFrame.h" + // IID for the nsISelection interface #define NS_ISELECTION_IID \ @@ -33,37 +33,14 @@ class nsISelection : public nsISupports { public: - /** - * Returns whether there is a valid selection - */ - virtual PRBool IsValidSelection() = 0; - - /** - * Clears the current selection (invalidates the selection) - */ - virtual void ClearSelection() = 0; - - /** - * Copies the data from the param into the internal Range - */ - virtual void SetRange(nsSelectionRange * aRange) = 0; - - /** - * Copies the param's (aRange) contents with the Range's data - */ - virtual void GetRange(nsSelectionRange * aRange) = 0; - - /** - * Copies the param's (aRange) contents with the Range's data - */ - virtual nsSelectionRange * GetRange() = 0; - - virtual char * ToString() = 0; - + /** HandleKeyEvent will accept an event and frame and + * will return NS_OK if it handles the event or NS_COMFALSE if not. + *
DOES NOT ADDREF
+ * @param aGuiEvent is the event that should be dealt with by aFocusFrame + * @param aFrame is the frame that MAY handle the event + */ + virtual nsresult HandleKeyEvent(nsGUIEvent *aGuiEvent, nsIFrame *aFrame) = 0; }; -// XXX Belongs somewhere else -extern NS_LAYOUT nsresult - NS_NewSelection(nsISelection** aInstancePtrResult); #endif /* nsISelection_h___ */ diff --git a/layout/build/nsLayoutFactory.cpp b/layout/build/nsLayoutFactory.cpp index 5b2eeda374b..52f6207b11e 100644 --- a/layout/build/nsLayoutFactory.cpp +++ b/layout/build/nsLayoutFactory.cpp @@ -227,10 +227,16 @@ nsresult nsLayoutFactory::CreateInstance(nsISupports *aOuter, refCounted = PR_TRUE; } else if (mClassID.Equals(kCRangeListCID)) { - res = NS_NewRangeList((nsICollection **)&inst); + nsICollection *coll; + res = NS_NewRangeList((nsICollection **)&coll); 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)) { @@ -260,11 +266,6 @@ nsresult nsLayoutFactory::CreateInstance(nsISupports *aOuter, return res; refCounted = PR_TRUE; } - else if (mClassID.Equals(kSelectionCID)) { - if (NS_FAILED(res = NS_NewSelection((nsISelection**) &inst))) - return res; - refCounted = PR_TRUE; - } else { return NS_NOINTERFACE;