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

--HG--
extra : rebase_source : ed29488cfd1434fb200387706ca5a96cb2185090
This commit is contained in:
Masayuki Nakano 2017-09-05 23:32:17 +09:00
parent 0627f8b207
commit 7fb91d43b5

View File

@ -972,16 +972,7 @@ public:
/**
* 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