Bug 289384 - Part 3: SelectAll in HTML editor shouldn't attempt to select input/textareas' contents directly; r=roc

This commit is contained in:
Ehsan Akhgari 2010-07-12 00:20:20 -04:00
Родитель 4f7cbe2bd4
Коммит a68bc2f8bf
4 изменённых файлов: 48 добавлений и 0 удалений

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

@ -4196,6 +4196,17 @@ nsHTMLEditor::SelectAll()
nsCOMPtr<nsIContent> anchorContent = do_QueryInterface(anchorNode, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// If the anchor content has independent selection, we never need to explicitly
// select its children.
nsIFrame* frame = anchorContent->GetPrimaryFrame();
if (frame && frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION) {
nsCOMPtr<nsISelectionPrivate> selPriv = do_QueryInterface(selection);
NS_ENSURE_TRUE(selPriv, NS_ERROR_UNEXPECTED);
rv = selPriv->SetAncestorLimiter(nsnull);
NS_ENSURE_SUCCESS(rv, rv);
return selection->SelectAllChildren(mRootElement);
}
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
nsIContent *rootContent = anchorContent->GetSelectionRootContent(ps);

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

@ -0,0 +1,18 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<![CDATA[
function boom()
{
document.body.setAttribute("contenteditable", "true");
document.execCommand("selectAll", false, null);
}
]]>
</script>
</head>
<body onload="boom();"><textarea><span/></textarea></body>
</html>

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

@ -0,0 +1,18 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<![CDATA[
function boom()
{
document.body.setAttribute("contenteditable", "true");
document.execCommand("selectAll", false, null);
}
]]>
</script>
</head>
<body onload="boom();"><textarea></textarea></body>
</html>

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

@ -263,6 +263,7 @@ random == 99850-1b.html 99850-1-ref.html # bug 471629
== 283686-1.html about:blank
== 283686-2.html 283686-2-ref.html
== 283686-3.html about:blank
== 289384-1.xhtml 289384-ref.xhtml
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP == 289480.html#top 289480-ref.html # basically-verbatim acid2 test, HTTP for a 404 page -- bug 409329 for the non-Mac failures
asserts(1) == 290129-1.html 290129-1-ref.html # bug 315549/460637
== 291078-1.html 291078-1-ref.html