зеркало из https://github.com/mozilla/gecko-dev.git
bug 841430 - nuke nsIEditorDocShell r=bz
This commit is contained in:
Родитель
085fcc4d7f
Коммит
fda9efaa98
|
@ -89,7 +89,6 @@
|
|||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsIControllers.h"
|
||||
|
|
|
@ -88,7 +88,6 @@
|
|||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsIControllers.h"
|
||||
|
|
|
@ -159,7 +159,6 @@
|
|||
#include "nsICharsetDetectionObserver.h"
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
|
@ -6801,14 +6800,14 @@ nsIEditor*
|
|||
nsContentUtils::GetHTMLEditor(nsPresContext* aPresContext)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell(do_QueryInterface(container));
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
|
||||
bool isEditable;
|
||||
if (!editorDocShell ||
|
||||
NS_FAILED(editorDocShell->GetEditable(&isEditable)) || !isEditable)
|
||||
if (!docShell ||
|
||||
NS_FAILED(docShell->GetEditable(&isEditable)) || !isEditable)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
docShell->GetEditor(getter_AddRefs(editor));
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsStringBuffer.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
@ -343,17 +342,14 @@ IsInvisibleBreak(nsINode *aNode) {
|
|||
if (window) {
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell = do_QueryInterface(docShell);
|
||||
if (editorDocShell) {
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(editor);
|
||||
if (htmlEditor) {
|
||||
bool isVisible = false;
|
||||
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(aNode);
|
||||
htmlEditor->BreakIsVisible(domNode, &isVisible);
|
||||
return !isVisible;
|
||||
}
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
docShell->GetEditor(getter_AddRefs(editor));
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(editor);
|
||||
if (htmlEditor) {
|
||||
bool isVisible = false;
|
||||
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(aNode);
|
||||
htmlEditor->BreakIsVisible(domNode, &isVisible);
|
||||
return !isVisible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
|
||||
|
@ -852,26 +851,22 @@ nsFrameLoader::Show(int32_t marginWidth, int32_t marginHeight,
|
|||
if (designMode.EqualsLiteral("on")) {
|
||||
// Hold on to the editor object to let the document reattach to the
|
||||
// same editor object, instead of creating a new one.
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocshell = do_QueryInterface(mDocShell);
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
nsresult rv = editorDocshell->GetEditor(getter_AddRefs(editor));
|
||||
nsresult rv = mDocShell->GetEditor(getter_AddRefs(editor));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
doc->SetDesignMode(NS_LITERAL_STRING("off"));
|
||||
doc->SetDesignMode(NS_LITERAL_STRING("on"));
|
||||
} else {
|
||||
// Re-initialize the presentation for contenteditable documents
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocshell = do_QueryInterface(mDocShell);
|
||||
if (editorDocshell) {
|
||||
bool editable = false,
|
||||
hasEditingSession = false;
|
||||
editorDocshell->GetEditable(&editable);
|
||||
editorDocshell->GetHasEditingSession(&hasEditingSession);
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
editorDocshell->GetEditor(getter_AddRefs(editor));
|
||||
if (editable && hasEditingSession && editor) {
|
||||
editor->PostCreate();
|
||||
}
|
||||
bool editable = false,
|
||||
hasEditingSession = false;
|
||||
mDocShell->GetEditable(&editable);
|
||||
mDocShell->GetHasEditingSession(&hasEditingSession);
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
mDocShell->GetEditor(getter_AddRefs(editor));
|
||||
if (editable && hasEditingSession && editor) {
|
||||
editor->PostCreate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "nsIScriptElement.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMUserDataHandler.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsIFrame.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIComboboxControlFrame.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "nsMappedAttributes.h"
|
||||
#include "nsRuleData.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
|
||||
|
@ -476,12 +475,12 @@ HTMLBodyElement::GetAssociatedEditor()
|
|||
}
|
||||
|
||||
nsCOMPtr<nsISupports> container = presContext->GetContainer();
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell = do_QueryInterface(container);
|
||||
if (!editorDocShell) {
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
|
||||
if (!docShell) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
docShell->GetEditor(getter_AddRefs(editor));
|
||||
return editor.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,6 @@
|
|||
#include "nsNodeInfoManager.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIEditorStyleSheets.h"
|
||||
#include "nsIInlineSpellChecker.h"
|
||||
#include "nsRange.h"
|
||||
|
@ -2610,12 +2609,8 @@ nsHTMLDocument::DeferredContentEditableCountChange(nsIContent *aElement)
|
|||
if (!docshell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell =
|
||||
do_QueryInterface(docshell, &rv);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
docshell->GetEditor(getter_AddRefs(editor));
|
||||
if (editor) {
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
rv = range->SelectNode(node);
|
||||
|
@ -2887,11 +2882,7 @@ nsHTMLDocument::EditingStateChanged()
|
|||
}
|
||||
|
||||
// XXX Need to call TearDownEditorOnWindow for all failures.
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell =
|
||||
do_QueryInterface(docshell, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
docshell->GetEditor(getter_AddRefs(editor));
|
||||
if (!editor)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "mozilla/dom/HTMLSharedElement.h"
|
||||
|
||||
class nsIEditor;
|
||||
class nsIEditorDocShell;
|
||||
class nsIParser;
|
||||
class nsIURI;
|
||||
class nsIMarkupDocumentViewer;
|
||||
|
|
|
@ -42,7 +42,6 @@ XPIDLSRCS = \
|
|||
nsIContentViewerEdit.idl \
|
||||
nsIContentViewerFile.idl \
|
||||
nsIURIFixup.idl \
|
||||
nsIEditorDocShell.idl \
|
||||
nsIWebPageDescriptor.idl \
|
||||
nsIDownloadHistory.idl \
|
||||
nsILoadContext.idl \
|
||||
|
|
|
@ -907,7 +907,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentViewerContainer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIEditorDocShell)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebPageDescriptor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
|
@ -11104,10 +11103,6 @@ nsDocShell::ShouldDiscardLayoutState(nsIHttpChannel * aChannel)
|
|||
return (noStore || (noCache && securityInfo));
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell: nsIEditorDocShell
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetEditor(nsIEditor * *aEditor)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEditor);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "nsDocLoader.h"
|
||||
#include "nsIURILoader.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
|
@ -141,7 +140,6 @@ class nsDocShell : public nsDocLoader,
|
|||
public nsIScriptGlobalObjectOwner,
|
||||
public nsIRefreshURI,
|
||||
public nsIWebProgressListener,
|
||||
public nsIEditorDocShell,
|
||||
public nsIWebPageDescriptor,
|
||||
public nsIAuthPromptProvider,
|
||||
public nsIObserver,
|
||||
|
@ -175,7 +173,6 @@ public:
|
|||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSIREFRESHURI
|
||||
NS_DECL_NSICONTENTVIEWERCONTAINER
|
||||
NS_DECL_NSIEDITORDOCSHELL
|
||||
NS_DECL_NSIWEBPAGEDESCRIPTOR
|
||||
NS_DECL_NSIAUTHPROMPTPROVIDER
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
|
|
@ -26,6 +26,7 @@ interface nsIContentViewer;
|
|||
interface nsIURIContentListener;
|
||||
interface nsIDOMEventTarget;
|
||||
interface nsIDocShellLoadInfo;
|
||||
interface nsIEditor;
|
||||
interface nsIWebNavigation;
|
||||
interface nsISimpleEnumerator;
|
||||
interface nsIInputStream;
|
||||
|
@ -39,7 +40,7 @@ interface nsIWebBrowserPrint;
|
|||
interface nsIVariant;
|
||||
interface nsIPrivacyTransitionObserver;
|
||||
|
||||
[scriptable, builtinclass, uuid(5ea80008-a166-4692-8a7e-39690dd192c6)]
|
||||
[scriptable, builtinclass, uuid(e8f6f3e5-8cee-4be3-8d56-5ed617305bf8)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
|
@ -789,4 +790,17 @@ interface nsIDocShell : nsIDocShellTreeItem
|
|||
* must disable the menu when this property is false.
|
||||
*/
|
||||
[infallible] readonly attribute boolean mayEnableCharacterEncodingMenu;
|
||||
|
||||
attribute nsIEditor editor;
|
||||
readonly attribute boolean editable; /* this docShell is editable */
|
||||
readonly attribute boolean hasEditingSession; /* this docShell has an editing session */
|
||||
|
||||
/**
|
||||
* Make this docShell editable, setting a flag that causes
|
||||
* an editor to get created, either immediately, or after
|
||||
* a url has been loaded.
|
||||
* @param inWaitForUriLoad true to wait for a URI before
|
||||
* creating the editor.
|
||||
*/
|
||||
void makeEditable(in boolean inWaitForUriLoad);
|
||||
};
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIEditor;
|
||||
|
||||
/**
|
||||
* nsIEditorDocShell provides a way to get an editor from
|
||||
* a specific frame in a docShell hierarchy. It is intended
|
||||
* to be only used internally. Use nsIEditingShell.getEditorForFrame
|
||||
* from out side.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(3BDB8F01-F141-11D4-A73C-FBA4ABA8A3FC)]
|
||||
interface nsIEditorDocShell : nsISupports
|
||||
{
|
||||
attribute nsIEditor editor;
|
||||
readonly attribute boolean editable; /* this docShell is editable */
|
||||
readonly attribute boolean hasEditingSession; /* this docShell has an editing session */
|
||||
|
||||
/**
|
||||
* Make this docShell editable, setting a flag that causes
|
||||
* an editor to get created, either immediately, or after
|
||||
* a url has been loaded.
|
||||
* @param inWaitForUriLoad true to wait for a URI before
|
||||
* creating the editor.
|
||||
*/
|
||||
void makeEditable(in boolean inWaitForUriLoad);
|
||||
};
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
#include "nsIDOMRange.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -606,18 +605,15 @@ nsFocusManager::MoveCaretToFocus(nsIDOMWindow* aWindow)
|
|||
if (dsti) {
|
||||
dsti->GetItemType(&itemType);
|
||||
if (itemType != nsIDocShellTreeItem::typeChrome) {
|
||||
// don't move the caret for editable documents
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell(do_QueryInterface(dsti));
|
||||
if (editorDocShell) {
|
||||
bool isEditable;
|
||||
editorDocShell->GetEditable(&isEditable);
|
||||
if (isEditable)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(dsti);
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
// don't move the caret for editable documents
|
||||
bool isEditable;
|
||||
docShell->GetEditable(&isEditable);
|
||||
if (isEditable)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -2030,22 +2026,19 @@ nsFocusManager::UpdateCaret(bool aMoveCaretToFocus,
|
|||
// contentEditable document and the node to focus is contentEditable,
|
||||
// return, so that we don't mess with caret visibility.
|
||||
bool isEditable = false;
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell(do_QueryInterface(dsti));
|
||||
if (editorDocShell) {
|
||||
editorDocShell->GetEditable(&isEditable);
|
||||
focusedDocShell->GetEditable(&isEditable);
|
||||
|
||||
if (isEditable) {
|
||||
nsCOMPtr<nsIHTMLDocument> doc =
|
||||
do_QueryInterface(presShell->GetDocument());
|
||||
if (isEditable) {
|
||||
nsCOMPtr<nsIHTMLDocument> doc =
|
||||
do_QueryInterface(presShell->GetDocument());
|
||||
|
||||
bool isContentEditableDoc =
|
||||
doc && doc->GetEditingState() == nsIHTMLDocument::eContentEditable;
|
||||
bool isContentEditableDoc =
|
||||
doc && doc->GetEditingState() == nsIHTMLDocument::eContentEditable;
|
||||
|
||||
bool isFocusEditable =
|
||||
aContent && aContent->HasFlag(NODE_IS_EDITABLE);
|
||||
if (!isContentEditableDoc || isFocusEditable)
|
||||
return;
|
||||
}
|
||||
bool isFocusEditable =
|
||||
aContent && aContent->HasFlag(NODE_IS_EDITABLE);
|
||||
if (!isContentEditableDoc || isFocusEditable)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isEditable && aMoveCaretToFocus)
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
#include "nsIContentViewerEdit.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellLoadInfo.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIDocCharset.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
|
@ -8457,13 +8456,10 @@ nsGlobalWindow::UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent)
|
|||
if (!docShell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell = do_QueryInterface(docShell);
|
||||
if (editorDocShell) {
|
||||
bool editable;
|
||||
editorDocShell->GetEditable(&editable);
|
||||
if (editable)
|
||||
return;
|
||||
}
|
||||
bool editable;
|
||||
docShell->GetEditable(&editable);
|
||||
if (editable)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
|
||||
if (!presShell || !mDocument)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "nsIDocument.h" // for nsIDocument
|
||||
#include "nsIDocumentStateListener.h"
|
||||
#include "nsIEditor.h" // for nsIEditor
|
||||
#include "nsIEditorDocShell.h" // for nsIEditorDocShell
|
||||
#include "nsIHTMLDocument.h" // for nsIHTMLDocument, etc
|
||||
#include "nsIInterfaceRequestorUtils.h" // for do_GetInterface
|
||||
#include "nsIPlaintextEditor.h" // for nsIPlaintextEditor, etc
|
||||
|
@ -113,7 +112,7 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
|
|||
mEditorFlags = 0;
|
||||
|
||||
// disable plugins
|
||||
nsIDocShell *docShell = GetDocShellFromWindow(aWindow);
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
mDocShell = do_GetWeakReference(docShell);
|
||||
|
@ -142,12 +141,8 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
|
|||
rv = PrepareForEditing(aWindow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell;
|
||||
rv = GetEditorDocShellFromWindow(aWindow, getter_AddRefs(editorDocShell));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// set the flag on the docShell to say that it's editable
|
||||
rv = editorDocShell->MakeEditable(aDoAfterUriLoad);
|
||||
rv = docShell->MakeEditable(aDoAfterUriLoad);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Setup commands common to plaintext and html editors,
|
||||
|
@ -241,12 +236,10 @@ nsEditingSession::GetJsAndPluginsDisabled(bool *aResult)
|
|||
NS_IMETHODIMP
|
||||
nsEditingSession::WindowIsEditable(nsIDOMWindow *aWindow, bool *outIsEditable)
|
||||
{
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell;
|
||||
nsresult rv = GetEditorDocShellFromWindow(aWindow,
|
||||
getter_AddRefs(editorDocShell));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_STATE(docShell);
|
||||
|
||||
return editorDocShell->GetEditable(outIsEditable);
|
||||
return docShell->GetEditable(outIsEditable);
|
||||
}
|
||||
|
||||
|
||||
|
@ -398,7 +391,7 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
|
||||
// Create editor and do other things
|
||||
// only if we haven't found some error above,
|
||||
nsIDocShell *docShell = GetDocShellFromWindow(aWindow);
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
if (!mInteractive) {
|
||||
|
@ -412,9 +405,6 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
}
|
||||
|
||||
// create and set editor
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell = do_QueryInterface(docShell, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Try to reuse an existing editor
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryReferent(mExistingEditor);
|
||||
if (editor) {
|
||||
|
@ -425,7 +415,7 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
mExistingEditor = do_GetWeakReference(editor);
|
||||
}
|
||||
// set the editor on the docShell. The docShell now owns it.
|
||||
rv = editorDocShell->SetEditor(editor);
|
||||
rv = docShell->SetEditor(editor);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// setup the HTML editor command controller
|
||||
|
@ -547,12 +537,11 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
if (stopEditing)
|
||||
RemoveWebProgressListener(aWindow);
|
||||
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell;
|
||||
rv = GetEditorDocShellFromWindow(aWindow, getter_AddRefs(editorDocShell));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_STATE(docShell);
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
rv = editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
rv = docShell->GetEditor(getter_AddRefs(editor));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (stopEditing)
|
||||
|
@ -567,7 +556,7 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
|
|||
|
||||
// Null out the editor on the docShell to trigger PreDestroy which
|
||||
// needs to happen before document state listeners are removed below.
|
||||
editorDocShell->SetEditor(nullptr);
|
||||
docShell->SetEditor(nullptr);
|
||||
|
||||
RemoveListenersAndControllers(aWindow, editor);
|
||||
|
||||
|
@ -603,12 +592,10 @@ NS_IMETHODIMP
|
|||
nsEditingSession::GetEditorForWindow(nsIDOMWindow *aWindow,
|
||||
nsIEditor **outEditor)
|
||||
{
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell;
|
||||
nsresult rv = GetEditorDocShellFromWindow(aWindow,
|
||||
getter_AddRefs(editorDocShell));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_STATE(aWindow);
|
||||
|
||||
return editorDocShell->GetEditor(outEditor);
|
||||
return docShell->GetEditor(outEditor);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
@ -973,15 +960,13 @@ nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress,
|
|||
if (refreshURI)
|
||||
refreshURI->CancelRefreshURITimers();
|
||||
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocShell = do_QueryInterface(docShell);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// did someone set the flag to make this shell editable?
|
||||
if (aIsToBeMadeEditable && mCanCreateEditor && editorDocShell)
|
||||
if (aIsToBeMadeEditable && mCanCreateEditor)
|
||||
{
|
||||
bool makeEditable;
|
||||
editorDocShell->GetEditable(&makeEditable);
|
||||
docShell->GetEditable(&makeEditable);
|
||||
|
||||
if (makeEditable)
|
||||
{
|
||||
|
@ -993,7 +978,7 @@ nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress,
|
|||
} else {
|
||||
// do we already have an editor here?
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
rv = editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
rv = docShell->GetEditor(getter_AddRefs(editor));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
needsSetup = !editor;
|
||||
|
@ -1125,24 +1110,6 @@ nsEditingSession::GetDocShellFromWindow(nsIDOMWindow *aWindow)
|
|||
return window->GetDocShell();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
GetEditorDocShellFromWindow
|
||||
|
||||
Utility method. This will always return an error if no docShell
|
||||
is returned.
|
||||
----------------------------------------------------------------------------*/
|
||||
nsresult
|
||||
nsEditingSession::GetEditorDocShellFromWindow(nsIDOMWindow *aWindow,
|
||||
nsIEditorDocShell** outDocShell)
|
||||
{
|
||||
nsIDocShell *docShell = GetDocShellFromWindow(aWindow);
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
return docShell->QueryInterface(NS_GET_IID(nsIEditorDocShell),
|
||||
(void **)outDocShell);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
PrepareForEditing
|
||||
|
|
|
@ -41,7 +41,6 @@ class nsIChannel;
|
|||
class nsIControllers;
|
||||
class nsIDocShell;
|
||||
class nsIEditor;
|
||||
class nsIEditorDocShell;
|
||||
class nsIWebProgress;
|
||||
|
||||
class nsEditingSession : public nsIEditingSession,
|
||||
|
@ -65,8 +64,6 @@ public:
|
|||
protected:
|
||||
|
||||
nsIDocShell * GetDocShellFromWindow(nsIDOMWindow *aWindow);
|
||||
nsresult GetEditorDocShellFromWindow(nsIDOMWindow *aWindow,
|
||||
nsIEditorDocShell** outDocShell);
|
||||
|
||||
nsresult SetupEditorCommandController(const char *aControllerClassName,
|
||||
nsIDOMWindow *aWindow,
|
||||
|
|
|
@ -583,7 +583,7 @@ function runTest(test) {
|
|||
}
|
||||
editor = SpecialPowers.wrap(win).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
|
||||
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
|
||||
.QueryInterface(SpecialPowers.Ci.nsIEditorDocShell)
|
||||
.QueryInterface(SpecialPowers.Ci.nsIDocShell)
|
||||
.editor;
|
||||
editor.pasteTransferable(trans);
|
||||
} else {
|
||||
|
|
|
@ -674,7 +674,7 @@ function runTests()
|
|||
var editor =
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIEditorDocShell).editor;
|
||||
QueryInterface(Components.interfaces.nsIDocShell).editor;
|
||||
var flags = editor.flags;
|
||||
// readonly
|
||||
editor.flags = flags | nsIPlaintextEditor.eEditorReadonlyMask;
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
|
|
@ -1009,7 +1009,7 @@ function runComplexContenteditableTests()
|
|||
var editor =
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIEditorDocShell).editor;
|
||||
QueryInterface(Components.interfaces.nsIDocShell).editor;
|
||||
var flags = editor.flags;
|
||||
editor.flags = flags | kReadonly;
|
||||
is(gFM.focusedElement, container,
|
||||
|
@ -1041,7 +1041,7 @@ function runComplexContenteditableTests()
|
|||
editor =
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIEditorDocShell).editor;
|
||||
QueryInterface(Components.interfaces.nsIDocShell).editor;
|
||||
flags = editor.flags;
|
||||
editor.flags = flags | kReadonly;
|
||||
is(gFM.focusedElement, button,
|
||||
|
@ -1083,7 +1083,7 @@ function runComplexContenteditableTests()
|
|||
editor =
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIEditorDocShell).editor;
|
||||
QueryInterface(Components.interfaces.nsIDocShell).editor;
|
||||
flags = editor.flags;
|
||||
editor.flags = flags | kReadonly;
|
||||
is(gFM.focusedElement, aEditor,
|
||||
|
@ -1151,7 +1151,7 @@ function runComplexContenteditableTests()
|
|||
editor =
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIEditorDocShell).editor;
|
||||
QueryInterface(Components.interfaces.nsIDocShell).editor;
|
||||
flags = editor.flags;
|
||||
editor.flags = flags | kReadonly;
|
||||
is(gFM.focusedElement, aFocusNode,
|
||||
|
@ -1219,7 +1219,7 @@ function runEditorFlagChangeTests()
|
|||
var editor =
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIEditorDocShell).editor;
|
||||
QueryInterface(Components.interfaces.nsIDocShell).editor;
|
||||
var editorIMESupport =
|
||||
editor.QueryInterface(Components.interfaces.nsIEditorIMESupport);
|
||||
var flags = editor.flags;
|
||||
|
|
|
@ -87,7 +87,7 @@ const nsIDOMNSEditableElement = Components.interfaces.nsIDOMNSEditableElement;
|
|||
const nsIEditorIMESupport = Components.interfaces.nsIEditorIMESupport;
|
||||
const nsIInterfaceRequestor = Components.interfaces.nsIInterfaceRequestor;
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const nsIEditorDocShell = Components.interfaces.nsIEditorDocShell;
|
||||
const nsIDocShell = Components.interfaces.nsIDocShell;
|
||||
|
||||
function hitEventLoop(aFunc, aTimes)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ function getHTMLEditorIMESupport(aWindow)
|
|||
{
|
||||
return aWindow.QueryInterface(nsIInterfaceRequestor).
|
||||
getInterface(nsIWebNavigation).
|
||||
QueryInterface(nsIEditorDocShell).
|
||||
QueryInterface(nsIDocShell).
|
||||
editor;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ function runTests()
|
|||
iframe.contentWindow.
|
||||
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIEditorDocShell).editor;
|
||||
QueryInterface(Components.interfaces.nsIDocShell).editor;
|
||||
var e = aIsInDesignMode ? root : editor;
|
||||
e.focus();
|
||||
is(fm.focusedElement, e,
|
||||
|
|
Загрузка…
Ссылка в новой задаче