mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 569523 - GetStartNodeAndOffset should take an nsIDOMNode** parameter, instead of nsCOMPtr<nsIDOMNode>*; r=roc
This commit is contained in:
parent
78a40d380d
commit
181e117cff
@ -2778,9 +2778,9 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
|
|||||||
// remember some selection points
|
// remember some selection points
|
||||||
nsCOMPtr<nsIDOMNode> selStartNode, selEndNode;
|
nsCOMPtr<nsIDOMNode> selStartNode, selEndNode;
|
||||||
PRInt32 selStartOffset, selEndOffset;
|
PRInt32 selStartOffset, selEndOffset;
|
||||||
result = GetStartNodeAndOffset(selection, address_of(selStartNode), &selStartOffset);
|
result = GetStartNodeAndOffset(selection, getter_AddRefs(selStartNode), &selStartOffset);
|
||||||
if (NS_FAILED(result)) selStartNode = nsnull; // if selection is cleared, remember that
|
if (NS_FAILED(result)) selStartNode = nsnull; // if selection is cleared, remember that
|
||||||
result = GetEndNodeAndOffset(selection, address_of(selEndNode), &selEndOffset);
|
result = GetEndNodeAndOffset(selection, getter_AddRefs(selEndNode), &selEndOffset);
|
||||||
if (NS_FAILED(result)) selStartNode = nsnull; // if selection is cleared, remember that
|
if (NS_FAILED(result)) selStartNode = nsnull; // if selection is cleared, remember that
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> resultNode;
|
nsCOMPtr<nsIDOMNode> resultNode;
|
||||||
@ -2899,9 +2899,9 @@ nsEditor::JoinNodesImpl(nsIDOMNode * aNodeToKeep,
|
|||||||
// remember some selection points
|
// remember some selection points
|
||||||
nsCOMPtr<nsIDOMNode> selStartNode, selEndNode;
|
nsCOMPtr<nsIDOMNode> selStartNode, selEndNode;
|
||||||
PRInt32 selStartOffset, selEndOffset, joinOffset, keepOffset;
|
PRInt32 selStartOffset, selEndOffset, joinOffset, keepOffset;
|
||||||
result = GetStartNodeAndOffset(selection, address_of(selStartNode), &selStartOffset);
|
result = GetStartNodeAndOffset(selection, getter_AddRefs(selStartNode), &selStartOffset);
|
||||||
if (NS_FAILED(result)) selStartNode = nsnull;
|
if (NS_FAILED(result)) selStartNode = nsnull;
|
||||||
result = GetEndNodeAndOffset(selection, address_of(selEndNode), &selEndOffset);
|
result = GetEndNodeAndOffset(selection, getter_AddRefs(selEndNode), &selEndOffset);
|
||||||
// Joe or Kin should comment here on why the following line is not a copy/paste error
|
// Joe or Kin should comment here on why the following line is not a copy/paste error
|
||||||
if (NS_FAILED(result)) selStartNode = nsnull;
|
if (NS_FAILED(result)) selStartNode = nsnull;
|
||||||
|
|
||||||
@ -3886,12 +3886,14 @@ nsEditor::GetChildAt(nsIDOMNode *aParent, PRInt32 aOffset)
|
|||||||
// the first range in the selection.
|
// the first range in the selection.
|
||||||
nsresult
|
nsresult
|
||||||
nsEditor::GetStartNodeAndOffset(nsISelection *aSelection,
|
nsEditor::GetStartNodeAndOffset(nsISelection *aSelection,
|
||||||
nsCOMPtr<nsIDOMNode> *outStartNode,
|
nsIDOMNode **outStartNode,
|
||||||
PRInt32 *outStartOffset)
|
PRInt32 *outStartOffset)
|
||||||
{
|
{
|
||||||
if (!outStartNode || !outStartOffset || !aSelection)
|
if (!outStartNode || !outStartOffset || !aSelection)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
|
*outStartNode = nsnull;
|
||||||
|
|
||||||
// brade: set outStartNode to null or ?
|
// brade: set outStartNode to null or ?
|
||||||
|
|
||||||
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection));
|
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection));
|
||||||
@ -3909,7 +3911,7 @@ nsEditor::GetStartNodeAndOffset(nsISelection *aSelection,
|
|||||||
if (!range)
|
if (!range)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (NS_FAILED(range->GetStartContainer(getter_AddRefs(*outStartNode))))
|
if (NS_FAILED(range->GetStartContainer(outStartNode)))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (NS_FAILED(range->GetStartOffset(outStartOffset)))
|
if (NS_FAILED(range->GetStartOffset(outStartOffset)))
|
||||||
@ -3924,11 +3926,13 @@ nsEditor::GetStartNodeAndOffset(nsISelection *aSelection,
|
|||||||
// the first range in the selection.
|
// the first range in the selection.
|
||||||
nsresult
|
nsresult
|
||||||
nsEditor::GetEndNodeAndOffset(nsISelection *aSelection,
|
nsEditor::GetEndNodeAndOffset(nsISelection *aSelection,
|
||||||
nsCOMPtr<nsIDOMNode> *outEndNode,
|
nsIDOMNode **outEndNode,
|
||||||
PRInt32 *outEndOffset)
|
PRInt32 *outEndOffset)
|
||||||
{
|
{
|
||||||
if (!outEndNode || !outEndOffset)
|
if (!outEndNode || !outEndOffset)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
|
*outEndNode = nsnull;
|
||||||
|
|
||||||
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection));
|
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection));
|
||||||
nsCOMPtr<nsIEnumerator> enumerator;
|
nsCOMPtr<nsIEnumerator> enumerator;
|
||||||
@ -3945,7 +3949,7 @@ nsEditor::GetEndNodeAndOffset(nsISelection *aSelection,
|
|||||||
if (!range)
|
if (!range)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (NS_FAILED(range->GetEndContainer(getter_AddRefs(*outEndNode))))
|
if (NS_FAILED(range->GetEndContainer(outEndNode)))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (NS_FAILED(range->GetEndOffset(outEndOffset)))
|
if (NS_FAILED(range->GetEndOffset(outEndOffset)))
|
||||||
|
@ -535,8 +535,8 @@ public:
|
|||||||
static PRInt32 GetIndexOf(nsIDOMNode *aParent, nsIDOMNode *aChild);
|
static PRInt32 GetIndexOf(nsIDOMNode *aParent, nsIDOMNode *aChild);
|
||||||
static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, PRInt32 aOffset);
|
static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, PRInt32 aOffset);
|
||||||
|
|
||||||
static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsCOMPtr<nsIDOMNode> *outStartNode, PRInt32 *outStartOffset);
|
static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outStartNode, PRInt32 *outStartOffset);
|
||||||
static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsCOMPtr<nsIDOMNode> *outEndNode, PRInt32 *outEndOffset);
|
static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outEndNode, PRInt32 *outEndOffset);
|
||||||
#if DEBUG_JOE
|
#if DEBUG_JOE
|
||||||
static void DumpNode(nsIDOMNode *aNode, PRInt32 indent=0);
|
static void DumpNode(nsIDOMNode *aNode, PRInt32 indent=0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -78,7 +78,7 @@ nsresult TypeInState::UpdateSelState(nsISelection *aSelection)
|
|||||||
|
|
||||||
if (isCollapsed)
|
if (isCollapsed)
|
||||||
{
|
{
|
||||||
result = nsEditor::GetStartNodeAndOffset(aSelection, address_of(mLastSelectionContainer), &mLastSelectionOffset);
|
result = nsEditor::GetStartNodeAndOffset(aSelection, getter_AddRefs(mLastSelectionContainer), &mLastSelectionOffset);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ NS_IMETHODIMP TypeInState::NotifySelectionChanged(nsIDOMDocument *, nsISelection
|
|||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
PRInt32 selOffset = 0;
|
PRInt32 selOffset = 0;
|
||||||
|
|
||||||
result = nsEditor::GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
result = nsEditor::GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
|
|
||||||
if (NS_FAILED(result)) return result;
|
if (NS_FAILED(result)) return result;
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ nsHTMLEditor::InsertHTMLWithContext(const nsAString & aInputString,
|
|||||||
{
|
{
|
||||||
// if caller didn't provide the destination/target node,
|
// if caller didn't provide the destination/target node,
|
||||||
// fetch the paste insertion point from our selection
|
// fetch the paste insertion point from our selection
|
||||||
res = GetStartNodeAndOffset(selection, address_of(targetNode), &targetOffset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(targetNode), &targetOffset);
|
||||||
if (!targetNode) res = NS_ERROR_FAILURE;
|
if (!targetNode) res = NS_ERROR_FAILURE;
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ nsHTMLEditor::InsertHTMLWithContext(const nsAString & aInputString,
|
|||||||
{
|
{
|
||||||
// The rules code (WillDoAction above) might have changed the selection.
|
// The rules code (WillDoAction above) might have changed the selection.
|
||||||
// refresh our memory...
|
// refresh our memory...
|
||||||
res = GetStartNodeAndOffset(selection, address_of(parentNode), &offsetOfNewNode);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(parentNode), &offsetOfNewNode);
|
||||||
if (!parentNode) res = NS_ERROR_FAILURE;
|
if (!parentNode) res = NS_ERROR_FAILURE;
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
|
@ -334,13 +334,13 @@ nsHTMLEditRules::BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection)
|
|||||||
// get the selection start location
|
// get the selection start location
|
||||||
nsCOMPtr<nsIDOMNode> selStartNode, selEndNode;
|
nsCOMPtr<nsIDOMNode> selStartNode, selEndNode;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(selStartNode), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(selStartNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
mRangeItem.startNode = selStartNode;
|
mRangeItem.startNode = selStartNode;
|
||||||
mRangeItem.startOffset = selOffset;
|
mRangeItem.startOffset = selOffset;
|
||||||
|
|
||||||
// get the selection end location
|
// get the selection end location
|
||||||
res = mHTMLEditor->GetEndNodeAndOffset(selection, address_of(selEndNode), &selOffset);
|
res = mHTMLEditor->GetEndNodeAndOffset(selection, getter_AddRefs(selEndNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
mRangeItem.endNode = selEndNode;
|
mRangeItem.endNode = selEndNode;
|
||||||
mRangeItem.endOffset = selOffset;
|
mRangeItem.endOffset = selOffset;
|
||||||
@ -861,7 +861,7 @@ nsHTMLEditRules::GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
|
|||||||
PRInt32 offset, rootOffset;
|
PRInt32 offset, rootOffset;
|
||||||
res = nsEditor::GetNodeLocation(rootElem, address_of(parent), &rootOffset);
|
res = nsEditor::GetNodeLocation(rootElem, address_of(parent), &rootOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(parent), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
// is the selection collapsed?
|
// is the selection collapsed?
|
||||||
@ -1076,7 +1076,7 @@ nsHTMLEditRules::GetIndentState(PRBool *aCanIndent, PRBool *aCanOutdent)
|
|||||||
if (!selection) return NS_ERROR_NULL_POINTER;
|
if (!selection) return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
// test start parent hierarchy
|
// test start parent hierarchy
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(parent), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(parent), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
while (parent && (parent!=root))
|
while (parent && (parent!=root))
|
||||||
{
|
{
|
||||||
@ -1090,7 +1090,7 @@ nsHTMLEditRules::GetIndentState(PRBool *aCanIndent, PRBool *aCanOutdent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// test end parent hierarchy
|
// test end parent hierarchy
|
||||||
res = mHTMLEditor->GetEndNodeAndOffset(selection, address_of(parent), &selOffset);
|
res = mHTMLEditor->GetEndNodeAndOffset(selection, getter_AddRefs(parent), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
while (parent && (parent!=root))
|
while (parent && (parent!=root))
|
||||||
{
|
{
|
||||||
@ -1153,7 +1153,7 @@ nsHTMLEditRules::GetParagraphState(PRBool *aMixed, nsAString &outFormat)
|
|||||||
nsCOMPtr<nsISelection>selection;
|
nsCOMPtr<nsISelection>selection;
|
||||||
res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
|
res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!selNode) return NS_ERROR_NULL_POINTER;
|
if (!selNode) return NS_ERROR_NULL_POINTER;
|
||||||
arrayOfNodes.AppendObject(selNode);
|
arrayOfNodes.AppendObject(selNode);
|
||||||
@ -1298,7 +1298,7 @@ nsHTMLEditRules::WillInsert(nsISelection *aSelection, PRBool *aCancel)
|
|||||||
nsCOMPtr<nsIDOMNode> selNode, priorNode;
|
nsCOMPtr<nsIDOMNode> selNode, priorNode;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
// get the (collapsed) selection location
|
// get the (collapsed) selection location
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode),
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode),
|
||||||
&selOffset);
|
&selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
// get prior node
|
// get prior node
|
||||||
@ -1390,7 +1390,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
|||||||
*aCancel = PR_FALSE;
|
*aCancel = PR_FALSE;
|
||||||
|
|
||||||
// get the (collapsed) selection location
|
// get the (collapsed) selection location
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
// dont put text in places that can't have it
|
// dont put text in places that can't have it
|
||||||
@ -1612,7 +1612,7 @@ nsHTMLEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo
|
|||||||
nsCOMPtr<nsIDOMNode> node;
|
nsCOMPtr<nsIDOMNode> node;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
|
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(node), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!node) return NS_ERROR_FAILURE;
|
if (!node) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -1795,7 +1795,7 @@ nsHTMLEditRules::SplitMailCites(nsISelection *aSelection, PRBool aPlaintext, PRB
|
|||||||
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(aSelection));
|
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(aSelection));
|
||||||
nsCOMPtr<nsIDOMNode> citeNode, selNode, leftCite, rightCite;
|
nsCOMPtr<nsIDOMNode> citeNode, selNode, leftCite, rightCite;
|
||||||
PRInt32 selOffset, newOffset;
|
PRInt32 selOffset, newOffset;
|
||||||
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = GetTopEnclosingMailCite(selNode, address_of(citeNode), aPlaintext);
|
res = GetTopEnclosingMailCite(selNode, address_of(citeNode), aPlaintext);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
@ -1940,7 +1940,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!startNode) return NS_ERROR_FAILURE;
|
if (!startNode) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -1968,7 +1968,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// ExtendSelectionForDelete() may have changed the selection, update it
|
// ExtendSelectionForDelete() may have changed the selection, update it
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!startNode) return NS_ERROR_FAILURE;
|
if (!startNode) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -2346,12 +2346,12 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
|||||||
mDidRangedDelete = PR_TRUE;
|
mDidRangedDelete = PR_TRUE;
|
||||||
|
|
||||||
// refresh start and end points
|
// refresh start and end points
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!startNode) return NS_ERROR_FAILURE;
|
if (!startNode) return NS_ERROR_FAILURE;
|
||||||
nsCOMPtr<nsIDOMNode> endNode;
|
nsCOMPtr<nsIDOMNode> endNode;
|
||||||
PRInt32 endOffset;
|
PRInt32 endOffset;
|
||||||
res = mHTMLEditor->GetEndNodeAndOffset(aSelection, address_of(endNode), &endOffset);
|
res = mHTMLEditor->GetEndNodeAndOffset(aSelection, getter_AddRefs(endNode), &endOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!endNode) return NS_ERROR_FAILURE;
|
if (!endNode) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -2581,7 +2581,7 @@ nsHTMLEditRules::InsertBRIfNeeded(nsISelection *aSelection)
|
|||||||
// get selection
|
// get selection
|
||||||
nsCOMPtr<nsIDOMNode> node;
|
nsCOMPtr<nsIDOMNode> node;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, address_of(node), &offset);
|
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!node) return NS_ERROR_FAILURE;
|
if (!node) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -2984,7 +2984,7 @@ nsHTMLEditRules::DidDeleteSelection(nsISelection *aSelection,
|
|||||||
// find where we are
|
// find where we are
|
||||||
nsCOMPtr<nsIDOMNode> startNode;
|
nsCOMPtr<nsIDOMNode> startNode;
|
||||||
PRInt32 startOffset;
|
PRInt32 startOffset;
|
||||||
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset);
|
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!startNode) return NS_ERROR_FAILURE;
|
if (!startNode) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -3093,7 +3093,7 @@ nsHTMLEditRules::WillMakeList(nsISelection *aSelection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get selection location
|
// get selection location
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
// make sure we can put a list here
|
// make sure we can put a list here
|
||||||
@ -3460,7 +3460,7 @@ nsHTMLEditRules::WillMakeBasicBlock(nsISelection *aSelection,
|
|||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
|
|
||||||
// get selection location
|
// get selection location
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (tString.EqualsLiteral("normal") ||
|
if (tString.EqualsLiteral("normal") ||
|
||||||
tString.IsEmpty() ) // we are removing blocks (going to "body text")
|
tString.IsEmpty() ) // we are removing blocks (going to "body text")
|
||||||
@ -3562,7 +3562,7 @@ nsHTMLEditRules::DidMakeBasicBlock(nsISelection *aSelection,
|
|||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> parent;
|
nsCOMPtr<nsIDOMNode> parent;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
res = nsEditor::GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
res = nsEditor::GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = InsertMozBRIfNeeded(parent);
|
res = InsertMozBRIfNeeded(parent);
|
||||||
return res;
|
return res;
|
||||||
@ -3614,7 +3614,7 @@ nsHTMLEditRules::WillCSSIndent(nsISelection *aSelection, PRBool *aCancel, PRBool
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> node, block;
|
nsCOMPtr<nsIDOMNode> node, block;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(node), &offset);
|
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (IsBlockNode(node))
|
if (IsBlockNode(node))
|
||||||
block = node;
|
block = node;
|
||||||
@ -3646,7 +3646,7 @@ nsHTMLEditRules::WillCSSIndent(nsISelection *aSelection, PRBool *aCancel, PRBool
|
|||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsAutoString quoteType(NS_LITERAL_STRING("div"));
|
nsAutoString quoteType(NS_LITERAL_STRING("div"));
|
||||||
// get selection location
|
// get selection location
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
// make sure we can put a block here
|
// make sure we can put a block here
|
||||||
res = SplitAsNeeded("eType, address_of(parent), &offset);
|
res = SplitAsNeeded("eType, address_of(parent), &offset);
|
||||||
@ -3829,7 +3829,7 @@ nsHTMLEditRules::WillHTMLIndent(nsISelection *aSelection, PRBool *aCancel, PRBoo
|
|||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
|
|
||||||
// get selection location
|
// get selection location
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
// make sure we can put a block here
|
// make sure we can put a block here
|
||||||
res = SplitAsNeeded("eType, address_of(parent), &offset);
|
res = SplitAsNeeded("eType, address_of(parent), &offset);
|
||||||
@ -4247,7 +4247,7 @@ nsHTMLEditRules::WillOutdent(nsISelection *aSelection, PRBool *aCancel, PRBool *
|
|||||||
// push selection past end of rememberedLeftBQ
|
// push selection past end of rememberedLeftBQ
|
||||||
nsCOMPtr<nsIDOMNode> sNode;
|
nsCOMPtr<nsIDOMNode> sNode;
|
||||||
PRInt32 sOffset;
|
PRInt32 sOffset;
|
||||||
mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(sNode), &sOffset);
|
mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(sNode), &sOffset);
|
||||||
if (rememberedLeftBQ &&
|
if (rememberedLeftBQ &&
|
||||||
((sNode == rememberedLeftBQ) || nsEditorUtils::IsDescendantOf(sNode, rememberedLeftBQ)))
|
((sNode == rememberedLeftBQ) || nsEditorUtils::IsDescendantOf(sNode, rememberedLeftBQ)))
|
||||||
{
|
{
|
||||||
@ -4257,7 +4257,7 @@ nsHTMLEditRules::WillOutdent(nsISelection *aSelection, PRBool *aCancel, PRBool *
|
|||||||
aSelection->Collapse(sNode, sOffset);
|
aSelection->Collapse(sNode, sOffset);
|
||||||
}
|
}
|
||||||
// and pull selection before beginning of rememberedRightBQ
|
// and pull selection before beginning of rememberedRightBQ
|
||||||
mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(sNode), &sOffset);
|
mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(sNode), &sOffset);
|
||||||
if (rememberedRightBQ &&
|
if (rememberedRightBQ &&
|
||||||
((sNode == rememberedRightBQ) || nsEditorUtils::IsDescendantOf(sNode, rememberedRightBQ)))
|
((sNode == rememberedRightBQ) || nsEditorUtils::IsDescendantOf(sNode, rememberedRightBQ)))
|
||||||
{
|
{
|
||||||
@ -4419,7 +4419,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsISelection *aSelection, nsIDOMDocume
|
|||||||
PRBool weDidSometing = PR_FALSE;
|
PRBool weDidSometing = PR_FALSE;
|
||||||
nsCOMPtr<nsIDOMNode> node, tmp;
|
nsCOMPtr<nsIDOMNode> node, tmp;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(node), &offset);
|
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
nsAutoPtr<PropItem> item;
|
nsAutoPtr<PropItem> item;
|
||||||
|
|
||||||
@ -4690,7 +4690,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection,
|
|||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> parent;
|
nsCOMPtr<nsIDOMNode> parent;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset);
|
||||||
|
|
||||||
if (!nsHTMLEditUtils::IsTableElement(parent) || nsHTMLEditUtils::IsTableCellOrCaption(parent))
|
if (!nsHTMLEditUtils::IsTableElement(parent) || nsHTMLEditUtils::IsTableCellOrCaption(parent))
|
||||||
emptyDiv = PR_TRUE;
|
emptyDiv = PR_TRUE;
|
||||||
@ -4701,7 +4701,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection,
|
|||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsCOMPtr<nsIDOMNode> brNode, parent, theDiv, sib;
|
nsCOMPtr<nsIDOMNode> brNode, parent, theDiv, sib;
|
||||||
NS_NAMED_LITERAL_STRING(divType, "div");
|
NS_NAMED_LITERAL_STRING(divType, "div");
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = SplitAsNeeded(&divType, address_of(parent), &offset);
|
res = SplitAsNeeded(&divType, address_of(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
@ -7432,7 +7432,7 @@ nsHTMLEditRules::ReapplyCachedStyles()
|
|||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
res = NS_OK;
|
res = NS_OK;
|
||||||
@ -7523,7 +7523,7 @@ nsHTMLEditRules::AdjustWhitespace(nsISelection *aSelection)
|
|||||||
// get selection point
|
// get selection point
|
||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
// ask whitespace object to tweak nbsp's
|
// ask whitespace object to tweak nbsp's
|
||||||
@ -7542,7 +7542,7 @@ nsHTMLEditRules::PinSelectionToNewBlock(nsISelection *aSelection)
|
|||||||
// get the (collapsed) selection location
|
// get the (collapsed) selection location
|
||||||
nsCOMPtr<nsIDOMNode> selNode, temp;
|
nsCOMPtr<nsIDOMNode> selNode, temp;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
temp = selNode;
|
temp = selNode;
|
||||||
|
|
||||||
@ -7614,7 +7614,7 @@ nsHTMLEditRules::CheckInterlinePosition(nsISelection *aSelection)
|
|||||||
// get the (collapsed) selection location
|
// get the (collapsed) selection location
|
||||||
nsCOMPtr<nsIDOMNode> selNode, node;
|
nsCOMPtr<nsIDOMNode> selNode, node;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
// are we after a block? If so try set caret to following content
|
// are we after a block? If so try set caret to following content
|
||||||
@ -7658,7 +7658,7 @@ nsHTMLEditRules::AdjustSelection(nsISelection *aSelection, nsIEditor::EDirection
|
|||||||
// get the (collapsed) selection location
|
// get the (collapsed) selection location
|
||||||
nsCOMPtr<nsIDOMNode> selNode, temp;
|
nsCOMPtr<nsIDOMNode> selNode, temp;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
temp = selNode;
|
temp = selNode;
|
||||||
|
|
||||||
@ -8278,7 +8278,7 @@ nsHTMLEditRules::ConfirmSelectionInBody()
|
|||||||
// get the selection start location
|
// get the selection start location
|
||||||
nsCOMPtr<nsIDOMNode> selNode, temp, parent;
|
nsCOMPtr<nsIDOMNode> selNode, temp, parent;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
temp = selNode;
|
temp = selNode;
|
||||||
|
|
||||||
@ -8298,7 +8298,7 @@ nsHTMLEditRules::ConfirmSelectionInBody()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the selection end location
|
// get the selection end location
|
||||||
res = mHTMLEditor->GetEndNodeAndOffset(selection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetEndNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
temp = selNode;
|
temp = selNode;
|
||||||
|
|
||||||
@ -8591,11 +8591,11 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection)
|
|||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
|
|
||||||
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = mUtilRange->SetStart(selNode, selOffset);
|
res = mUtilRange->SetStart(selNode, selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = mHTMLEditor->GetEndNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
res = mHTMLEditor->GetEndNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = mUtilRange->SetEnd(selNode, selOffset);
|
res = mUtilRange->SetEnd(selNode, selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
@ -8975,7 +8975,7 @@ nsHTMLEditRules::WillAbsolutePosition(nsISelection *aSelection, PRBool *aCancel,
|
|||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
|
|
||||||
// get selection location
|
// get selection location
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
// make sure we can put a block here
|
// make sure we can put a block here
|
||||||
res = SplitAsNeeded(&divType, address_of(parent), &offset);
|
res = SplitAsNeeded(&divType, address_of(parent), &offset);
|
||||||
|
@ -581,7 +581,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsCOMPtr<nsIDOMNode> node, blockParent;
|
nsCOMPtr<nsIDOMNode> node, blockParent;
|
||||||
rv = GetStartNodeAndOffset(selection, address_of(node), &offset);
|
rv = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
@ -1546,7 +1546,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode)
|
|||||||
}
|
}
|
||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = GetStartNodeAndOffset(selection, address_of(selNode), &selOffset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
res = CreateBR(selNode, selOffset, outBRNode);
|
res = CreateBR(selNode, selOffset, outBRNode);
|
||||||
@ -2233,7 +2233,7 @@ nsHTMLEditor::GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor, P
|
|||||||
// get selection location
|
// get selection location
|
||||||
nsCOMPtr<nsIDOMNode> parent;
|
nsCOMPtr<nsIDOMNode> parent;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
res = GetStartNodeAndOffset(selection, address_of(parent), &offset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(parent), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!parent) return NS_ERROR_NULL_POINTER;
|
if (!parent) return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
@ -2458,7 +2458,7 @@ nsHTMLEditor::MakeOrChangeList(const nsAString& aListType, PRBool entireList, co
|
|||||||
nsCOMPtr<nsIDOMNode> node;
|
nsCOMPtr<nsIDOMNode> node;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
|
|
||||||
res = GetStartNodeAndOffset(selection, address_of(node), &offset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset);
|
||||||
if (!node) res = NS_ERROR_FAILURE;
|
if (!node) res = NS_ERROR_FAILURE;
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
@ -2602,7 +2602,7 @@ nsHTMLEditor::InsertBasicBlock(const nsAString& aBlockType)
|
|||||||
nsCOMPtr<nsIDOMNode> node;
|
nsCOMPtr<nsIDOMNode> node;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
|
|
||||||
res = GetStartNodeAndOffset(selection, address_of(node), &offset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset);
|
||||||
if (!node) res = NS_ERROR_FAILURE;
|
if (!node) res = NS_ERROR_FAILURE;
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
@ -2682,7 +2682,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent)
|
|||||||
res = selection->GetIsCollapsed(&isCollapsed);
|
res = selection->GetIsCollapsed(&isCollapsed);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
res = GetStartNodeAndOffset(selection, address_of(node), &offset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset);
|
||||||
if (!node) res = NS_ERROR_FAILURE;
|
if (!node) res = NS_ERROR_FAILURE;
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
@ -2720,7 +2720,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent)
|
|||||||
res = InsertText(NS_LITERAL_STRING(" "));
|
res = InsertText(NS_LITERAL_STRING(" "));
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
// reposition selection to before the space character
|
// reposition selection to before the space character
|
||||||
res = GetStartNodeAndOffset(selection, address_of(node), &offset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
res = selection->Collapse(node,0);
|
res = selection->Collapse(node,0);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
@ -1486,7 +1486,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
|
|||||||
// Let's see in what kind of element the selection is
|
// Let's see in what kind of element the selection is
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
nsCOMPtr<nsIDOMNode> selectedNode;
|
nsCOMPtr<nsIDOMNode> selectedNode;
|
||||||
res = GetStartNodeAndOffset(selection, address_of(selectedNode), &offset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(selectedNode), &offset);
|
||||||
if (IsTextNode(selectedNode)) {
|
if (IsTextNode(selectedNode)) {
|
||||||
nsCOMPtr<nsIDOMNode> parent;
|
nsCOMPtr<nsIDOMNode> parent;
|
||||||
res = selectedNode->GetParentNode(getter_AddRefs(parent));
|
res = selectedNode->GetParentNode(getter_AddRefs(parent));
|
||||||
|
@ -564,7 +564,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode)
|
|||||||
}
|
}
|
||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = GetStartNodeAndOffset(selection, address_of(selNode), &selOffset);
|
res = GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
res = CreateBR(selNode, selOffset, outBRNode);
|
res = CreateBR(selNode, selOffset, outBRNode);
|
||||||
@ -702,7 +702,7 @@ nsPlaintextEditor::ExtendSelectionForDelete(nsISelection *aSelection,
|
|||||||
// typed character.
|
// typed character.
|
||||||
nsCOMPtr<nsIDOMNode> node;
|
nsCOMPtr<nsIDOMNode> node;
|
||||||
PRInt32 offset;
|
PRInt32 offset;
|
||||||
result = GetStartNodeAndOffset(aSelection, address_of(node), &offset);
|
result = GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ nsTextEditRules::DidInsertBreak(nsISelection *aSelection, nsresult aResult)
|
|||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
nsresult res;
|
nsresult res;
|
||||||
res = mEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
// confirm we are at end of document
|
// confirm we are at end of document
|
||||||
if (selOffset == 0) return NS_OK; // can't be after a br if we are at offset 0
|
if (selOffset == 0) return NS_OK; // can't be after a br if we are at offset 0
|
||||||
@ -513,7 +513,7 @@ static inline already_AddRefed<nsIDOMNode>
|
|||||||
GetTextNode(nsISelection *selection, nsEditor *editor) {
|
GetTextNode(nsISelection *selection, nsEditor *editor) {
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
nsresult res = editor->GetStartNodeAndOffset(selection, address_of(selNode), &selOffset);
|
nsresult res = editor->GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return nsnull;
|
if (NS_FAILED(res)) return nsnull;
|
||||||
if (!editor->IsTextNode(selNode)) {
|
if (!editor->IsTextNode(selNode)) {
|
||||||
// Get an nsINode from the nsIDOMNode
|
// Get an nsINode from the nsIDOMNode
|
||||||
@ -731,7 +731,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
|||||||
// get the (collapsed) selection location
|
// get the (collapsed) selection location
|
||||||
nsCOMPtr<nsIDOMNode> selNode;
|
nsCOMPtr<nsIDOMNode> selNode;
|
||||||
PRInt32 selOffset;
|
PRInt32 selOffset;
|
||||||
res = mEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset);
|
res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
|
|
||||||
// don't put text in places that can't have it
|
// don't put text in places that can't have it
|
||||||
@ -1005,7 +1005,7 @@ nsTextEditRules::WillDeleteSelection(nsISelection *aSelection,
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> startNode;
|
nsCOMPtr<nsIDOMNode> startNode;
|
||||||
PRInt32 startOffset;
|
PRInt32 startOffset;
|
||||||
res = mEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset);
|
res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!startNode) return NS_ERROR_FAILURE;
|
if (!startNode) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -1039,7 +1039,7 @@ nsTextEditRules::DidDeleteSelection(nsISelection *aSelection,
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> startNode;
|
nsCOMPtr<nsIDOMNode> startNode;
|
||||||
PRInt32 startOffset;
|
PRInt32 startOffset;
|
||||||
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset);
|
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!startNode) return NS_ERROR_FAILURE;
|
if (!startNode) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user