This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Map Alt-Up/Down to PageUp/PageDown on Mac
Match Safari's behavior Used to be Control-Up/Down but actually it won't work because they are usually used by Mission Control on Mac BUG=570823 Review URL: https://codereview.chromium.org/1591743002 Cr-Commit-Position: refs/heads/master@{#370183}
- Loading branch information
chongz
authored and
Commit bot
committed
Jan 19, 2016
1 parent
8f131d2
commit 2e7a4d4
Showing
3 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
third_party/WebKit/LayoutTests/fast/events/keyboard-scroll-by-page-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
This tests keyboard scrolling by pages. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS document.scrollingElement.scrollTop >= window.innerHeight * 0.875 became true | ||
PASS document.scrollingElement.scrollTop became 0 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
71 changes: 71 additions & 0 deletions
71
third_party/WebKit/LayoutTests/fast/events/keyboard-scroll-by-page.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test.js"></script> | ||
<style type="text/css"> | ||
::-webkit-scrollbar { | ||
width: 0px; | ||
height: 0px; | ||
} | ||
|
||
#greenbox { | ||
width: 100px; | ||
height: 2000px; | ||
background: green; | ||
} | ||
#redbox { | ||
width: 100px; | ||
height: 2000px; | ||
background: red; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body style="margin:0" onload="runTest();"> | ||
|
||
<div id="greenbox"></div> | ||
<div id="redbox"></div> | ||
|
||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script type="text/javascript"> | ||
|
||
function keyboardScrollPageDown() | ||
{ | ||
if (navigator.platform.indexOf('Mac') == 0) { | ||
eventSender.keyDown('downArrow', ["altKey"]); | ||
} else { | ||
eventSender.keyDown('pageDown'); | ||
} | ||
|
||
// see kMinFractionToStepWhenPaging = 0.875f in ScrollableArea.cpp | ||
shouldBecomeEqual("document.scrollingElement.scrollTop >= window.innerHeight * 0.875", "true", keyboardScrollPageUp); | ||
} | ||
|
||
function keyboardScrollPageUp() | ||
{ | ||
if (navigator.platform.indexOf('Mac') == 0) { | ||
eventSender.keyDown('upArrow', ["altKey"]); | ||
} else { | ||
eventSender.keyDown('pageUp'); | ||
} | ||
|
||
// PageDown + PageUp goes back to 0 | ||
shouldBecomeEqual("document.scrollingElement.scrollTop", "0", finishJSTest); | ||
} | ||
|
||
jsTestIsAsync = true; | ||
|
||
function runTest() | ||
{ | ||
if (window.eventSender) { | ||
description('This tests keyboard scrolling by pages.'); | ||
keyboardScrollPageDown(); | ||
} else { | ||
debug("This test requires DumpRenderTree. Use PageUp/Down (or Alt-Up/Down for Mac) to validate the implementation."); | ||
} | ||
} | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters