if (offset > 0) { nsCOMPtr<nsIContent> child; result = parentDIV->ChildAt(offset - 1, *getter_AddRefs(child)); if (NS_SUCCEEDED(result) && child) { nsCOMPtr<nsIAtom> tagName; result = child->GetTag(*getter_AddRefs(tagName)); if (NS_SUCCEEDED(result) && tagName.get() == nsHTMLAtoms::br) --offset; } } }
nsTextInputSelectionImpl::CompleteMove(PRBool aForward, PRBool aExtend){  // grab the parent / root DIV for this text widget  nsresult result;  nsCOMPtr<nsIContent> parentDIV;  result = GetLimiter(getter_AddRefs(parentDIV));  if (NS_FAILED(result))    return result;  if (!parentDIV)    return NS_ERROR_UNEXPECTED;  // make the caret be either at the very beginning (0) or the very end  PRInt32 offset = 0;  if (aForward)    parentDIV->ChildCount(offset);  result = mFrameSelection->HandleClick(parentDIV, offset, offset, aExtend, PR_FALSE, aExtend);  // if we got this far, attempt to scroll no matter what the above result is  return CompleteScroll(aForward);}