Bug 766795 - Fix asserts when placing cursor in editable detached content; r=roc,ehsan

This commit is contained in:
Aryeh Gregor 2012-06-24 09:54:43 +03:00
Родитель 17b1cc73b7
Коммит e39ea69f36
4 изменённых файлов: 31 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,21 @@
<html>
<head>
<script>
function boom()
{
var fragEl = document.createElement("span");
fragEl.setAttribute("contenteditable", "true");
fragEl.setAttribute("style", "position: absolute;");
var frag = document.createDocumentFragment();
frag.appendChild(fragEl);
window.getSelection().selectAllChildren(fragEl);
}
</script>
</head>
<body contenteditable="true" onload="boom();"></body>
</html>

Просмотреть файл

@ -28,5 +28,6 @@ load 682650-1.html
load 716456-1.html load 716456-1.html
load 759748.html load 759748.html
load 761861.html load 761861.html
load 766795.html
load 766305.html load 766305.html
load 766387.html load 766387.html

Просмотреть файл

@ -254,6 +254,13 @@ nsHTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection * aSelection)
NS_ENSURE_TRUE(focusElement, NS_OK); NS_ENSURE_TRUE(focusElement, NS_OK);
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
// If we're not in a document, don't try to add resizers
nsCOMPtr<dom::Element> focusElementNode = do_QueryInterface(focusElement);
NS_ENSURE_STATE(focusElementNode);
if (!focusElementNode->IsInDoc()) {
return NS_OK;
}
// what's its tag? // what's its tag?
nsAutoString focusTagName; nsAutoString focusTagName;
res = focusElement->GetTagName(focusTagName); res = focusElement->GetTagName(focusTagName);

Просмотреть файл

@ -4080,9 +4080,10 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
oldNextSibling = nsnull; oldNextSibling = nsnull;
} }
if (aContainer) if (aContainer && aContainer->IsElement()) {
mFrameConstructor->RestyleForRemove(aContainer->AsElement(), aChild, mFrameConstructor->RestyleForRemove(aContainer->AsElement(), aChild,
oldNextSibling); oldNextSibling);
}
bool didReconstruct; bool didReconstruct;
mFrameConstructor->ContentRemoved(aContainer, aChild, oldNextSibling, mFrameConstructor->ContentRemoved(aContainer, aChild, oldNextSibling,