Bug 744507 - Part a: Preparatory cleanup in GetPriorHTMLSibling/GetNextHTMLSibling; r=ehsan
authorMs2ger <ms2ger@gmail.com>
Sat, 14 Apr 2012 15:09:21 +0200
changeset 94993 750a67926d63e790e9caa79598497656402d23a6
parent 94992 76de926c1758120e28fa26f76990dc84f03f5156
child 94994 246f9bfe84fc4907dfe944e80dd9b212a92398bc
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs744507
milestone14.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 744507 - Part a: Preparatory cleanup in GetPriorHTMLSibling/GetNextHTMLSibling; r=ehsan
editor/libeditor/html/nsHTMLEditor.cpp
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -4240,26 +4240,25 @@ nsHTMLEditor::GetPriorHTMLSibling(nsIDOM
 // GetPriorHTMLSibling: returns the previous editable sibling, if there is
 //                   one within the parent.  just like above routine but
 //                   takes a parent/offset instead of a node.
 //                       
 nsresult
 nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
 {
   NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
-  nsresult res = NS_OK;
   *outNode = nsnull;
-  if (inOffset <= 0) {
-    // return null sibling if at offset zero
+  nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent,inOffset-1);
+  if (!node) {
+    // return null sibling if no sibling
     return NS_OK;
   }
-  nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent,inOffset-1);
-  if (node && IsEditable(node)) {
+  if (IsEditable(node)) {
     *outNode = node;
-    return res;
+    return NS_OK;
   }
   // else
   return GetPriorHTMLSibling(node, outNode);
 }
 
 
 
 ///////////////////////////////////////////////////////////////////////////
@@ -4297,26 +4296,25 @@ nsHTMLEditor::GetNextHTMLSibling(nsIDOMN
 // GetNextHTMLSibling: returns the next editable sibling, if there is
 //                   one within the parent.  just like above routine but
 //                   takes a parent/offset instead of a node.
 //                       
 nsresult
 nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
 {
   NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
-  nsresult res = NS_OK;
   *outNode = nsnull;
   nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent, inOffset + 1);
   if (!node) {
     // return null sibling if no sibling
     return NS_OK;
   }
-  if (node && IsEditable(node)) {
+  if (IsEditable(node)) {
     *outNode = node;
-    return res;
+    return NS_OK;
   }
   // else
   return GetNextHTMLSibling(node, outNode);
 }
 
 
 
 ///////////////////////////////////////////////////////////////////////////