New XBL for editor tag and editorshell removal. b=133598, r=akkana, sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@133696 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -40,14 +40,10 @@
|
||||
|
||||
interface nsIEditor;
|
||||
interface nsIDocShell;
|
||||
interface nsIEditorShell;
|
||||
|
||||
[scriptable, uuid(14B3B669-3414-4548-AA03-EDF257D889C8)]
|
||||
interface nsIEditorBoxObject : nsISupports
|
||||
{
|
||||
readonly attribute nsIEditor editor;
|
||||
// nsIEditorShell is deprecated and will go away -- please don't use it!
|
||||
readonly attribute nsIEditorShell editorShell;
|
||||
readonly attribute nsIDocShell docShell;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include "nsBoxObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIEditorShell.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
@@ -55,9 +54,6 @@ public:
|
||||
//NS_PIBOXOBJECT interfaces
|
||||
NS_IMETHOD Init(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIEditorShell> mEditorShell;
|
||||
};
|
||||
|
||||
/* Implementation file */
|
||||
@@ -67,18 +63,6 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsEditorBoxObject, nsBoxObject, nsIEditorBoxObject)
|
||||
NS_IMETHODIMP
|
||||
nsEditorBoxObject::SetDocument(nsIDocument* aDocument)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (mEditorShell)
|
||||
{
|
||||
rv = mEditorShell->Shutdown();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Error from editor->Shutdown");
|
||||
}
|
||||
|
||||
// this should only be called with a null document, which indicates
|
||||
// that we're being torn down.
|
||||
NS_ASSERTION(aDocument == nsnull, "SetDocument called with non-null document");
|
||||
mEditorShell = nsnull;
|
||||
return nsBoxObject::SetDocument(aDocument);
|
||||
}
|
||||
|
||||
@@ -96,33 +80,7 @@ nsEditorBoxObject::~nsEditorBoxObject()
|
||||
|
||||
NS_IMETHODIMP nsEditorBoxObject::Init(nsIContent* aContent, nsIPresShell* aPresShell)
|
||||
{
|
||||
nsresult rv = nsBoxObject::Init(aContent, aPresShell);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ASSERTION(!mEditorShell, "Double init of nsEditorBoxObject");
|
||||
|
||||
// When editorshell goes away, this is what we should be doing:
|
||||
//mEditor = do_CreateInstance("@mozilla.org/editor/htmleditor;1");
|
||||
// but we need an editorshell for the transitional period, so:
|
||||
mEditorShell = do_CreateInstance("@mozilla.org/editor/editorshell;1");
|
||||
if (!mEditorShell) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditorBoxObject::GetEditor(nsIEditor** aResult)
|
||||
{
|
||||
NS_ASSERTION(mEditorShell, "Editor box object not initted");
|
||||
return mEditorShell->GetEditor(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditorBoxObject::GetEditorShell(nsIEditorShell** aResult)
|
||||
{
|
||||
NS_ASSERTION(mEditorShell, "Editor box object not initted");
|
||||
|
||||
*aResult = mEditorShell;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
return nsBoxObject::Init(aContent, aPresShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditorBoxObject::GetDocShell(nsIDocShell** aResult)
|
||||
|
||||
@@ -53,6 +53,7 @@ toolkit.jar:
|
||||
content/global/bindings/checkbox.xml (resources/content/bindings/checkbox.xml)
|
||||
content/global/bindings/colorpicker.xml (resources/content/bindings/colorpicker.xml)
|
||||
content/global/bindings/dialog.xml (resources/content/bindings/dialog.xml)
|
||||
content/global/bindings/editor.xml (resources/content/bindings/editor.xml)
|
||||
content/global/bindings/general.xml (resources/content/bindings/general.xml)
|
||||
content/global/bindings/groupbox.xml (resources/content/bindings/groupbox.xml)
|
||||
content/global/bindings/listbox.xml (resources/content/bindings/listbox.xml)
|
||||
|
||||
75
mozilla/xpfe/global/resources/content/bindings/editor.xml
Normal file
75
mozilla/xpfe/global/resources/content/bindings/editor.xml
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="editorBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="editor">
|
||||
<implementation>
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
// Make window editable immediately only
|
||||
// if the "editortype" attribute is supplied
|
||||
// This allows using same contentWindow for different editortypes,
|
||||
// where the type is determined during the apps's window.onload handler.
|
||||
if (this.editortype)
|
||||
this.makeEditable(this.editortype, true);
|
||||
]]>
|
||||
</constructor>
|
||||
<destructor/>
|
||||
<method name="makeEditable">
|
||||
<parameter name="editortype"/>
|
||||
<parameter name="waitForUrlLoad"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.editingSession.makeWindowEditable(this.contentWindow, editortype, waitForUrlLoad);
|
||||
this.setAttribute("editortype", editortype);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="getEditor">
|
||||
<parameter name="containingWindow"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this.editingSession.getEditorForWindow(containingWindow);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="getHTMLEditor">
|
||||
<parameter name="containingWindow"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var editor = this.editingSession.getEditorForWindow(containingWindow);
|
||||
return editor.QueryInterface(Components.interfaces.nsIHTMLEditor);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<property name="editortype"
|
||||
onget="return this.getAttribute('editortype');"
|
||||
onset="this.setAttribute('editortype', val); return val;"/>
|
||||
<property name="webNavigation"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
||||
readonly="true"/>
|
||||
<property name="contentDocument" readonly="true"
|
||||
onget="return this.webNavigation.document;"/>
|
||||
<property name="docShell"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell;"
|
||||
readonly="true"/>
|
||||
<property name="contentWindow"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
|
||||
<property name="webBrowserFind"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
|
||||
<property name="editingSession"
|
||||
readonly="true"
|
||||
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIEditingSession);"/>"
|
||||
<property name="commandManager"
|
||||
readonly="true"
|
||||
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsICommandManager);"/>"
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
@@ -177,28 +177,6 @@
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="editor">
|
||||
<implementation>
|
||||
<property name="editorShell"
|
||||
readonly="true"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).editorShell"/>
|
||||
<property name="editor"
|
||||
readonly="true"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).editorShell.editor"/>
|
||||
<property name="webNavigation"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
||||
readonly="true"/>
|
||||
<property name="contentDocument" readonly="true"
|
||||
onget="return this.webNavigation.document;"/>
|
||||
<property name="docShell"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell;"
|
||||
readonly="true"/>
|
||||
<property name="webBrowserFind"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="iframe">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
|
||||
@@ -156,7 +156,7 @@ tabbrowser {
|
||||
}
|
||||
|
||||
editor {
|
||||
-moz-binding: url("chrome://global/content/bindings/general.xml#editor");
|
||||
-moz-binding: url("chrome://global/content/bindings/editor.xml#editor");
|
||||
}
|
||||
|
||||
iframe {
|
||||
|
||||
Reference in New Issue
Block a user