mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 722419 - Part a: Introduce another version of GetNextNode; r=ehsan
This commit is contained in:
parent
73cd8e7960
commit
a06e96e533
@ -3320,30 +3320,43 @@ nsEditor::FindNextLeafNode(nsINode *aCurrentNode,
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsEditor::GetNextNode(nsIDOMNode *aCurrentNode,
|
||||
bool aEditableNode,
|
||||
nsresult
|
||||
nsEditor::GetNextNode(nsIDOMNode* aCurrentNode,
|
||||
bool aEditableNode,
|
||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
||||
bool bNoBlockCrossing,
|
||||
nsIContent *aActiveEditorRoot)
|
||||
bool bNoBlockCrossing,
|
||||
nsIContent* aActiveEditorRoot)
|
||||
{
|
||||
if (!aCurrentNode || !aResultNode) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
nsCOMPtr<nsINode> currentNode = do_QueryInterface(aCurrentNode);
|
||||
if (!IsDescendantOfBody(currentNode) ||
|
||||
(aActiveEditorRoot &&
|
||||
!nsContentUtils::ContentIsDescendantOf(currentNode,
|
||||
aActiveEditorRoot))) {
|
||||
*aResultNode = nsnull;
|
||||
return NS_OK;
|
||||
if (!currentNode || !aResultNode) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResultNode =
|
||||
do_QueryInterface(FindNode(currentNode, true, aEditableNode,
|
||||
bNoBlockCrossing, aActiveEditorRoot));
|
||||
*aResultNode = do_QueryInterface(GetNextNode(currentNode, aEditableNode,
|
||||
bNoBlockCrossing,
|
||||
aActiveEditorRoot));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsEditor::GetNextNode(nsINode* aCurrentNode,
|
||||
bool aEditableNode,
|
||||
bool bNoBlockCrossing,
|
||||
nsIContent* aActiveEditorRoot)
|
||||
{
|
||||
MOZ_ASSERT(aCurrentNode);
|
||||
|
||||
if (!IsDescendantOfBody(aCurrentNode) ||
|
||||
(aActiveEditorRoot &&
|
||||
!nsContentUtils::ContentIsDescendantOf(aCurrentNode,
|
||||
aActiveEditorRoot))) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return FindNode(aCurrentNode, true, aEditableNode, bNoBlockCrossing,
|
||||
aActiveEditorRoot);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsEditor::FindNode(nsINode *aCurrentNode,
|
||||
bool aGoForward,
|
||||
|
@ -505,6 +505,10 @@ public:
|
||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
||||
bool bNoBlockCrossing = false,
|
||||
nsIContent *aActiveEditorRoot = nsnull);
|
||||
nsIContent* GetNextNode(nsINode* aCurrentNode,
|
||||
bool aEditableNode,
|
||||
bool bNoBlockCrossing = false,
|
||||
nsIContent* aActiveEditorRoot = nsnull);
|
||||
|
||||
// and another version that takes a {parent,offset} pair rather than a node
|
||||
nsresult GetNextNode(nsIDOMNode *aParentNode,
|
||||
|
Loading…
Reference in New Issue
Block a user