Commit 08f5019d authored by hwaara%chello.se's avatar hwaara%chello.se
Browse files

#114429, caret ignores a backspace on a line before a <HR>.

r=jfrancis, sr=kin
parent 1ef06c2b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -6253,12 +6253,14 @@ nsHTMLEditRules::AdjustSelection(nsISelection *aSelection, nsIEditor::EDirection
  res = mHTMLEditor->GetPriorHTMLSibling(selNode, selOffset, address_of(nearNode));
  if (NS_FAILED(res)) return res;
  if (nearNode && (nsTextEditUtils::IsBreak(nearNode)
                   || nsHTMLEditUtils::IsImage(nearNode)))
                   || nsHTMLEditUtils::IsImage(nearNode)
                   || nsHTMLEditUtils::IsHR(nearNode)))
    return NS_OK; // this is a good place for the caret to be
  res = mHTMLEditor->GetNextHTMLSibling(selNode, selOffset, address_of(nearNode));
  if (NS_FAILED(res)) return res;
  if (nearNode && (nsTextEditUtils::IsBreak(nearNode)
                   || nsHTMLEditUtils::IsImage(nearNode)))
                   || nsHTMLEditUtils::IsImage(nearNode)
                   || nsHTMLEditUtils::IsHR(nearNode)))
    return NS_OK; // this is a good place for the caret to be

  // look for a nearby text node.
+10 −0
Original line number Diff line number Diff line
@@ -101,6 +101,16 @@ nsHTMLEditUtils::IsParagraph(nsIDOMNode *node)
}


///////////////////////////////////////////////////////////////////////////
// IsHR: true if node an horizontal rule
//                  
PRBool 
nsHTMLEditUtils::IsHR(nsIDOMNode *node)
{
  return nsTextEditUtils::NodeIsType(node, NS_LITERAL_STRING("hr"));
}


///////////////////////////////////////////////////////////////////////////
// IsListItem: true if node an html list item
//                  
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ public:
  // from nsHTMLEditRules:
  static PRBool IsHeader(nsIDOMNode *aNode);
  static PRBool IsParagraph(nsIDOMNode *aNode);
  static PRBool IsHR(nsIDOMNode *aNode);
  static PRBool IsListItem(nsIDOMNode *aNode);
  static PRBool IsTable(nsIDOMNode *aNode);
  static PRBool IsTableRow(nsIDOMNode *aNode);