Skip to content
Permalink
Browse files
Don't suppress click event on textarea resize
Don't suppress click event on textarea resize

https://bugs.webkit.org/show_bug.cgi?id=245617

Reviewed by Aditya Keerthi.

This is to align Webkit behavior with all other browser engines Gecko / Firefox and Blink / Chromium.

As Webkit does send both mousedown and mouseup for a textarea while resizing it might as well send the click event.

Merge - https://chromium.googlesource.com/chromium/src.git/+/add02c1e965eccadef4ee43d99d5dfc0083afa23

* Source/WebCore/page/EventHandler.cpp:
(EventHandler::handlerMousePressEvent): Remove "invalidateClick" to enable "Click" events
* LayoutTests/fast/event/mouse-events-on-textarea-resize.html: Added Test Case
* LayoutTests/fast/event/mouse-events-on-textarea-resize-expected.txt: Added Test Case Expectations
* LayoutTests/platform/ios/TestExpectations: Updated to skip added test on iOS Platform due to lack of resizer support

Canonical link: https://commits.webkit.org/254843@main
  • Loading branch information
Ahmad-S792 authored and pxlcoder committed Sep 25, 2022
1 parent ca2a874 commit 04f52dabffd1c9cc991c935b659d47352f61c291
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
@@ -0,0 +1,26 @@

Verifies that correct mouse events are fired and when resizing an element

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


--- test with preventDefault on 'mousedown' ---
--- move mouse into target ---
--- start resizing ---
--- mouse released ---
Received mouseup
Received click

--- test with preventDefault on '' ---
--- move mouse into target ---
--- start resizing ---
Received mousedown
Received focus
--- mouse released ---
Received mouseup
Received click

PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,50 @@
<!DOCTYPE HTML>
<script src="../../resources/js-test.js"></script>
<style>
textarea {
width: 100px;
height: 100px;
margin: 10px;
}
</style>
<textarea id="target"></textarea>
<div id="console"></div>
<script>
description("Verifies that correct mouse events are fired and when resizing an element");
var testEventList = ['focus', 'mousedown', 'mouseup', 'click'];
var preventDefaultList = ['mousedown', ''];
var eventToPreventDefault = '';
function init() {
var target = document.getElementById("target");
testEventList.forEach(function(eventName) {
target.addEventListener(eventName, function(event) {
if (event.type == eventToPreventDefault) {
event.preventDefault();
}
debug("Received " + event.type);
});
});
}
function runTests() {
var rect = document.getElementById("target").getBoundingClientRect();
var x = rect.right - 5;
var y = rect.bottom - 5;
preventDefaultList.forEach(function(eventName) {
eventToPreventDefault = eventName;
debug("--- test with preventDefault on '" + eventName + "' ---");
debug("--- move mouse into target ---");
eventSender.mouseMoveTo(x, y);
debug("--- start resizing ---");
eventSender.mouseDown();
eventSender.mouseMoveTo(x + 30, y + 30);
debug("--- mouse released ---");
eventSender.mouseUp();
debug("");
});
}
init();
if (window.eventSender)
runTests();
else
debug("This test requires eventSender");
</script>
@@ -1113,6 +1113,7 @@ fast/css/resize-below-min-size.html [ Skip ]
fast/css/resize-corner-tracking.html [ Skip ]
fast/css/resize-orthogonal-containing-block.html [ Skip ]
fast/css/resize-single-axis.html [ Skip ]
fast/events/mouse-events-on-textarea-resize.html [ Skip ]

# The file-wrapper part of <attachment> is not yet working on iOS
fast/attachment/attachment-type-attribute.html [ Skip ]
@@ -1790,7 +1790,6 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& platformMouse
layer->setInResizeMode(true);
m_resizeLayer = WeakPtr { layer };
m_offsetFromResizeCorner = layer->offsetFromResizeCorner(localPoint);
invalidateClick();
return true;
}

0 comments on commit 04f52da

Please sign in to comment.