2008-01-07 05:37:24 -08:00
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=332246
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 332246 - scrollIntoView(false) doesn't work correctly for inline elements that wrap at multiple lines</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332246">Mozilla Bug 332246</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content">
|
|
|
|
|
2010-01-11 13:45:00 -08:00
|
|
|
<div id="a1" style="height: 100px; width: 100px; overflow: hidden; outline:1px dotted black;">
|
2008-01-07 05:37:24 -08:00
|
|
|
<div style="height: 100px"></div>
|
2010-01-11 13:45:00 -08:00
|
|
|
<a id="a2" href="#" style="display:block; background:yellow; height:200px;">Top</a>
|
2008-01-07 05:37:24 -08:00
|
|
|
<div style="height: 100px"></div>
|
|
|
|
</div>
|
|
|
|
|
2010-01-11 13:45:00 -08:00
|
|
|
<div id="b1" style="height: 100px; width: 100px; overflow: hidden; outline:1px dotted black;">
|
2008-01-07 05:37:24 -08:00
|
|
|
<div style="height: 100px"></div>
|
2010-01-11 13:45:00 -08:00
|
|
|
<div id="b2" href="#" style="border:10px solid black; background:yellow; height:200px;"></div>
|
2008-01-07 05:37:24 -08:00
|
|
|
<div style="height: 100px"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
2010-01-11 13:45:00 -08:00
|
|
|
<div id="c1" style="height: 100px; width: 100px; overflow: hidden; position: relative; outline:1px dotted black;">
|
2008-01-07 05:37:24 -08:00
|
|
|
<div id="c2" style="border: 10px solid black; height: 200px; width: 50px; position: absolute; top: 100px;"></div>
|
|
|
|
<div style="height: 100px"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 332246 **/
|
|
|
|
|
|
|
|
var a1 = document.getElementById('a1');
|
|
|
|
var a2 = document.getElementById('a2');
|
2010-01-11 13:45:00 -08:00
|
|
|
is(a1.scrollHeight, 400, "Wrong a1.scrollHeight");
|
|
|
|
is(a1.offsetHeight, 100, "Wrong a1.offsetHeight");
|
2008-01-07 05:37:24 -08:00
|
|
|
a2.scrollIntoView(true);
|
2010-01-11 13:45:00 -08:00
|
|
|
is(a1.scrollTop, 100, "Wrong scrollTop value after a2.scrollIntoView(true)");
|
2008-01-07 05:37:24 -08:00
|
|
|
a2.scrollIntoView(false);
|
2010-01-11 13:45:00 -08:00
|
|
|
is(a1.scrollTop, 200, "Wrong scrollTop value after a2.scrollIntoView(false)");
|
2008-01-07 05:37:24 -08:00
|
|
|
|
|
|
|
var b1 = document.getElementById('b1');
|
|
|
|
var b2 = document.getElementById('b2');
|
2010-01-11 13:45:00 -08:00
|
|
|
is(b1.scrollHeight, 420, "Wrong b1.scrollHeight");
|
|
|
|
is(b1.offsetHeight, 100, "Wrong b1.offsetHeight");
|
2008-01-07 05:37:24 -08:00
|
|
|
b2.scrollIntoView(true);
|
2010-01-11 13:45:00 -08:00
|
|
|
is(b1.scrollTop, 100, "Wrong scrollTop value after b2.scrollIntoView(true)");
|
2008-01-07 05:37:24 -08:00
|
|
|
b2.scrollIntoView(false);
|
2010-01-11 13:45:00 -08:00
|
|
|
is(b1.scrollTop, 220, "Wrong scrollTop value after b2.scrollIntoView(false)");
|
2008-01-07 05:37:24 -08:00
|
|
|
|
|
|
|
var c1 = document.getElementById('c1');
|
|
|
|
var c2 = document.getElementById('c2');
|
2010-01-11 13:45:00 -08:00
|
|
|
is(c1.scrollHeight, 320, "Wrong c1.scrollHeight");
|
|
|
|
is(c1.offsetHeight, 100, "Wrong c1.offsetHeight");
|
2008-01-07 05:37:24 -08:00
|
|
|
c2.scrollIntoView(true);
|
2010-01-11 13:45:00 -08:00
|
|
|
is(c1.scrollTop, 100, "Wrong scrollTop value after c2.scrollIntoView(true)");
|
2008-01-07 05:37:24 -08:00
|
|
|
c2.scrollIntoView(false);
|
2010-01-11 13:45:00 -08:00
|
|
|
is(c1.scrollTop, 220, "Wrong scrollTop value after c2.scrollIntoView(false)");
|
2008-01-07 05:37:24 -08:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|