Bug 1397178 - Make EditorBase::GetRoot() not call nsIEditor::GetRootElement() r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 05 Sep 2017 23:32:17 +0900
changeset 428652 259bfd81d8581bd0f1c599d71fa98fb2b02da5e4
parent 428651 7d9dde6b07c42ec33683f48469ce223b148b8622
child 428653 1caa4e7a8319bd5fea0a98faa4a48713dca40770
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1397178
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
editor/libeditor/EditorBase.h
--- 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();
 
   /**