Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: third_party/WebKit/LayoutTests/fast/hidpi/static/mousewheel-scroll-amount.html

Issue 1754033002: ScrollableArea::pixelStep should return DIP not viewport (physical pixels) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/hidpi/static/mousewheel-scroll-amount.html
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/mousewheel-scroll.html b/third_party/WebKit/LayoutTests/fast/hidpi/static/mousewheel-scroll-amount.html
similarity index 55%
copy from third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/mousewheel-scroll.html
copy to third_party/WebKit/LayoutTests/fast/hidpi/static/mousewheel-scroll-amount.html
index 222d0844487550356b5c05e49a43b4a7f3546c00..bb45364d942264d103b3420842cd1c824e047b8d 100644
--- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/mousewheel-scroll.html
+++ b/third_party/WebKit/LayoutTests/fast/hidpi/static/mousewheel-scroll-amount.html
@@ -1,6 +1,6 @@
-<!DOCTYPE html>
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<script src="../../../resources/js-test.js"></script>
-<style>
+<style type="text/css">
body {
height: 2000px;
width: 2000px;
@@ -9,11 +9,9 @@
<script>
window.jsTestIsAsync = true;
+ var dpr = window.devicePixelRatio;
- description("This test ensures that consecutive mouse wheel ticks scroll\
- to the right offset. The main purpose of this test is to ensure that\
- smooth scrolling on the compositor works as intended (tested via\
- virtual suite virtual/threaded/).");
+ description("This test ensures that mouse wheel ticks scrolls the right number of pixels in high dpi mode.");
function testDiagonalScroll() {
// Reset
@@ -21,17 +19,16 @@
document.scrollingElement.scrollLeft = 0;
eventSender.mouseMoveTo(20, 20);
- // Scroll 3 ticks diagonally.
- eventSender.mouseScrollBy(-3, -3);
- // Undo 2 ticks in each direction.
- eventSender.mouseScrollBy(2, 2);
- // 40px per tick.
- shouldBecomeEqual("document.scrollingElement.scrollTop == 40 && " +
- "document.scrollingElement.scrollLeft == 40", "true", finishJSTest);
+ // 1 tick should move 40px.
+ eventSender.mouseScrollBy(-2 * dpr, -2 * dpr);
+
+ shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " +
+ "document.scrollingElement.scrollLeft == 80", "true", finishJSTest);
}
function runTest() {
if (!window.eventSender || !window.internals) {
+ debug("This test requires window.eventSender and window.internals.");
finishJSTest();
return;
}
@@ -40,19 +37,12 @@
internals.settings.setScrollAnimatorEnabled(true);
eventSender.mouseMoveTo(20, 20);
- // Scroll down 3 ticks.
- eventSender.mouseScrollBy(0, -1);
- eventSender.mouseScrollBy(0, -2);
- // Scroll right 3 ticks.
- eventSender.mouseScrollBy(-1, 0);
- eventSender.mouseScrollBy(-2, 0);
- // Undo 1 tick in each direction.
- eventSender.mouseScrollBy(0, 1);
- eventSender.mouseScrollBy(1, 0);
+ // 1 tick should move 40px.
+ eventSender.mouseScrollBy(-dpr, -dpr);
// 40px per tick.
- shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " +
- "document.scrollingElement.scrollLeft == 80", "true", testDiagonalScroll);
+ shouldBecomeEqual("document.scrollingElement.scrollTop == 40 && " +
+ "document.scrollingElement.scrollLeft == 40", "true", testDiagonalScroll);
}
</script>

Powered by Google App Engine
This is Rietveld 408576698