Bug 93077 - Support #top in standards mode; r=bz

This commit is contained in:
Ms2ger 2011-10-01 18:14:40 +02:00
Родитель 22870805f0
Коммит 1c8b625f5d
8 изменённых файлов: 215 добавлений и 6 удалений

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

@ -3146,12 +3146,11 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll)
}
}
} else {
rv = NS_ERROR_FAILURE; //changed to NS_OK in quirks mode if ScrollTo is called
// Scroll to the top/left if the anchor can not be
// found and it is labelled top (quirks mode only). @see bug 80784
if ((NS_LossyConvertUTF16toASCII(aAnchorName).LowerCaseEqualsLiteral("top")) &&
(mPresContext->CompatibilityMode() == eCompatibility_NavQuirks)) {
rv = NS_ERROR_FAILURE;
NS_NAMED_LITERAL_STRING(top, "top");
if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) {
// Scroll to the top/left if aAnchorName is "top" and there is no element
// with such a name or id.
rv = NS_OK;
nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable();
// Check |aScroll| after setting |rv| so we set |rv| to the same

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

@ -68,6 +68,12 @@ _TEST_FILES = \
test_after_paint_pref.html \
test_border_radius_hit_testing.html \
test_bug66619.html \
test_bug93077-1.html \
test_bug93077-2.html \
test_bug93077-3.html \
test_bug93077-4.html \
test_bug93077-5.html \
test_bug93077-6.html \
test_bug114649.html \
$(warning test_bug369950.html disabled due to random orange; see bug 492575) \
test_bug386575.xhtml \

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

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,32 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p id=top>Top</p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#top"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,35 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p><a name=top>Top</a></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#top"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p id=TOP>Top</p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#TOP"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,35 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p><a name=TOP>Top</a></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#TOP"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>