Commit bebfbc9b authored by xji@chromium.org's avatar xji@chromium.org

2010-12-08 Xiaomei Ji <xji@chromium.org>

        Reviewed by David Hyatt.

        Fix backward mouse wheeling not working when scroll position is below 0.
        https://bugs.webkit.org/show_bug.cgi?id=50370

        Tests: fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html
               fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html

        * platform/ScrollView.cpp:
        (WebCore::ScrollView::wheelEvent):
2010-12-08  Xiaomei Ji  <xji@chromium.org>

        Reviewed by David Hyatt.

        Fix backward mouse wheeling not working when scroll position is below 0.
        https://bugs.webkit.org/show_bug.cgi?id=50370

        * fast/dom/horizontal-scrollbar-in-rtl-expected.txt:
        * fast/dom/horizontal-scrollbar-in-rtl.html:
        * fast/dom/vertical-scrollbar-in-rtl-expected.txt:
        * fast/dom/vertical-scrollbar-in-rtl.html:
        * fast/events/wheelevent-in-horizontal-scrollbar-in-rtl-expected.txt: Added.
        * fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html: Added.
        * fast/events/wheelevent-in-vertical-scrollbar-in-rtl-expected.txt: Added.
        * fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html: Added.
        * platform/chromium/fast/dom/horizontal-scrollbar-in-rtl-expected.txt:
        * platform/chromium/fast/dom/vertical-scrollbar-in-rtl-expected.txt:
        * platform/chromium/fast/events/wheelevent-in-horizontal-scrollbar-in-rtl-expected.txt: Added.
        * platform/chromium/fast/events/wheelevent-in-vertical-scrollbar-in-rtl-expected.txt: Added.
        * platform/gtk/Skipped:
        * platform/mac-tiger/Skipped:
        * platform/mac-wk2/Skipped:
        * platform/qt-wk2/Skipped:
        * platform/qt/fast/dom/horizontal-scrollbar-in-rtl-expected.txt:
        * platform/qt/fast/dom/vertical-scrollbar-in-rtl-expected.txt:
        * platform/win/Skipped:
        * platform/win/fast/dom/horizontal-scrollbar-in-rtl-expected.txt:
        * platform/win/fast/dom/vertical-scrollbar-in-rtl-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8188da9f
