mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 720982 - Part a: Remove nsHTMLEditor::CreateBRImpl; r=ehsan
This commit is contained in:
parent
bb5e266f5e
commit
7602d38c60
@ -1364,87 +1364,6 @@ NS_IMETHODIMP nsHTMLEditor::TabInTable(bool inIsShift, bool *outHandled)
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent,
|
||||
PRInt32 *aInOutOffset,
|
||||
nsCOMPtr<nsIDOMNode> *outBRNode,
|
||||
EDirection aSelect)
|
||||
{
|
||||
NS_ENSURE_TRUE(aInOutParent && *aInOutParent && aInOutOffset && outBRNode, NS_ERROR_NULL_POINTER);
|
||||
*outBRNode = nsnull;
|
||||
nsresult res;
|
||||
|
||||
// we need to insert a br. unfortunately, we may have to split a text node to do it.
|
||||
nsCOMPtr<nsIDOMNode> node = *aInOutParent;
|
||||
PRInt32 theOffset = *aInOutOffset;
|
||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(node);
|
||||
NS_NAMED_LITERAL_STRING(brType, "br");
|
||||
nsCOMPtr<nsIDOMNode> brNode;
|
||||
if (nodeAsText)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> tmp;
|
||||
PRInt32 offset;
|
||||
PRUint32 len;
|
||||
nodeAsText->GetLength(&len);
|
||||
GetNodeLocation(node, address_of(tmp), &offset);
|
||||
NS_ENSURE_TRUE(tmp, NS_ERROR_FAILURE);
|
||||
if (!theOffset)
|
||||
{
|
||||
// we are already set to go
|
||||
}
|
||||
else if (theOffset == (PRInt32)len)
|
||||
{
|
||||
// update offset to point AFTER the text node
|
||||
offset++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// split the text node
|
||||
res = SplitNode(node, theOffset, getter_AddRefs(tmp));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
res = GetNodeLocation(node, address_of(tmp), &offset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
}
|
||||
// create br
|
||||
res = CreateNode(brType, tmp, offset, getter_AddRefs(brNode));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
*aInOutParent = tmp;
|
||||
*aInOutOffset = offset+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CreateNode(brType, node, theOffset, getter_AddRefs(brNode));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
(*aInOutOffset)++;
|
||||
}
|
||||
|
||||
*outBRNode = brNode;
|
||||
if (*outBRNode && (aSelect != eNone))
|
||||
{
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
PRInt32 offset;
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(selection));
|
||||
res = GetNodeLocation(*outBRNode, address_of(parent), &offset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
if (aSelect == eNext)
|
||||
{
|
||||
// position selection after br
|
||||
selPriv->SetInterlinePosition(true);
|
||||
res = selection->Collapse(parent, offset+1);
|
||||
}
|
||||
else if (aSelect == ePrevious)
|
||||
{
|
||||
// position selection before br
|
||||
selPriv->SetInterlinePosition(true);
|
||||
res = selection->Collapse(parent, offset);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::CreateBR(nsIDOMNode *aNode, PRInt32 aOffset, nsCOMPtr<nsIDOMNode> *outBRNode, EDirection aSelect)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> parent = aNode;
|
||||
|
@ -445,10 +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 CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent,
|
||||
PRInt32 *aInOutOffset,
|
||||
nsCOMPtr<nsIDOMNode> *outBRNode,
|
||||
nsIEditor::EDirection aSelect);
|
||||
NS_IMETHOD InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode);
|
||||
|
||||
// Table Editing (implemented in nsTableEditor.cpp)
|
||||
|
@ -436,9 +436,13 @@ NS_IMETHODIMP nsPlaintextEditor::TypedText(const nsAString& aString,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPlaintextEditor::CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent, PRInt32 *aInOutOffset, nsCOMPtr<nsIDOMNode> *outBRNode, EDirection aSelect)
|
||||
nsresult
|
||||
nsPlaintextEditor::CreateBRImpl(nsCOMPtr<nsIDOMNode>* aInOutParent,
|
||||
PRInt32* aInOutOffset,
|
||||
nsCOMPtr<nsIDOMNode>* outBRNode,
|
||||
EDirection aSelect)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(aInOutParent && *aInOutParent && aInOutOffset && outBRNode, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aInOutParent && *aInOutParent && aInOutOffset && outBRNode, NS_ERROR_NULL_POINTER);
|
||||
*outBRNode = nsnull;
|
||||
nsresult res;
|
||||
|
||||
|
@ -193,10 +193,10 @@ protected:
|
||||
// key event helpers
|
||||
NS_IMETHOD CreateBR(nsIDOMNode *aNode, PRInt32 aOffset,
|
||||
nsCOMPtr<nsIDOMNode> *outBRNode, EDirection aSelect = eNone);
|
||||
NS_IMETHOD CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent,
|
||||
PRInt32 *aInOutOffset,
|
||||
nsCOMPtr<nsIDOMNode> *outBRNode,
|
||||
EDirection aSelect);
|
||||
nsresult CreateBRImpl(nsCOMPtr<nsIDOMNode>* aInOutParent,
|
||||
PRInt32* aInOutOffset,
|
||||
nsCOMPtr<nsIDOMNode>* outBRNode,
|
||||
EDirection aSelect);
|
||||
NS_IMETHOD InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode);
|
||||
|
||||
// factored methods for handling insertion of data from transferables (drag&drop or clipboard)
|
||||
|
Loading…
Reference in New Issue
Block a user