Bug 535041 Crash [@ nsContentUtils::IsInSameAnonymousTree] r=Olli

This commit is contained in:
Masayuki Nakano
2009-12-17 13:46:30 +09:00
parent d142a8b64a
commit 500ef9c12b
5 changed files with 96 additions and 11 deletions

View File

@@ -414,6 +414,7 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
if (!doc || doc->HasFlag(NODE_IS_EDITABLE) ||
!HasFlag(NODE_IS_EDITABLE)) {
nsIContent* editorRoot = GetEditorRootContent(editor);
NS_ENSURE_TRUE(editorRoot, nsnull);
return nsContentUtils::IsInSameAnonymousTree(this, editorRoot) ?
editorRoot :
GetRootForContentSubtree(static_cast<nsIContent*>(this));
@@ -445,6 +446,7 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
// This node might be in another subtree, if so, we should find this subtree's
// root. Otherwise, we can return the content simply.
NS_ENSURE_TRUE(content, nsnull);
return nsContentUtils::IsInSameAnonymousTree(this, content) ?
content : GetRootForContentSubtree(static_cast<nsIContent*>(this));
}