From 93aae1ae2b7c2c3bf0c2ed230f03455f6ef07dac Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 28 Sep 2015 09:19:23 -0400 Subject: [PATCH] Bug 1209037 - Eliminate some unneeded null checks; r=jdm --- editor/libeditor/nsHTMLEditRules.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/editor/libeditor/nsHTMLEditRules.cpp b/editor/libeditor/nsHTMLEditRules.cpp index c423dc32709..61026a8a02a 100644 --- a/editor/libeditor/nsHTMLEditRules.cpp +++ b/editor/libeditor/nsHTMLEditRules.cpp @@ -6642,12 +6642,9 @@ nsHTMLEditRules::SplitParagraph(nsIDOMNode *aPara, NS_ENSURE_STATE(mHTMLEditor && rightParaNode); nsCOMPtr child = GetAsDOMNode(mHTMLEditor->GetLeftmostChild(rightParaNode, true)); - NS_ENSURE_STATE(mHTMLEditor); - if (!mHTMLEditor || - mHTMLEditor->IsTextNode(child) || + if (mHTMLEditor->IsTextNode(child) || mHTMLEditor->IsContainer(child)) { - NS_ENSURE_STATE(mHTMLEditor); aSelection->Collapse(child,0); } else @@ -7442,12 +7439,9 @@ nsHTMLEditRules::PinSelectionToNewBlock(Selection* aSelection) NS_ENSURE_STATE(mHTMLEditor); tmp = GetAsDOMNode(mHTMLEditor->GetLastEditableChild(*block)); uint32_t endPoint; - NS_ENSURE_STATE(mHTMLEditor); - if (!mHTMLEditor || - mHTMLEditor->IsTextNode(tmp) || + if (mHTMLEditor->IsTextNode(tmp) || mHTMLEditor->IsContainer(tmp)) { - NS_ENSURE_STATE(mHTMLEditor); res = nsEditor::GetLengthOfDOMNode(tmp, endPoint); NS_ENSURE_SUCCESS(res, res); } @@ -7462,16 +7456,13 @@ nsHTMLEditRules::PinSelectionToNewBlock(Selection* aSelection) { // selection is before block. put at start of block. nsCOMPtr tmp = mNewBlock; - NS_ENSURE_STATE(mHTMLEditor); tmp = GetAsDOMNode(mHTMLEditor->GetFirstEditableChild(*block)); int32_t offset; - if (mHTMLEditor && - !(mHTMLEditor->IsTextNode(tmp) || - mHTMLEditor->IsContainer(tmp))) + if (mHTMLEditor->IsTextNode(tmp) || + mHTMLEditor->IsContainer(tmp)) { tmp = nsEditor::GetNodeLocation(tmp, &offset); } - NS_ENSURE_STATE(mHTMLEditor); return aSelection->Collapse(tmp, 0); } }