2010-12-08 Xiaomei Ji <xji@chromium.org>
Reviewed by David Hyatt.
Fix backward mouse wheeling not working when scroll position is below 0.
https://bugs.webkit.org/show_bug.cgi?id=50370
* fast/dom/horizontal-scrollbar-in-rtl-expected.txt:
* fast/dom/horizontal-scrollbar-in-rtl.html:
* fast/dom/vertical-scrollbar-in-rtl-expected.txt:
* fast/dom/vertical-scrollbar-in-rtl.html:
* fast/events/wheelevent-in-horizontal-scrollbar-in-rtl-expected.txt: Added.
* fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html: Added.
* fast/events/wheelevent-in-vertical-scrollbar-in-rtl-expected.txt: Added.
* fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html: Added.
* platform/chromium/fast/dom/horizontal-scrollbar-in-rtl-expected.txt:
* platform/chromium/fast/dom/vertical-scrollbar-in-rtl-expected.txt:
* platform/chromium/fast/events/wheelevent-in-horizontal-scrollbar-in-rtl-expected.txt: Added.
* platform/chromium/fast/events/wheelevent-in-vertical-scrollbar-in-rtl-expected.txt: Added.
* platform/gtk/Skipped:
* platform/mac-tiger/Skipped:
* platform/mac-wk2/Skipped:
* platform/qt-wk2/Skipped:
* platform/qt/fast/dom/horizontal-scrollbar-in-rtl-expected.txt:
* platform/qt/fast/dom/vertical-scrollbar-in-rtl-expected.txt:
* platform/win/Skipped:
* platform/win/fast/dom/horizontal-scrollbar-in-rtl-expected.txt:
* platform/win/fast/dom/vertical-scrollbar-in-rtl-expected.txt:
2010-12-08 Anton Muhin <antonm@chromium.org>
Unreviewed, cleaning up test expectations after r7349.
......
......@@ -3,7 +3,6 @@ horizontal scroll: : Success
continuously call window.scrollX : Success
zoom in and out preserve scroll position: Success
resize preserves scroll position: Success
wheel scroll preserves horizontal scroll position: Success
KeyDown HOME move x-scroll position to right for RTL page: 0
KeyDown END move x-scroll position to right for RTL page: 0
selectAll selects all document: Success
......@@ -29,11 +29,6 @@
var expectedScrollX = -1000;
var expectedScrollY = 500;
function mousewheelHandler(e)
{
assertEqual("wheel scroll preserves horizontal scroll position", window.scrollX, expectedScrollX);
}
onload = function()
{
if (window.layoutTestController)
......@@ -62,15 +57,6 @@
window.scrollTo(expectedScrollX, expectedScrollY);
window.resizeTo(2000, window.innerHeight);
assertEqual("resize preserves scroll position", window.scrollX, expectedScrollX);
// Test wheel scroll preserves horizontal scroll position.
window.scrollTo(expectedScrollX, expectedScrollY / 2);
var div = document.getElementById("div");
div.addEventListener("mousewheel", mousewheelHandler, false);
var wheelEvent = document.createEvent("WheelEvent");
wheelEvent.initWebKitWheelEvent(0, expectedScrollY / 2, window, 0, 0, 0, 0, false, false, false, false);
div.dispatchEvent(wheelEvent);
// Test HOME/END operation.
if (window.eventSender) {
// Not using assert equal here since the behavior is different in each port.
......
......@@ -3,7 +3,6 @@ vertical scroll: : Success
continuously call window.scrollY : Success
zoom in and out preserve scroll position: Success
resize preserves scroll position: Success
wheel scroll preserves vertical scroll position: Success
KeyDown HOME move y-scroll position to bottom for RTL page: 0
KeyDown END move y-scroll position to bottom for RTL page: 0
selectAll selects all document: Success
......@@ -29,11 +29,6 @@
var expectedScrollX = 500;
var expectedScrollY = -1000;
function mousewheelHandler(e)
{
assertEqual("wheel scroll preserves vertical scroll position", window.scrollY, expectedScrollY);
}
onload = function()
{
if (window.layoutTestController)
......@@ -63,14 +58,6 @@
window.resizeTo(window.innerWidth, 2000);
assertEqual("resize preserves scroll position", window.scrollY, expectedScrollY);
// Test wheel scroll preserves horizontal scroll position.
window.scrollTo(expectedScrollX / 2, expectedScrollY);
var div = document.getElementById("div");
div.addEventListener("mousewheel", mousewheelHandler, false);
var wheelEvent = document.createEvent("WheelEvent");
wheelEvent.initWebKitWheelEvent(expectedScrollX / 2, 0, window, 0, 0, 0, 0, false, false, false, false);
div.dispatchEvent(wheelEvent);
// Test HOME/END operation.
if (window.eventSender) {
// Not using assert equal here since the behavior is different in each port.
......
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
window.scrollX: -116
window.scrollY: 92
<html dir=rtl>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
<script>
function log(str)
{
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
if (window.layoutTestController) {
layoutTestController.waitUntilDone();
}
function dispatchWheelEvent()
{
window.addEventListener("mousewheel", mousewheelHandler, false);
window.scrollTo(-100, 100);
if (window.eventSender) {
eventSender.mouseMoveTo(100, 100);
eventSender.continuousMouseScrollBy(-10, 0);
eventSender.continuousMouseScrollBy(30, 0);
eventSender.continuousMouseScrollBy(0, -10);
eventSender.continuousMouseScrollBy(0, 30);
}
setTimeout('checkOffsets();', 100);
}
function checkOffsets()
{
log("window.scrollX: " + window.scrollX);
log("window.scrollY: " + window.scrollY);
if (window.layoutTestController)
window.layoutTestController.notifyDone();
}
function mousewheelHandler(e)
{
}
</script>
</head>
<body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
<div id="div" style="whitespace:nowrap; width: 4000px; height: 1000px; border: 1px solid red;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</div>
<div id="console"></div>
</body>
</html>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
window.scrollX: 84
window.scrollY: -108
<html dir=rtl style="-webkit-writing-mode:vertical-lr">
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
<script>
function log(str)
{
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
if (window.layoutTestController) {
layoutTestController.waitUntilDone();
}
function dispatchWheelEvent()
{
window.addEventListener("mousewheel", mousewheelHandler, false);
window.scrollTo(100, -100);
if (window.eventSender) {
eventSender.mouseMoveTo(100, 100);
eventSender.continuousMouseScrollBy(-10, 0);
eventSender.continuousMouseScrollBy(30, 0);
eventSender.continuousMouseScrollBy(0, -10);
eventSender.continuousMouseScrollBy(0, 30);
}
setTimeout('checkOffsets();', 100);
}
function checkOffsets()
{
log("window.scrollX: " + window.scrollX);
log("window.scrollY: " + window.scrollY);
if (window.layoutTestController)
window.layoutTestController.notifyDone();
}
function mousewheelHandler(e)
{
}
</script>
</head>
<body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
<div id="div" style="whitespace:nowrap; width: 4000px; height: 1000px; border: 1px solid red;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</div>
<div id="console"></div>
</body>
</html>
......@@ -3,7 +3,6 @@ horizontal scroll: : Success
continuously call window.scrollX : Success
zoom in and out preserve scroll position: Success
resize preserves scroll position: Success
wheel scroll preserves horizontal scroll position: Success
KeyDown HOME move x-scroll position to right for RTL page: -1000
KeyDown END move x-scroll position to right for RTL page: -1000
selectAll selects all document: Success
......@@ -3,7 +3,6 @@ vertical scroll: : Success
continuously call window.scrollY : Success
zoom in and out preserve scroll position: Success
resize preserves scroll position: Success
wheel scroll preserves vertical scroll position: Success
KeyDown HOME move y-scroll position to bottom for RTL page: -2967
KeyDown END move y-scroll position to bottom for RTL page: 0
selectAll selects all document: Success
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
window.scrollX: -120
window.scrollY: 80
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
window.scrollX: 80
window.scrollY: -120
......@@ -4874,6 +4874,8 @@ fast/forms/multiple-form-submission-protection-mouse.html
fast/events/remove-child-onscroll.html
fast/events/platform-wheelevent-in-scrolling-div.html
fast/events/continuous-platform-wheelevent-in-scrolling-div.html
fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html
fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html
# meter element is not supported
# http://bugs.webkit.org/show_bug.cgi?id=48713
......
......@@ -129,6 +129,8 @@ java/lc3/JavaArray/ToString-001.html
fast/events/remove-child-onscroll.html
fast/events/platform-wheelevent-in-scrolling-div.html
fast/events/continuous-platform-wheelevent-in-scrolling-div.html
fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html
fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html
# Intermittently times out on Tiger bot.
# https://bugs.webkit.org/show_bug.cgi?id=36039
......
......@@ -321,6 +321,8 @@ fast/events/tab-imagemap.html
fast/events/tab-is-focusable-assert.html
fast/events/tabindex-focus-chain.html
fast/events/updateLayoutForHitTest.html
fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html
fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html
fast/events/window-events-bubble.html
fast/events/window-events-bubble2.html
fast/events/window-events-capture.html
......
......@@ -370,6 +370,8 @@ fast/events/tab-imagemap.html
fast/events/tab-is-focusable-assert.html
fast/events/tabindex-focus-chain.html
fast/events/updateLayoutForHitTest.html
fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html
fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html
fast/events/window-events-bubble.html
fast/events/window-events-bubble2.html
fast/events/window-events-capture.html
......
......@@ -3,7 +3,6 @@ horizontal scroll: : Success
continuously call window.scrollX : Success
zoom in and out preserve scroll position: Success
resize preserves scroll position: Success
wheel scroll preserves horizontal scroll position: Success
KeyDown HOME move x-scroll position to right for RTL page: -1000
KeyDown END move x-scroll position to right for RTL page: -1000
selectAll selects all document: Success
......@@ -3,7 +3,6 @@ vertical scroll: : Success
continuously call window.scrollY : Success
zoom in and out preserve scroll position: Success
resize preserves scroll position: Success
wheel scroll preserves vertical scroll position: Success
KeyDown HOME move y-scroll position to bottom for RTL page: -3426
KeyDown END move y-scroll position to bottom for RTL page: 0
selectAll selects all document: Success
......@@ -879,6 +879,8 @@ fast/forms/multiple-form-submission-protection-mouse.html
fast/events/remove-child-onscroll.html
fast/events/platform-wheelevent-in-scrolling-div.html
fast/events/continuous-platform-wheelevent-in-scrolling-div.html
fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html
fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html
scrollbars/scrollevent-iframe-no-scrolling-wheel.html
# Windows port doesn't yet support rendering of non-BMP characters even though there's a font available.
......
......@@ -3,7 +3,6 @@ horizontal scroll: : Success
continuously call window.scrollX : Success
zoom in and out preserve scroll position: Success
resize preserves scroll position: Success
wheel scroll preserves horizontal scroll position: Success
KeyDown HOME move x-scroll position to right for RTL page: -1000
KeyDown END move x-scroll position to right for RTL page: -1000
selectAll selects all document: Success
......@@ -3,7 +3,6 @@ vertical scroll: : Success
continuously call window.scrollY : Success
zoom in and out preserve scroll position: Success
resize preserves scroll position: Success
wheel scroll preserves vertical scroll position: Success
KeyDown HOME move y-scroll position to bottom for RTL page: -3425
KeyDown END move y-scroll position to bottom for RTL page: 0
selectAll selects all document: Success
2010-12-08 Xiaomei Ji <xji@chromium.org>
Reviewed by David Hyatt.
Fix backward mouse wheeling not working when scroll position is below 0.
https://bugs.webkit.org/show_bug.cgi?id=50370
Tests: fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html
fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html
* platform/ScrollView.cpp:
(WebCore::ScrollView::wheelEvent):
2010-12-08 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dan Bernstein.
......
......@@ -733,11 +733,12 @@ void ScrollView::wheelEvent(PlatformWheelEvent& e)
// scroll any further.
float deltaX = m_horizontalScrollbar ? e.deltaX() : 0;
float deltaY = m_verticalScrollbar ? e.deltaY() : 0;
IntSize maxScrollDelta = maximumScrollPosition() - scrollPosition();
if ((deltaX < 0 && maxScrollDelta.width() > 0)
|| (deltaX > 0 && scrollOffset().width() > 0)
|| (deltaY < 0 && maxScrollDelta.height() > 0)
|| (deltaY > 0 && scrollOffset().height() > 0)) {
IntSize maxForwardScrollDelta = maximumScrollPosition() - scrollPosition();
IntSize maxBackwardScrollDelta = scrollPosition() - minimumScrollPosition();
if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
|| (deltaX > 0 && maxBackwardScrollDelta.width() >0)
|| (deltaY < 0 && maxForwardScrollDelta.height() > 0)
|| (deltaY > 0 && maxBackwardScrollDelta.width() > 0)) {
e.accept();
if (e.granularity() == ScrollByPageWheelEvent) {
ASSERT(!e.deltaX());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment