Bug 554635, change default tabindex on object elements to 0, so that child documents can be focused, r=jonas

This commit is contained in:
Neil Deakin 2010-04-29 10:14:05 -04:00
Родитель 6444a901bf
Коммит 252de127d4
3 изменённых файлов: 52 добавлений и 1 удалений

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

@ -360,7 +360,7 @@ NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Height, height)
NS_IMPL_INT_ATTR(nsHTMLObjectElement, Hspace, hspace)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Name, name)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Standby, standby)
NS_IMPL_INT_ATTR(nsHTMLObjectElement, TabIndex, tabindex)
NS_IMPL_INT_ATTR_DEFAULT_VALUE(nsHTMLObjectElement, TabIndex, tabindex, 0)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Type, type)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, UseMap, usemap)
NS_IMPL_INT_ATTR(nsHTMLObjectElement, Vspace, vspace)

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

@ -158,6 +158,7 @@ _TEST_FILES = test_bug589.html \
test_bug536891.html \
test_bug536895.html \
test_bug458037.xhtml \
test_bug556645.html \
test_bug559284.html \
test_bug551670.html \
test_bug346485.html \

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

@ -0,0 +1,50 @@
<html>
<head>
<title>Test for Bug 556645</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="runTest()">
<script>
SimpleTest.waitForExplicitFinish();
function runTest()
{
var obj = document.getElementById("obj");
var childDoc = obj.contentDocument;
var body = childDoc.body;
is(document.activeElement, document.body, "focus in parent before");
is(childDoc.activeElement, body, "focus in child before");
var button = childDoc.getElementsByTagName("button")[0];
button.focus();
childDoc.defaultView.focus();
is(document.activeElement, obj, "focus in parent after focus()");
is(childDoc.activeElement, button, "focus in child after focus()");
button.blur();
var pbutton = document.getElementById("pbutton");
pbutton.focus();
synthesizeKey("VK_TAB", { });
is(document.activeElement, obj, "focus in parent after tab");
is(childDoc.activeElement, childDoc.documentElement, "focus in child after tab");
synthesizeKey("VK_TAB", { });
is(document.activeElement, obj, "focus in parent after tab 2");
is(childDoc.activeElement, button, "focus in child after tab 2");
SimpleTest.finish();
}
</script>
<button id="pbutton">Parent</button>
<object id="obj" type="text/html"
data="data:text/html,%3Cbody%3E%3Cbutton%3EChild%3C/button%3E%3C/body%3E"
width="200" height="200"></object>
</body>
</html>