mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 813532 - Part b: Some cleanup for GetNextHTMLNode; r=ehsan
This commit is contained in:
parent
8112360d29
commit
ec7a3c7d9b
@ -4125,23 +4125,37 @@ nsHTMLEditor::GetPriorHTMLNode(nsIDOMNode* aNode, int32_t aOffset,
|
||||
// GetNextHTMLNode: returns the next editable leaf node, if there is
|
||||
// one within the <body>
|
||||
//
|
||||
nsresult
|
||||
nsHTMLEditor::GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing)
|
||||
nsIContent*
|
||||
nsHTMLEditor::GetNextHTMLNode(nsINode* aNode, bool aNoBlockCrossing)
|
||||
{
|
||||
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
||||
nsresult res = GetNextNode(inNode, true, address_of(*outNode), bNoBlockCrossing);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
// if it's not in the body, then zero it out
|
||||
if (*outNode && !IsDescendantOfEditorRoot(*outNode)) {
|
||||
*outNode = nullptr;
|
||||
MOZ_ASSERT(aNode);
|
||||
|
||||
nsIContent* result = GetNextNode(aNode, true, aNoBlockCrossing);
|
||||
|
||||
if (result && !IsDescendantOfEditorRoot(result)) {
|
||||
return nullptr;
|
||||
}
|
||||
return res;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::GetNextHTMLNode(nsIDOMNode* aNode,
|
||||
nsCOMPtr<nsIDOMNode>* aResultNode,
|
||||
bool aNoBlockCrossing)
|
||||
{
|
||||
NS_ENSURE_TRUE(aResultNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
|
||||
*aResultNode = do_QueryInterface(GetNextHTMLNode(node, aNoBlockCrossing));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GetNHTMLextNode: same as above but takes {parent,offset} instead of node
|
||||
// GetNextHTMLNode: same as above but takes {parent,offset} instead of node
|
||||
//
|
||||
nsIContent*
|
||||
nsHTMLEditor::GetNextHTMLNode(nsINode* aParent, int32_t aOffset,
|
||||
@ -4155,17 +4169,18 @@ nsHTMLEditor::GetNextHTMLNode(nsINode* aParent, int32_t aOffset,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::GetNextHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing)
|
||||
nsHTMLEditor::GetNextHTMLNode(nsIDOMNode* aNode, int32_t aOffset,
|
||||
nsCOMPtr<nsIDOMNode>* aResultNode,
|
||||
bool aNoBlockCrossing)
|
||||
{
|
||||
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
||||
nsresult res = GetNextNode(inParent, inOffset, true, address_of(*outNode), bNoBlockCrossing);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
// if it's not in the body, then zero it out
|
||||
if (*outNode && !IsDescendantOfEditorRoot(*outNode)) {
|
||||
*outNode = nullptr;
|
||||
}
|
||||
return res;
|
||||
NS_ENSURE_TRUE(aResultNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
|
||||
*aResultNode = do_QueryInterface(GetNextHTMLNode(node, aOffset,
|
||||
aNoBlockCrossing));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -693,6 +693,7 @@ protected:
|
||||
bool aNoBlockCrossing = false);
|
||||
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
||||
|
||||
nsIContent* GetNextHTMLNode(nsINode* aNode, bool aNoBlockCrossing = false);
|
||||
nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
||||
nsIContent* GetNextHTMLNode(nsINode* aParent, int32_t aOffset,
|
||||
bool aNoBlockCrossing = false);
|
||||
|
Loading…
Reference in New Issue
Block a user