user-select: none cursor turns to I-beam on mouse dragging

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

Patch by Vani Hegde <vani.hegde@samsung.com> on 2013-09-30
Reviewed by Ryosuke Niwa.

Source/WebCore:

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).

During text selection, changing the cursor type to text only when
there is no explicit cursor type set fixes the issue.

Test: editing/caret/selection-with-caret-type-progress.html

* page/EventHandler.cpp:
(WebCore::EventHandler::selectCursor):
During selection, set the cursor style to text only if there is no
explicit cursor style set.

LayoutTests:

Test case added to verify that explicitly set cursor style
is retained on performing text selection.

* editing/caret/selection-with-caret-type-progress-expected.txt: Added.
* editing/caret/selection-with-caret-type-progress.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a97a9511
2013-09-30 Vani Hegde <vani.hegde@samsung.com>
user-select: none cursor turns to I-beam on mouse dragging
https://bugs.webkit.org/show_bug.cgi?id=90159
Reviewed by Ryosuke Niwa.
Test case added to verify that explicitly set cursor style
is retained on performing text selection.
* editing/caret/selection-with-caret-type-progress-expected.txt: Added.
* editing/caret/selection-with-caret-type-progress.html: Added.
2013-09-29 Philip Rogers <pdr@google.com>
Repaint borders and outlines on pseudo content changes
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 mouse.
PASS currentCursorType is "Progress"
PASS successfullyParsed is true
TEST COMPLETE
<!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 mouse.</div>
<div id="console"></div>
<script src="../../resources/js-test-pre.js"></script>
<script>
description('Tests whether explicitly set caret style is retained on performing text selection');
if (window.eventSender && window.internals) {
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);
eventSender.mouseDown();
leapForwardAndMove(div.offsetLeft + 10);
leapForwardAndMove(div.offsetLeft + 20);
leapForwardAndMove(div.offsetWidth - 10);
var cursorInfo = window.internals.getCurrentCursorInfo(document);
var currentCursorType = cursorInfo.substring(cursorInfo.indexOf('=') + 1, cursorInfo.lastIndexOf(' '));
shouldBeEqualToString('currentCursorType', 'Progress');
} else {
debug('To test manually, select the text within the red bordered div above by dragging the mouse. Progress cursor should be displayed while doing so.');
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
2013-09-30 Vani Hegde <vani.hegde@samsung.com>
user-select: none cursor turns to I-beam on mouse dragging
https://bugs.webkit.org/show_bug.cgi?id=90159
Reviewed by Ryosuke Niwa.
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).
During text selection, changing the cursor type to text only when
there is no explicit cursor type set fixes the issue.
Test: editing/caret/selection-with-caret-type-progress.html
* page/EventHandler.cpp:
(WebCore::EventHandler::selectCursor):
During selection, set the cursor style to text only if there is no
explicit cursor style set.
2013-09-29 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Generate toCSSFooValue() for CSSCanvasValue
......@@ -1303,15 +1303,6 @@ OptionalCursor EventHandler::selectCursor(const HitTestResult& result, bool shif
cancelAutoHideCursorTimer();
#endif
// During selection, use an I-beam no matter what we're over.
// If a drag may be starting or we're capturing mouse events for a particular node, don't treat this as a selection.
if (m_mousePressed && m_mouseDownMayStartSelect
#if ENABLE(DRAG_SUPPORT)
&& !m_mouseDownMayStartDrag
#endif
&& m_frame.selection().isCaretOrRange() && !m_capturingMouseEventsNode)
return iBeam;
if (renderer) {
Cursor overrideCursor;
switch (renderer->getCursor(roundedIntPoint(result.localPoint()), overrideCursor)) {
......@@ -1373,6 +1364,18 @@ OptionalCursor EventHandler::selectCursor(const HitTestResult& result, bool shif
inResizer = layer->isPointInResizeControl(view->windowToContents(roundedIntPoint(result.localPoint())));
}
}
// During selection, use an I-beam regardless of the content beneath the cursor when cursor style is not explicitly specified.
// If a drag may be starting or we're capturing mouse events for a particular node, don't treat this as a selection.
if (m_mousePressed && m_mouseDownMayStartSelect
#if ENABLE(DRAG_SUPPORT)
&& !m_mouseDownMayStartDrag
#endif
&& m_frame.selection().isCaretOrRange()
&& !m_capturingMouseEventsNode) {
return iBeam;
}
if ((editable || (renderer && renderer->isText() && node->canStartSelection())) && !inResizer && !result.scrollbar())
return iBeam;
return pointerCursor();
......
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