Bug 1388004 - part2: Make nsGenericHTMLElement::GetAssociatedEditor() return TextEditor instead of nsIEditor r=smaug

nsGenericHTMLElement::GetAssociatedEditor() retrieves TextEditor if the element is <input type="text"> or something, or <textarea>, or if it's editable, HTMLEditor associated to the document.  So, this method can return TextEditor (HTMLEditor is a subclass of TextEditor).

MozReview-Commit-ID: BvpFPaPLY70
This commit is contained in:
Masayuki Nakano
2017-08-07 16:53:59 +09:00
parent 4ca6e37750
commit 5d4c1b5b7d
4 changed files with 14 additions and 14 deletions

View File

@@ -7,6 +7,7 @@
#include "HTMLBodyElement.h"
#include "mozilla/dom/HTMLBodyElementBinding.h"
#include "mozilla/GenericSpecifiedValuesInlines.h"
#include "mozilla/HTMLEditor.h"
#include "mozilla/TextEditor.h"
#include "nsAttrValueInlines.h"
#include "nsGkAtoms.h"
@@ -15,7 +16,6 @@
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsHTMLStyleSheet.h"
#include "nsIEditor.h"
#include "nsMappedAttributes.h"
#include "nsIDocShell.h"
#include "nsRuleWalker.h"
@@ -392,7 +392,7 @@ HTMLBodyElement::IsAttributeMapped(const nsIAtom* aAttribute) const
return FindAttributeDependence(aAttribute, map);
}
already_AddRefed<nsIEditor>
already_AddRefed<TextEditor>
HTMLBodyElement::GetAssociatedEditor()
{
RefPtr<TextEditor> textEditor = GetTextEditorInternal();
@@ -416,9 +416,8 @@ HTMLBodyElement::GetAssociatedEditor()
return nullptr;
}
nsCOMPtr<nsIEditor> editor;
docShell->GetEditor(getter_AddRefs(editor));
return editor.forget();
RefPtr<HTMLEditor> htmlEditor = docShell->GetHTMLEditor();
return htmlEditor.forget();
}
bool