Bug 720982 - Part b: Remove nsHTMLEditor::InsertBR; r=ehsan

This commit is contained in:
Ms2ger 2012-02-01 11:54:21 +01:00
parent 09983faae3
commit 9b3a6e7944
4 changed files with 3 additions and 41 deletions

View File

@ -1371,44 +1371,6 @@ NS_IMETHODIMP nsHTMLEditor::CreateBR(nsIDOMNode *aNode, PRInt32 aOffset, nsCOMPt
return CreateBRImpl(address_of(parent), &offset, outBRNode, aSelect);
}
NS_IMETHODIMP nsHTMLEditor::InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode)
{
bool bCollapsed;
nsCOMPtr<nsISelection> selection;
NS_ENSURE_TRUE(outBRNode, NS_ERROR_NULL_POINTER);
*outBRNode = nsnull;
// calling it text insertion to trigger moz br treatment by rules
nsAutoRules beginRulesSniffing(this, kOpInsertText, nsIEditor::eNext);
nsresult res = GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res);
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(selection));
res = selection->GetIsCollapsed(&bCollapsed);
NS_ENSURE_SUCCESS(res, res);
if (!bCollapsed)
{
res = DeleteSelection(nsIEditor::eNone);
NS_ENSURE_SUCCESS(res, res);
}
nsCOMPtr<nsIDOMNode> selNode;
PRInt32 selOffset;
res = GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
NS_ENSURE_SUCCESS(res, res);
res = CreateBR(selNode, selOffset, outBRNode);
NS_ENSURE_SUCCESS(res, res);
// position selection after br
res = GetNodeLocation(*outBRNode, address_of(selNode), &selOffset);
NS_ENSURE_SUCCESS(res, res);
selPriv->SetInterlinePosition(true);
res = selection->Collapse(selNode, selOffset+1);
return res;
}
nsresult
nsHTMLEditor::CollapseSelectionToDeepestNonTableFirstChild(nsISelection *aSelection, nsIDOMNode *aNode)
{

View File

@ -445,7 +445,6 @@ protected:
NS_IMETHOD TabInTable(bool inIsShift, bool *outHandled);
NS_IMETHOD CreateBR(nsIDOMNode *aNode, PRInt32 aOffset,
nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone);
NS_IMETHOD InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode);
// Table Editing (implemented in nsTableEditor.cpp)

View File

@ -526,7 +526,8 @@ NS_IMETHODIMP nsPlaintextEditor::CreateBR(nsIDOMNode *aNode, PRInt32 aOffset, ns
return CreateBRImpl(address_of(parent), &offset, outBRNode, aSelect);
}
NS_IMETHODIMP nsPlaintextEditor::InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode)
nsresult
nsPlaintextEditor::InsertBR(nsCOMPtr<nsIDOMNode>* outBRNode)
{
NS_ENSURE_TRUE(outBRNode, NS_ERROR_NULL_POINTER);
*outBRNode = nsnull;

View File

@ -197,7 +197,7 @@ protected:
PRInt32* aInOutOffset,
nsCOMPtr<nsIDOMNode>* outBRNode,
EDirection aSelect);
NS_IMETHOD InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode);
nsresult InsertBR(nsCOMPtr<nsIDOMNode>* outBRNode);
// factored methods for handling insertion of data from transferables (drag&drop or clipboard)
NS_IMETHOD PrepareTransferable(nsITransferable **transferable);