Commit 28d25ce8 authored by lunalu's avatar lunalu Committed by Commit bot

Fix issue with non-touchpad scrolling event over resizer: should not cause an area resize.

BUG=632930

Review-Url: https://codereview.chromium.org/2340533003
Cr-Commit-Position: refs/heads/master@{#419217}
parent 949a29bd
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<textarea id="textarea" style="width: 150px; height: 100px;"></textarea>
<div id="resizablediv" style="resize:both; overflow:scroll; width: 100px; height: 100px;"></div>
<script>
function doScroll(x, y, deltaY, device) {
eventSender.gestureScrollBegin(device, x, y);
eventSender.gestureScrollUpdate(device, 0, deltaY);
eventSender.gestureScrollEnd(device, 0, 0);
}
function resize(id, scrollDeltaY, expectedDeltaY, device) {
var target = document.getElementById(id);
var rect = target.getBoundingClientRect();
var old_height = target.offsetHeight;
// Scrolling within the normal resizer area (15 x 15)
doScroll(rect.right - 5, rect.bottom - 5, scrollDeltaY, device);
assert_equals(target.offsetHeight - old_height, expectedDeltaY);
}
test(function() {
resize("textarea", 20, 20, "touchscreen");
}, 'Touchscreen drag resizes textarea');
test(function() {
resize("textarea", 20, 0, "touchpad");
}, 'Touchpad scroll should not resize textarea');
test(function() {
resize("resizablediv", 20, 20, "touchscreen");
}, 'Touchscreen drag resizes resizable div');
test(function() {
resize("resizablediv", 20, 0, "touchpad");
}, 'Touchpad scroll should not resize resizable div');
</script>
...@@ -433,6 +433,9 @@ bool ScrollManager::isScrollbarHandlingGestures() const ...@@ -433,6 +433,9 @@ bool ScrollManager::isScrollbarHandlingGestures() const
bool ScrollManager::handleScrollGestureOnResizer(Node* eventTarget, const PlatformGestureEvent& gestureEvent) bool ScrollManager::handleScrollGestureOnResizer(Node* eventTarget, const PlatformGestureEvent& gestureEvent)
{ {
if (gestureEvent.source() != PlatformGestureSourceTouchscreen)
return false;
if (gestureEvent.type() == PlatformEvent::GestureScrollBegin) { if (gestureEvent.type() == PlatformEvent::GestureScrollBegin) {
PaintLayer* layer = eventTarget->layoutObject() ? eventTarget->layoutObject()->enclosingLayer() : nullptr; PaintLayer* layer = eventTarget->layoutObject() ? eventTarget->layoutObject()->enclosingLayer() : nullptr;
IntPoint p = m_frame->view()->rootFrameToContents(gestureEvent.position()); IntPoint p = m_frame->view()->rootFrameToContents(gestureEvent.position());
......
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