Commit 99fb80c3 authored by myid.o.shin@gmail.com's avatar myid.o.shin@gmail.com

Make sure that selection is cleared after tapping.

The problem is that Selection is not getting cleared 
after tapping of gesture. This was affected by 
https://codereview.chromium.org/507533002, 
because initialization for m_selectionInitiationState was 
skipped in case of gesture. 
This patch makes m_selectionInitiationState be initialized
after dispatching mousedown event for gesture tapping.

BUG=429967
R=rbyers@chromium.org
TEST=LayoutTests/fast/events/touch/gesture/gesture-tap-reset-selection-range.html

Review URL: https://codereview.chromium.org/705733002

git-svn-id: svn://svn.chromium.org/blink/trunk@185410 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 94337811
This tests if the selection is reset after tapping of gesture
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS window.getSelection().rangeCount is > 0
PASS window.getSelection().rangeCount is 0
PASS successfullyParsed is true
TEST COMPLETE
Make Selection Here
<!DOCTYPE html>
<script src="../../../../resources/js-test.js"></script>
<div id="dragme">Make Selection Here</div>
<script>
description("This tests if the selection is reset after tapping of gesture");
if (window.eventSender) {
var dragme = document.getElementById('dragme');
window.getSelection().selectAllChildren(dragme);
shouldBeGreaterThan('window.getSelection().rangeCount', '0');
var x = dragme.offsetLeft + dragme.offsetWidth / 2;
var y = dragme.offsetTop + dragme.offsetHeight / 2;
eventSender.gestureTapDown(x, y);
eventSender.gestureShowPress(x, y);
eventSender.gestureTap(x, y);
shouldBeZero('window.getSelection().rangeCount');
}
</script>
\ No newline at end of file
......@@ -2263,8 +2263,11 @@ bool EventHandler::handleGestureTap(const GestureEventWithHitTestResults& target
bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true);
if (!swallowMouseDownEvent)
swallowMouseDownEvent = handleMouseFocus(MouseEventWithHitTestResults(fakeMouseDown, currentHitTest));
if (!swallowMouseDownEvent)
if (!swallowMouseDownEvent) {
swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResults(fakeMouseDown, currentHitTest));
// m_selectionInitiationState is initialized after dispatching mousedown event.
m_selectionInitiationState = HaveNotStartedSelection;
}
// FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.com/398920
if (currentHitTest.innerNode())
......
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