зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1388004 - part3: nsINode::GetSelectionRootContent() should use HTMLEditor r=smaug
nsINode::GetSelectionRootContent() uses nsIEditor since nsContentUtils::GetHTMLEditor() returned nsIEditor. Therefore, it needed to use GetEditorRootContent() to retrieve the editor root element as nsIContent*. Now, it can use HTMLEditor and HTMLEditor::GetRoot() returns the editor root element as nsIContent* directly. So, it should use HTMLEditor instead. MozReview-Commit-ID: I937a5TuxVD --HG-- extra : rebase_source : 5c00be8b590ca3d4d4290a69eef1e2e177ee069d
This commit is contained in:
Родитель
8872065ef4
Коммит
5791416beb
|
@ -62,7 +62,6 @@
|
|||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "mozilla/dom/NodeInfo.h"
|
||||
#include "mozilla/dom/NodeInfoInlines.h"
|
||||
|
@ -225,14 +224,6 @@ nsINode::IsEditableInternal() const
|
|||
return doc && doc->HasFlag(NODE_IS_EDITABLE);
|
||||
}
|
||||
|
||||
static nsIContent* GetEditorRootContent(nsIEditor* aEditor)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
aEditor->GetRootElement(getter_AddRefs(rootElement));
|
||||
nsCOMPtr<nsIContent> rootContent(do_QueryInterface(rootElement));
|
||||
return rootContent;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsINode::GetTextEditorRootContent(TextEditor** aTextEditor)
|
||||
{
|
||||
|
@ -366,13 +357,13 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
|
|||
|
||||
nsPresContext* presContext = aPresShell->GetPresContext();
|
||||
if (presContext) {
|
||||
nsIEditor* editor = nsContentUtils::GetHTMLEditor(presContext);
|
||||
if (editor) {
|
||||
HTMLEditor* htmlEditor = nsContentUtils::GetHTMLEditor(presContext);
|
||||
if (htmlEditor) {
|
||||
// This node is in HTML editor.
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (!doc || doc->HasFlag(NODE_IS_EDITABLE) ||
|
||||
!HasFlag(NODE_IS_EDITABLE)) {
|
||||
nsIContent* editorRoot = GetEditorRootContent(editor);
|
||||
nsIContent* editorRoot = htmlEditor->GetRoot();
|
||||
NS_ENSURE_TRUE(editorRoot, nullptr);
|
||||
return nsContentUtils::IsInSameAnonymousTree(this, editorRoot) ?
|
||||
editorRoot :
|
||||
|
|
Загрузка…
Ссылка в новой задаче