Bug 611182 - Part 6: Actually allow the bogus node to be deleted from the document, and check if the parent is modifiable when inserting an element to prevent a bogus node being inserted under a contenteditable="false" element; r=bzbarsky a=blocking-beta8+

This fixes a failure in layout/reftests/bugs/579985-1.html, and is tested by it.
This commit is contained in:
Ehsan Akhgari 2010-11-12 10:38:14 -05:00
parent 2bd53975b3
commit 9cd1d8318f
2 changed files with 3 additions and 2 deletions

View File

@ -3794,7 +3794,7 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
NS_IMETHODIMP nsHTMLEditor::DeleteNode(nsIDOMNode * aNode)
{
// do nothing if the node is read-only
if (!IsModifiableNode(aNode)) {
if (!IsModifiableNode(aNode) && !IsMozEditorBogusNode(aNode)) {
return NS_ERROR_FAILURE;
}

View File

@ -1136,7 +1136,8 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsISelection *aSelection)
bodyChild->GetNextSibling(getter_AddRefs(temp));
bodyChild = do_QueryInterface(temp);
}
if (needsBogusContent)
// Skip adding the bogus node if body is read-only
if (needsBogusContent && mEditor->IsModifiableNode(body))
{
// create a br
nsCOMPtr<nsIContent> newContent;