Bug 1397178 - Make EditorBase::GetRoot() not call nsIEditor::GetRootElement() r?smaug
In the old design, EditorBase::mRootElement is initialized when
nsIEditor::GetRootElement() is called. Therefore, EditorBase::GetRoot()
calls if mRootElement is nullptr.
However, mRootElement is now initialized when EditorBase::UpdateRootElement()
is called and it's always initialized when EditorBase::Init() is called.
So, EditorBase::GetRoot() doesn't need to call nsIEditor::GetRootElement()
anymore.
MozReview-Commit-ID: 6dNEJaGNMZe
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -967,26 +967,17 @@ public:
nsIDOMNode* aEndContainer,
int32_t aEndOffset);
virtual already_AddRefed<dom::EventTarget> GetDOMEventTarget() = 0;
/**
* Fast non-refcounting editor root element accessor
*/
- Element* GetRoot()
- {
- if (!mRootElement) {
- // Let GetRootElement() do the work
- nsCOMPtr<nsIDOMElement> root;
- GetRootElement(getter_AddRefs(root));
- }
-
- return mRootElement;
- }
+ Element* GetRoot() const { return mRootElement; }
/**
* Likewise, but gets the editor's root instead, which is different for HTML
* editors.
*/
virtual Element* GetEditorRoot();
/**