Bug 1004522 part 8 - Clean up nsWSRunObject::GetCharBefore/After; r=ehsan
☠☠ backed out by d5a04c3ef7b7 ☠ ☠
authorAryeh Gregor <ayg@aryeh.name>
Fri, 02 May 2014 15:15:27 +0300
changeset 202969 59107353aa68a66f6432bff7548e2503f118ce4b
parent 202968 6cc778964f67d6efe91de3f394fa0e3a04c6d558
child 202970 c5a647958511004d63514b3d78d3250f9d77fc9c
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1004522
milestone32.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 1004522 part 8 - Clean up nsWSRunObject::GetCharBefore/After; r=ehsan
editor/libeditor/html/nsWSRunObject.cpp
editor/libeditor/html/nsWSRunObject.h
--- a/editor/libeditor/html/nsWSRunObject.cpp
+++ b/editor/libeditor/html/nsWSRunObject.cpp
@@ -221,17 +221,17 @@ nsWSRunObject::InsertBreak(nsCOMPtr<nsIN
       // just more aesthetically pleasing to.
       res = DeleteChars(GetAsDOMNode(*aInOutParent), *aInOutOffset,
                         GetAsDOMNode(afterRun->mEndNode), afterRun->mEndOffset,
                         eOutsideUserSelectAll);
       NS_ENSURE_SUCCESS(res, nullptr);
     } else if (afterRun->mType == WSType::normalWS) {
       // Need to determine if break at front of non-nbsp run.  If so, convert
       // run to nbsp.
-      WSPoint thePoint = GetCharAfter(GetAsDOMNode(*aInOutParent), *aInOutOffset);
+      WSPoint thePoint = GetCharAfter(*aInOutParent, *aInOutOffset);
       if (thePoint.mTextNode && nsCRT::IsAsciiSpace(thePoint.mChar)) {
         WSPoint prevPoint = GetCharBefore(thePoint);
         if (prevPoint.mTextNode && !nsCRT::IsAsciiSpace(prevPoint.mChar)) {
           // We are at start of non-nbsps.  Convert to a single nbsp.
           res = ConvertToNBSP(thePoint);
           NS_ENSURE_SUCCESS(res, nullptr);
         }
       }
@@ -329,17 +329,17 @@ nsWSRunObject::InsertText(const nsAStrin
   // ws char into an nbsp:
 
   if (nsCRT::IsAsciiSpace(theString[0])) {
     // We have a leading space
     if (beforeRun) {
       if (beforeRun->mType & WSType::leadingWS) {
         theString.SetCharAt(nbsp, 0);
       } else if (beforeRun->mType & WSType::normalWS) {
-        WSPoint wspoint = GetCharBefore(GetAsDOMNode(*aInOutParent), *aInOutOffset);
+        WSPoint wspoint = GetCharBefore(*aInOutParent, *aInOutOffset);
         if (wspoint.mTextNode && nsCRT::IsAsciiSpace(wspoint.mChar)) {
           theString.SetCharAt(nbsp, 0);
         }
       }
     } else if (mStartReason & WSType::block || mStartReason == WSType::br) {
       theString.SetCharAt(nbsp, 0);
     }
   }
@@ -348,17 +348,17 @@ nsWSRunObject::InsertText(const nsAStrin
   uint32_t lastCharIndex = theString.Length() - 1;
 
   if (nsCRT::IsAsciiSpace(theString[lastCharIndex])) {
     // We have a leading space
     if (afterRun) {
       if (afterRun->mType & WSType::trailingWS) {
         theString.SetCharAt(nbsp, lastCharIndex);
       } else if (afterRun->mType & WSType::normalWS) {
-        WSPoint wspoint = GetCharAfter(GetAsDOMNode(*aInOutParent), *aInOutOffset);
+        WSPoint wspoint = GetCharAfter(*aInOutParent, *aInOutOffset);
         if (wspoint.mTextNode && nsCRT::IsAsciiSpace(wspoint.mChar)) {
           theString.SetCharAt(nbsp, lastCharIndex);
         }
       }
     } else if (mEndReason & WSType::block) {
       theString.SetCharAt(nbsp, lastCharIndex);
     }
   }
@@ -388,17 +388,17 @@ nsWSRunObject::InsertText(const nsAStrin
                                     aInOutOffset, doc);
   *aInOutParent = do_QueryInterface(parent);
   return NS_OK;
 }
 
 nsresult
 nsWSRunObject::DeleteWSBackward()
 {
-  WSPoint point = GetCharBefore(GetAsDOMNode(mNode), mOffset);
+  WSPoint point = GetCharBefore(mNode, mOffset);
   NS_ENSURE_TRUE(point.mTextNode, NS_OK);  // nothing to delete
 
   if (mPRE) {
     // easy case, preformatted ws
     if (nsCRT::IsAsciiSpace(point.mChar) || point.mChar == nbsp) {
       return DeleteChars(GetAsDOMNode(point.mTextNode), point.mOffset,
                          GetAsDOMNode(point.mTextNode), point.mOffset + 1);
     }
@@ -440,17 +440,17 @@ nsWSRunObject::DeleteWSBackward()
     return DeleteChars(GetAsDOMNode(node), startOffset, GetAsDOMNode(node), endOffset);
   }
   return NS_OK;
 }
 
 nsresult
 nsWSRunObject::DeleteWSForward()
 {
-  WSPoint point = GetCharAfter(GetAsDOMNode(mNode), mOffset);
+  WSPoint point = GetCharAfter(mNode, mOffset);
   NS_ENSURE_TRUE(point.mTextNode, NS_OK); // nothing to delete
 
   if (mPRE) {
     // easy case, preformatted ws
     if (nsCRT::IsAsciiSpace(point.mChar) || point.mChar == nbsp) {
       return DeleteChars(GetAsDOMNode(point.mTextNode), point.mOffset,
                          GetAsDOMNode(point.mTextNode), point.mOffset + 1);
     }
@@ -501,17 +501,17 @@ nsWSRunObject::PriorVisibleNode(nsINode*
   MOZ_ASSERT(aNode && outVisNode && outVisOffset && outType);
 
   WSFragment* run;
   FindRun(GetAsDOMNode(aNode), aOffset, &run, false);
 
   // Is there a visible run there or earlier?
   for (; run; run = run->mLeft) {
     if (run->mType == WSType::normalWS) {
-      WSPoint point = GetCharBefore(GetAsDOMNode(aNode), aOffset);
+      WSPoint point = GetCharBefore(aNode, aOffset);
       if (point.mTextNode) {
         *outVisNode = point.mTextNode;
         *outVisOffset = point.mOffset + 1;
         if (nsCRT::IsAsciiSpace(point.mChar) || point.mChar == nbsp) {
           *outType = WSType::normalWS;
         } else if (!point.mChar) {
           // MOOSE: not possible?
           *outType = WSType::none;
@@ -545,17 +545,17 @@ nsWSRunObject::NextVisibleNode(nsINode* 
   MOZ_ASSERT(aNode && outVisNode && outVisOffset && outType);
 
   WSFragment* run;
   FindRun(GetAsDOMNode(aNode), aOffset, &run, true);
 
   // Is there a visible run there or later?
   for (; run; run = run->mRight) {
     if (run->mType == WSType::normalWS) {
-      WSPoint point = GetCharAfter(GetAsDOMNode(aNode), aOffset);
+      WSPoint point = GetCharAfter(aNode, aOffset);
       if (point.mTextNode) {
         *outVisNode = point.mTextNode;
         *outVisOffset = point.mOffset;
         if (nsCRT::IsAsciiSpace(point.mChar) || point.mChar == nbsp) {
           *outType = WSType::normalWS;
         } else if (!point.mChar) {
           // MOOSE: not possible?
           *outType = WSType::none;
@@ -1246,17 +1246,17 @@ nsWSRunObject::PrepareToDeleteRangePriv(
     NS_ENSURE_SUCCESS(res, res);
   }
   // adjust normal ws in afterRun if needed
   if (afterRun && afterRun->mType == WSType::normalWS && !aEndObject->mPRE) {
     if ((beforeRun && (beforeRun->mType & WSType::leadingWS)) ||
         (!beforeRun && ((mStartReason & WSType::block) ||
                         mStartReason == WSType::br))) {
       // make sure leading char of following ws is an nbsp, so that it will show up
-      WSPoint point = aEndObject->GetCharAfter(GetAsDOMNode(aEndObject->mNode),
+      WSPoint point = aEndObject->GetCharAfter(aEndObject->mNode,
                                                aEndObject->mOffset);
       if (point.mTextNode && nsCRT::IsAsciiSpace(point.mChar))
       {
         res = aEndObject->ConvertToNBSP(point, eOutsideUserSelectAll);
         NS_ENSURE_SUCCESS(res, res);
       }
     }
   }
@@ -1265,17 +1265,17 @@ nsWSRunObject::PrepareToDeleteRangePriv(
     res = DeleteChars(GetAsDOMNode(beforeRun->mStartNode), beforeRun->mStartOffset, GetAsDOMNode(mNode), mOffset,
                       eOutsideUserSelectAll);
     NS_ENSURE_SUCCESS(res, res);
   } else if (beforeRun && beforeRun->mType == WSType::normalWS && !mPRE) {
     if ((afterRun && (afterRun->mType & WSType::trailingWS)) ||
         (afterRun && afterRun->mType == WSType::normalWS) ||
         (!afterRun && (aEndObject->mEndReason & WSType::block))) {
       // make sure trailing char of starting ws is an nbsp, so that it will show up
-      WSPoint point = GetCharBefore(GetAsDOMNode(mNode), mOffset);
+      WSPoint point = GetCharBefore(mNode, mOffset);
       if (point.mTextNode && nsCRT::IsAsciiSpace(point.mChar))
       {
         nsCOMPtr<nsIDOMNode> wsStartNode, wsEndNode;
         int32_t wsStartOffset, wsEndOffset;
         GetAsciiWSBounds(eBoth, GetAsDOMNode(mNode), mOffset, address_of(wsStartNode),
                          &wsStartOffset, address_of(wsEndNode), &wsEndOffset);
         point.mTextNode = do_QueryInterface(wsStartNode);
         point.mOffset = wsStartOffset;
@@ -1298,28 +1298,28 @@ nsWSRunObject::PrepareToSplitAcrossBlock
   // get the runs before and after selection
   WSFragment *beforeRun, *afterRun;
   FindRun(GetAsDOMNode(mNode), mOffset, &beforeRun, false);
   FindRun(GetAsDOMNode(mNode), mOffset, &afterRun, true);
   
   // adjust normal ws in afterRun if needed
   if (afterRun && afterRun->mType == WSType::normalWS) {
     // make sure leading char of following ws is an nbsp, so that it will show up
-    WSPoint point = GetCharAfter(GetAsDOMNode(mNode), mOffset);
+    WSPoint point = GetCharAfter(mNode, mOffset);
     if (point.mTextNode && nsCRT::IsAsciiSpace(point.mChar))
     {
       res = ConvertToNBSP(point);
       NS_ENSURE_SUCCESS(res, res);
     }
   }
 
   // adjust normal ws in beforeRun if needed
   if (beforeRun && beforeRun->mType == WSType::normalWS) {
     // make sure trailing char of starting ws is an nbsp, so that it will show up
-    WSPoint point = GetCharBefore(GetAsDOMNode(mNode), mOffset);
+    WSPoint point = GetCharBefore(mNode, mOffset);
     if (point.mTextNode && nsCRT::IsAsciiSpace(point.mChar))
     {
       nsCOMPtr<nsIDOMNode> wsStartNode, wsEndNode;
       int32_t wsStartOffset, wsEndOffset;
       GetAsciiWSBounds(eBoth, GetAsDOMNode(mNode), mOffset, address_of(wsStartNode),
                        &wsStartOffset, address_of(wsEndNode), &wsEndOffset);
       point.mTextNode = do_QueryInterface(wsStartNode);
       point.mOffset = wsStartOffset;
@@ -1433,122 +1433,103 @@ nsWSRunObject::DeleteChars(nsIDOMNode *a
       }
     }
     idx++;
   }
   return res;
 }
 
 nsWSRunObject::WSPoint
-nsWSRunObject::GetCharAfter(nsIDOMNode *aNode, int32_t aOffset)
+nsWSRunObject::GetCharAfter(nsINode* aNode, int32_t aOffset)
 {
   MOZ_ASSERT(aNode);
 
-  nsCOMPtr<nsIContent> node(do_QueryInterface(aNode));
-  int32_t idx = mNodeArray.IndexOf(node);
-  if (idx == -1) 
-  {
-    // use range comparisons to get right ws node
-    return GetWSPointAfter(aNode, aOffset);
-  }
-  else
-  {
-    // use wspoint version of GetCharAfter()
-    WSPoint point(node, aOffset, 0);
-    return GetCharAfter(point);
+  int32_t idx = mNodeArray.IndexOf(aNode);
+  if (idx == -1) {
+    // Use range comparisons to get right ws node
+    return GetWSPointAfter(GetAsDOMNode(aNode), aOffset);
+  } else {
+    // Use WSPoint version of GetCharAfter()
+    return GetCharAfter(WSPoint(aNode, aOffset, 0));
   }
 }
 
 nsWSRunObject::WSPoint
-nsWSRunObject::GetCharBefore(nsIDOMNode *aNode, int32_t aOffset)
+nsWSRunObject::GetCharBefore(nsINode* aNode, int32_t aOffset)
 {
   MOZ_ASSERT(aNode);
 
-  nsCOMPtr<nsIContent> node(do_QueryInterface(aNode));
-  int32_t idx = mNodeArray.IndexOf(node);
-  if (idx == -1) 
-  {
-    // use range comparisons to get right ws node
-    return GetWSPointBefore(aNode, aOffset);
-  }
-  else
-  {
-    // use wspoint version of GetCharBefore()
-    WSPoint point(node, aOffset, 0);
-    return GetCharBefore(point);
+  int32_t idx = mNodeArray.IndexOf(aNode);
+  if (idx == -1) {
+    // Use range comparisons to get right ws node
+    return GetWSPointBefore(GetAsDOMNode(aNode), aOffset);
+  } else {
+    // Use WSPoint version of GetCharBefore()
+    return GetCharBefore(WSPoint(aNode, aOffset, 0));
   }
 }
 
 nsWSRunObject::WSPoint
 nsWSRunObject::GetCharAfter(const WSPoint &aPoint)
 {
   MOZ_ASSERT(aPoint.mTextNode);
-  
+
   WSPoint outPoint;
   outPoint.mTextNode = nullptr;
   outPoint.mOffset = 0;
   outPoint.mChar = 0;
 
   int32_t idx = mNodeArray.IndexOf(aPoint.mTextNode);
   if (idx == -1) {
-    // can't find point, but it's not an error
+    // Can't find point, but it's not an error
     return outPoint;
   }
   int32_t numNodes = mNodeArray.Count();
-  
-  if (uint16_t(aPoint.mOffset) < aPoint.mTextNode->TextLength())
-  {
+
+  if (uint16_t(aPoint.mOffset) < aPoint.mTextNode->TextLength()) {
     outPoint = aPoint;
     outPoint.mChar = GetCharAt(aPoint.mTextNode, aPoint.mOffset);
     return outPoint;
-  } else if (idx + 1 < (int32_t)numNodes) {
-    nsIDOMNode* node = GetAsDOMNode(mNodeArray[idx+1]);
-    MOZ_ASSERT(node);
-    outPoint.mTextNode = do_QueryInterface(node);
+  } else if (idx + 1 < numNodes) {
+    outPoint.mTextNode = do_QueryInterface(mNodeArray[idx + 1]);
+    MOZ_ASSERT(outPoint.mTextNode);
     outPoint.mOffset = 0;
     outPoint.mChar = GetCharAt(outPoint.mTextNode, 0);
   }
   return outPoint;
 }
 
 nsWSRunObject::WSPoint
 nsWSRunObject::GetCharBefore(const WSPoint &aPoint)
 {
   MOZ_ASSERT(aPoint.mTextNode);
-  
+
   WSPoint outPoint;
   outPoint.mTextNode = nullptr;
   outPoint.mOffset = 0;
   outPoint.mChar = 0;
-  
+
   int32_t idx = mNodeArray.IndexOf(aPoint.mTextNode);
   if (idx == -1) {
-    // can't find point, but it's not an error
+    // Can't find point, but it's not an error
     return outPoint;
   }
-  
-  if (aPoint.mOffset != 0)
-  {
+
+  if (aPoint.mOffset != 0) {
     outPoint = aPoint;
     outPoint.mOffset--;
-    outPoint.mChar = GetCharAt(aPoint.mTextNode, aPoint.mOffset-1);
+    outPoint.mChar = GetCharAt(aPoint.mTextNode, aPoint.mOffset - 1);
     return outPoint;
-  }
-  else if (idx)
-  {
-    nsIDOMNode* node = GetAsDOMNode(mNodeArray[idx-1]);
-    MOZ_ASSERT(node);
-    outPoint.mTextNode = do_QueryInterface(node);
+  } else if (idx) {
+    outPoint.mTextNode = do_QueryInterface(mNodeArray[idx - 1]);
 
     uint32_t len = outPoint.mTextNode->TextLength();
-
-    if (len)
-    {
-      outPoint.mOffset = len-1;
-      outPoint.mChar = GetCharAt(outPoint.mTextNode, len-1);
+    if (len) {
+      outPoint.mOffset = len - 1;
+      outPoint.mChar = GetCharAt(outPoint.mTextNode, len - 1);
     }
   }
   return outPoint;
 }
 
 nsresult 
 nsWSRunObject::ConvertToNBSP(WSPoint aPoint, AreaRestriction aAR)
 {
@@ -1613,19 +1594,20 @@ nsWSRunObject::GetAsciiWSBounds(int16_t 
                                 nsCOMPtr<nsIDOMNode> *outStartNode, int32_t *outStartOffset,
                                 nsCOMPtr<nsIDOMNode> *outEndNode, int32_t *outEndOffset)
 {
   MOZ_ASSERT(aNode && outStartNode && outEndNode);
 
   nsCOMPtr<nsIDOMNode> startNode, endNode;
   int32_t startOffset=0, endOffset=0;
   
+  nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
   if (aDir & eAfter)
   {
-    WSPoint point = GetCharAfter(aNode, aOffset);
+    WSPoint point = GetCharAfter(node, aOffset);
     if (point.mTextNode) {
       // we found a text node, at least
       endNode = do_QueryInterface(point.mTextNode);
       endOffset = point.mOffset;
       startNode = endNode;
       startOffset = endOffset;
       
       // scan ahead to end of ascii ws
@@ -1639,17 +1621,17 @@ nsWSRunObject::GetAsciiWSBounds(int16_t 
           break;
         }
       }
     }
   }
   
   if (aDir & eBefore)
   {
-    WSPoint point = GetCharBefore(aNode, aOffset);
+    WSPoint point = GetCharBefore(node, aOffset);
     if (point.mTextNode) {
       // we found a text node, at least
       startNode = do_QueryInterface(point.mTextNode);
       startOffset = point.mOffset+1;
       if (!endNode)
       {
         endNode = startNode;
         endOffset = startOffset;
@@ -1867,17 +1849,17 @@ nsWSRunObject::CheckTrailingNBSPOfRun(WS
   bool rightCheck = false;
 
   // confirm run is normalWS
   if (aRun->mType != WSType::normalWS) {
     return NS_ERROR_FAILURE;
   }
 
   // first check for trailing nbsp
-  WSPoint thePoint = GetCharBefore(GetAsDOMNode(aRun->mEndNode), aRun->mEndOffset);
+  WSPoint thePoint = GetCharBefore(aRun->mEndNode, aRun->mEndOffset);
   if (thePoint.mTextNode && thePoint.mChar == nbsp) {
     // now check that what is to the left of it is compatible with replacing nbsp with space
     WSPoint prevPoint = GetCharBefore(thePoint);
     if (prevPoint.mTextNode) {
       if (!nsCRT::IsAsciiSpace(prevPoint.mChar)) {
         leftCheck = true;
       } else {
         spaceNBSP = true;
@@ -1917,17 +1899,17 @@ nsWSRunObject::CheckTrailingNBSPOfRun(WS
         // beginning of soft wrapped lines, and lets the user see 2 spaces when
         // they type 2 spaces.
 
         nsCOMPtr<Element> brNode =
           mHTMLEditor->CreateBR(aRun->mEndNode, aRun->mEndOffset);
         NS_ENSURE_TRUE(brNode, NS_ERROR_FAILURE);
 
         // Refresh thePoint, prevPoint
-        thePoint = GetCharBefore(GetAsDOMNode(aRun->mEndNode), aRun->mEndOffset);
+        thePoint = GetCharBefore(aRun->mEndNode, aRun->mEndOffset);
         prevPoint = GetCharBefore(thePoint);
         rightCheck = true;
       }
     }
     if (leftCheck && rightCheck) {
       // Now replace nbsp with space.  First, insert a space
       nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
       nsAutoString spaceStr(char16_t(32));
@@ -1974,17 +1956,18 @@ nsresult
 nsWSRunObject::CheckTrailingNBSP(WSFragment *aRun, nsIDOMNode *aNode, int32_t aOffset)
 {    
   // try to change an nbsp to a space, if possible, just to prevent nbsp proliferation. 
   // this routine is called when we about to make this point in the ws abut an inserted break
   // or text, so we don't have to worry about what is after it.  What is after it now will 
   // end up after the inserted object.   
   NS_ENSURE_TRUE(aRun && aNode, NS_ERROR_NULL_POINTER);
   bool canConvert = false;
-  WSPoint thePoint = GetCharBefore(aNode, aOffset);
+  nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
+  WSPoint thePoint = GetCharBefore(node, aOffset);
   if (thePoint.mTextNode && thePoint.mChar == nbsp) {
     WSPoint prevPoint = GetCharBefore(thePoint);
     if (prevPoint.mTextNode) {
       if (!nsCRT::IsAsciiSpace(prevPoint.mChar)) canConvert = true;
     } else if (aRun->mLeftType == WSType::text) {
       canConvert = true;
     } else if (aRun->mLeftType == WSType::special) {
       canConvert = true;
@@ -2013,17 +1996,18 @@ nsWSRunObject::CheckTrailingNBSP(WSFragm
 nsresult
 nsWSRunObject::CheckLeadingNBSP(WSFragment *aRun, nsIDOMNode *aNode, int32_t aOffset)
 {    
   // try to change an nbsp to a space, if possible, just to prevent nbsp proliferation    
   // this routine is called when we about to make this point in the ws abut an inserted
   // text, so we don't have to worry about what is before it.  What is before it now will 
   // end up before the inserted text.   
   bool canConvert = false;
-  WSPoint thePoint = GetCharAfter(aNode, aOffset);
+  nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
+  WSPoint thePoint = GetCharAfter(node, aOffset);
   if (thePoint.mChar == nbsp) {
     WSPoint tmp = thePoint;
     tmp.mOffset++; // we want to be after thePoint
     WSPoint nextPoint = GetCharAfter(tmp);
     if (nextPoint.mTextNode) {
       if (!nsCRT::IsAsciiSpace(nextPoint.mChar)) canConvert = true;
     } else if (aRun->mRightType == WSType::text) {
       canConvert = true;
--- a/editor/libeditor/html/nsWSRunObject.h
+++ b/editor/libeditor/html/nsWSRunObject.h
@@ -325,20 +325,20 @@ class MOZ_STACK_CLASS nsWSRunObject
     nsresult GetNextWSNode(::DOMPoint aPoint,
                            nsINode* aBlockParent,
                            nsCOMPtr<nsINode>* aNextNode);
     nsresult PrepareToDeleteRangePriv(nsWSRunObject* aEndObject);
     nsresult PrepareToSplitAcrossBlocksPriv();
     nsresult DeleteChars(nsIDOMNode *aStartNode, int32_t aStartOffset, 
                          nsIDOMNode *aEndNode, int32_t aEndOffset,
                          AreaRestriction aAR = eAnywhere);
-    WSPoint  GetCharAfter(nsIDOMNode *aNode, int32_t aOffset);
-    WSPoint  GetCharBefore(nsIDOMNode *aNode, int32_t aOffset);
-    WSPoint  GetCharAfter(const WSPoint &aPoint);
-    WSPoint  GetCharBefore(const WSPoint &aPoint);
+    WSPoint  GetCharAfter(nsINode* aNode, int32_t aOffset);
+    WSPoint  GetCharBefore(nsINode* aNode, int32_t aOffset);
+    WSPoint  GetCharAfter(const WSPoint& aPoint);
+    WSPoint  GetCharBefore(const WSPoint& aPoint);
     nsresult ConvertToNBSP(WSPoint aPoint,
                            AreaRestriction aAR = eAnywhere);
     void     GetAsciiWSBounds(int16_t aDir, nsINode* aNode, int32_t aOffset,
                               nsIContent** outStartNode,
                               int32_t* outStartOffset,
                               nsIContent** outEndNode,
                               int32_t* outEndOffset);
     void     GetAsciiWSBounds(int16_t aDir, nsIDOMNode *aNode, int32_t aOffset,