mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1295370 - Stop lazily creating the root node in nsTextEditorState::GetRootFrame. r=ehsan
AFAICT this doesn't change behavior, since all the callers of GetRootNode should occur after we've already called BindToFrame. However, it makes it easier for future static analysis to see that we don't trigger node creation from nsTextControlFrame::AppendAnonymousContentTo.
This commit is contained in:
parent
31b4bcc859
commit
c2cbbe5f56
@ -1157,9 +1157,11 @@ nsTextEditorState::BindToFrame(nsTextControlFrame* aFrame)
|
||||
|
||||
mBoundFrame = aFrame;
|
||||
|
||||
nsIContent *rootNode = GetRootNode();
|
||||
nsresult rv = CreateRootNode();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsresult rv = InitializeRootNode();
|
||||
nsIContent *rootNode = GetRootNode();
|
||||
rv = InitializeRootNode();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIPresShell *shell = mBoundFrame->PresContext()->GetPresShell();
|
||||
@ -1753,8 +1755,8 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
|
||||
nsresult
|
||||
nsTextEditorState::CreateRootNode()
|
||||
{
|
||||
NS_ENSURE_TRUE(!mRootNode, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_ARG_POINTER(mBoundFrame);
|
||||
MOZ_ASSERT(!mRootNode);
|
||||
MOZ_ASSERT(mBoundFrame);
|
||||
|
||||
nsIPresShell *shell = mBoundFrame->PresContext()->GetPresShell();
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
|
@ -163,8 +163,6 @@ public:
|
||||
nsresult CreatePlaceholderNode();
|
||||
|
||||
mozilla::dom::Element* GetRootNode() {
|
||||
if (!mRootNode)
|
||||
CreateRootNode();
|
||||
return mRootNode;
|
||||
}
|
||||
mozilla::dom::Element* GetPlaceholderNode() {
|
||||
|
Loading…
Reference in New Issue
Block a user