haikuwebkit/LayoutTests/scrollbars/scrolling-by-page-ignoring-...

66 lines
2.2 KiB
HTML
Raw Permalink Normal View History

Scrolling with spacebar on a page with fixed header breaks reading flow https://bugs.webkit.org/show_bug.cgi?id=135506 Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-08-28 Reviewed by Simon Fraser. Source/WebCore: When scrolling by page, find the height of any bar that is obscuring the top or bottom of the page, and substract that height from the step to scroll. Tests: scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html scrollbars/scrolling-by-page-on-keyboard-spacebar.html * WebCore.exp.in: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollStepForFixedContent): * page/FrameView.h: * platform/ScrollableArea.cpp: (WebCore::ScrollableArea::adjustScrollStepForFixedContent): (WebCore::ScrollableArea::scroll): * platform/ScrollableArea.h: LayoutTests: There was pretty much no test coverage for scrolling by page, add some tests. * fast/events/scrollbar-double-click-expected.txt: * platform/mac-wk1/TestExpectations: * scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar-expected.txt: Added. * scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html: Added. * scrollbars/scrolling-backward-by-page-on-keyboard-spacebar-expected.txt: Added. * scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html: Added. * scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar-expected.txt: Added. * scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html: Added. * scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar-expected.txt: Added. * scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html: Added. * scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar-expected.txt: Added. * scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html: Added. * scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar-expected.txt: Added. * scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html: Added. * scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar-expected.txt: Added. * scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html: Added. * scrollbars/scrolling-by-page-on-keyboard-spacebar-expected.txt: Added. * scrollbars/scrolling-by-page-on-keyboard-spacebar.html: Added. Canonical link: https://commits.webkit.org/154176@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-08-28 20:01:18 +00:00
<html>
<head>
<style>
body {
height: 10000px;
}
#top-bar {
position: fixed;
width: 100%;
height: 200px;
background-color: green;
top: 0;
left: 0;
visibility: hidden;
}
#bottom-bar {
position: fixed;
width: 100%;
height: 200px;
background-color: green;
bottom: 0;
left: 0;
visibility: hidden;
}
</style>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<div id="top-bar"></div>
<div id="bottom-bar"></div>
<script>
description("Test scrolling with page granularity by using the space bar. The fixed elements should be ignored because they are hidden.");
jsTestIsAsync = true;
var failTimeoutId;
function test() {
if (window.eventSender) {
// Force the first layout to avoid the suppressed scrollbar cases.
scratch = document.documentElement.offsetWidth;
// Avoid special cases for being "onload".
setTimeout(function() {
eventSender.keyDown(' ');
} , 0);
failTimeoutId = setTimeout(function() {
testFailed("The scrollview failed to scroll in response to the event.");
debug("window.scrollY = " + window.scrollY + " excepted value around " + (window.innerHeight - 40));
finishJSTest();
}, 1000);
}
}
window.addEventListener("scroll", function() {
if (window.scrollY == window.innerHeight - 40) {
testPassed("Scrolled to " + window.scrollY);
clearTimeout(failTimeoutId);
finishJSTest();
}
})
window.addEventListener("load", test);
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>