Bug 1374207 - part4: Element classes should use TextEditor class instead of nIEditor r=smaug
Unfortunately, nsGenericHTMLElement::GetAssociatedEditor() cannot use concrete classes because it may return nsIEditor which is set via nsIDocShell.editor. The editor set to nsIDocShell may be implemented by JS since nsIEditor isn't marked as builtinclass. MozReview-Commit-ID: 6GY9LOYp4hM
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "HTMLBodyElement.h"
|
||||
#include "mozilla/dom/HTMLBodyElementBinding.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/TextEditor.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
@@ -394,9 +395,9 @@ HTMLBodyElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
already_AddRefed<nsIEditor>
|
||||
HTMLBodyElement::GetAssociatedEditor()
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = GetEditorInternal();
|
||||
if (editor) {
|
||||
return editor.forget();
|
||||
RefPtr<TextEditor> textEditor = GetTextEditorInternal();
|
||||
if (textEditor) {
|
||||
return textEditor.forget();
|
||||
}
|
||||
|
||||
// Make sure this is the actual body of the document
|
||||
@@ -415,6 +416,7 @@ HTMLBodyElement::GetAssociatedEditor()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
docShell->GetEditor(getter_AddRefs(editor));
|
||||
return editor.forget();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user