Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Selection should not set the cursor type to text over the explicitly …
…set cursor type https://bugs.webkit.org/show_bug.cgi?id=258622 Reviewed by Ryosuke Niwa. This patch aligns WebKit with Blink / Chromium and Gecko / Firefox. Merge: https://chromium.googlesource.com/chromium/blink/+/a5c471c481544403615780bce2845de58e37e341 When tried to select some text in an area that has style cursor:default set, cursor type changes to text cursor ignoring the cursor style that is explicitly set. When the cursor style is explicitly set as default(or something else), we should not change it to text cursor no matter what we are over or what operation we are performing (be it hovering over the text or selecting the text). We change the cursor type to text during selection. But if there is an explicit cursor style set then this explicitly set cursor style should be given priority over the text style cursor during selection. Currently if the area on which cursor:default is set is contenteditable, in this particular case we do not change the cursor style to text on selection. This should be the behavior irrespective of editability. * Source/WebCore/page/EventHandler.cpp: (EventHandler::selectCursor): As per commit message * LayoutTests/editing/caret/caret-type-for-user-select-none.html: Add Test Case * LayoutTests/editing/caret/caret-type-for-user-select-none-expected.txt: Add Test Case Expectation * LayoutTests/platform/ios/TestExpectations: Add Platform Specific Expectation to Skip on iOS due to test leveraging 'eventSender' mousedown and mouseMoveTo. Canonical link: https://commits.webkit.org/265597@main
- Loading branch information
1 parent
687a6e6
commit 1504201
Showing
4 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
LayoutTests/editing/caret/caret-type-for-user-select-none-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 @@ | ||
Tests whether explicitly set caret style is retained on performing text selection | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
Try selecting this text by dragging the cursor. Progress cursor should be displayed while doing so. | ||
PASS currentCursorType is "Progress" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
29 changes: 29 additions & 0 deletions
29
LayoutTests/editing/caret/caret-type-for-user-select-none.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,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<p id="description"></p> | ||
<div style="cursor:progress; border: 2px solid red;" id="test">Try selecting this text by dragging the cursor. Progress cursor should be displayed while doing so.</div> | ||
<div id="console"></div> | ||
<script src="../../resources/js-test.js"></script> | ||
<script> | ||
if (window.eventSender && window.internals) { | ||
description('Tests whether explicitly set caret style is retained on performing text selection'); | ||
var div = document.getElementById("test"); | ||
div.focus(); | ||
var y = div.offsetTop + div.offsetHeight / 2; | ||
function leapForwardAndMove(x) { | ||
eventSender.leapForward(200); | ||
eventSender.mouseMoveTo(div.offsetLeft + x, y); | ||
} | ||
eventSender.dragMode = false; | ||
leapForwardAndMove(div.offsetLeft + 5, y); | ||
eventSender.mouseDown(); | ||
leapForwardAndMove(10); | ||
leapForwardAndMove(div.offsetWidth - 10); | ||
var cursorInfo = window.internals.getCurrentCursorInfo(document); | ||
var currentCursorType = cursorInfo.substring(cursorInfo.indexOf('=') + 1, cursorInfo.lastIndexOf(' ')); | ||
shouldBeEqualToString('currentCursorType', 'Progress'); | ||
} | ||
</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
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