113 lines
4.0 KiB
HTML
113 lines
4.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js" type="text/javascript"></script>
|
|
<style>
|
|
#parent {
|
|
background-color: #eee;
|
|
}
|
|
#target {
|
|
background-color: silver;
|
|
}
|
|
</style>
|
|
<script>
|
|
window.jsTestIsAsync = true;
|
|
|
|
var pageScrollPositionBefore;
|
|
var pageScrollHeightBefore;
|
|
var continueCount = 5;
|
|
|
|
function checkForScrollOffset()
|
|
{
|
|
var pageScrollPositionAfter = document.scrollingElement.scrollTop;
|
|
var pageScrollHeightAfter = document.scrollingElement.scrollHeight;
|
|
|
|
if (pageScrollPositionAfter + 100 >= pageScrollPositionBefore)
|
|
testFailed("Page did not properly handle rubber banding state.");
|
|
else
|
|
testPassed("Page properly handled rubber banding state.");
|
|
|
|
finishJSTest();
|
|
}
|
|
|
|
var zoomOutCount = 0;
|
|
function zoomPageOut()
|
|
{
|
|
if (!zoomOutCount) {
|
|
pageScrollPositionBefore = document.scrollingElement.scrollTop;
|
|
pageScrollHeightBefore = document.scrollingElement.scrollHeight;
|
|
}
|
|
|
|
eventSender.zoomPageOut();
|
|
zoomOutCount = zoomOutCount + 1;
|
|
if (zoomOutCount >= 2)
|
|
setTimeout(checkForScrollOffset, 100);
|
|
else
|
|
setTimeout(zoomPageOut, 100);
|
|
}
|
|
|
|
function scrollDown()
|
|
{
|
|
// Scroll the #source until we reach the #target.
|
|
var selectTarget = document.getElementById('target');
|
|
var startPosX = Math.round(selectTarget.offsetLeft) + 20;
|
|
var startPosY = Math.round(selectTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the target div
|
|
eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the target div
|
|
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
|
|
for (var i = 0; i < 40; ++i) {
|
|
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, 'changed', 'none');
|
|
}
|
|
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
|
|
|
|
setTimeout(zoomPageOut, 700);
|
|
}
|
|
|
|
var zoomInCount = 0;
|
|
function zoomPageIn()
|
|
{
|
|
eventSender.zoomPageIn();
|
|
zoomInCount = zoomInCount + 1;
|
|
if (zoomInCount >= 2)
|
|
setTimeout(scrollDown, 100);
|
|
else
|
|
setTimeout(zoomPageIn, 100);
|
|
}
|
|
|
|
function startTest()
|
|
{
|
|
if (window.eventSender) {
|
|
setTimeout(zoomPageIn, 0);
|
|
} else {
|
|
var messageLocation = document.getElementById('parent');
|
|
var message = document.createElement('div');
|
|
message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
|
|
+ "at the top of the page, perform two text zooms, scroll to the bottom of the page, then zoom back out.<br/>"
|
|
+ "The bottom of the test page should not be offset from the bottom of the web view.<\/p>";
|
|
messageLocation.appendChild(message);
|
|
}
|
|
}
|
|
|
|
window.addEventListener('load', startTest, false);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="parent" style="height: 2000px;">
|
|
<div id="source" style="height: 100px">
|
|
Put mouse here and do the following:
|
|
<ol>
|
|
<li>Perform two text zooms (in). (Command+ in Safari)</li>
|
|
<li>Scroll down to the bottom. Be sure to scroll far enough that a rubberband animation is triggered.</li>
|
|
<li>Perform two text zooms (out). (Commmand- in Safari)</li>
|
|
</ol>
|
|
</div>
|
|
<div id="target" style="height: 1000px; position: relative">
|
|
</div>
|
|
</div>
|
|
<div id="console"></div><script type="text/javascript">
|
|
description("Tests that scroll dimensions return to correct size after rubber banding while zoomed.");
|
|
</script>
|
|
<div id="bottom">This should be at the very bottom of the page.</div>
|
|
<script src="../../resources/js-test-post.js" type="text/javascript"></script>
|
|
</body>
|
|
</html>
|