Skip to content

Commit

Permalink
Revert of Fix to keep the selection of the text field in input elemen…
Browse files Browse the repository at this point in the history
…t after setSelectionRange is called by d… (patchset #7 id:160001 of https://codereview.chromium.org/507533002/)

Reason for revert:
Suspected cause of flaky failures of org.chromium.content.browser.input.ImeTest on Android bots - see http://crbug.com/411756

Original issue's description:
> Fix to keep the selection of the text field in input element after setSelectionRange is called by dom events related to mouse
> 
> The problem is that the selection is cleared when handling mouse release.
> The selection should be kept if the selection is set by setSelectionRange during handling mouse event.
> 
> BUG=32865
> [email protected]
> [email protected]
> TEST=LayoutTests/fast/forms/setrangetext-within-events.html
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181490

[email protected],[email protected],[email protected],[email protected],[email protected]
NOTREECHECKS=true
NOTRY=true
BUG=32865

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

git-svn-id: svn://svn.chromium.org/blink/trunk@181565 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
przem8k committed Sep 8, 2014
1 parent f61b7cf commit 7de2038
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 96 deletions.
33 changes: 0 additions & 33 deletions LayoutTests/fast/forms/setrangetext-within-events-expected.txt

This file was deleted.

46 changes: 0 additions & 46 deletions LayoutTests/fast/forms/setrangetext-within-events.html

This file was deleted.

6 changes: 0 additions & 6 deletions Source/core/editing/FrameSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec

notifyAccessibilityForSelectionChange();
notifyCompositorForSelectionChange();
notifyEventHandlerForSelectionChange();
m_frame->domWindow()->enqueueDocumentEvent(Event::create(EventTypeNames::selectionchange));
}

Expand Down Expand Up @@ -1452,11 +1451,6 @@ void FrameSelection::notifyCompositorForSelectionChange()
scheduleVisualUpdate();
}

void FrameSelection::notifyEventHandlerForSelectionChange()
{
m_frame->eventHandler().notifySelectionChanged();
}

void FrameSelection::focusedOrActiveStateChanged()
{
bool activeAndFocused = isFocusedAndActive();
Expand Down
1 change: 0 additions & 1 deletion Source/core/editing/FrameSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ class FrameSelection FINAL : public NoBaseWillBeGarbageCollectedFinalized<FrameS

void notifyAccessibilityForSelectionChange();
void notifyCompositorForSelectionChange();
void notifyEventHandlerForSelectionChange();

void focusedOrActiveStateChanged();

Expand Down
10 changes: 1 addition & 9 deletions Source/core/page/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve

bool swallowEvent = false;
m_mousePressed = true;
m_selectionInitiationState = HaveNotStartedSelection;

if (event.event().clickCount() == 2)
swallowEvent = handleMousePressEventDoubleClick(event);
Expand Down Expand Up @@ -1284,10 +1285,6 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
m_frame->selection().setCaretBlinkingSuspended(true);

bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targetNode(), m_clickCount, mouseEvent, true);
// m_selectionInitiationState is initialized after dispatching mousedown event in order not to keep the selection by DOM APIs
// Because we can't give the user the chance to handle the selection by user action like dragging if we keep the selection in case of mousedown.
// FireFox also has the same behavior and it's more compatible with other browsers.
m_selectionInitiationState = HaveNotStartedSelection;
swallowEvent = swallowEvent || handleMouseFocus(mouseEvent);
m_capturesDragging = !swallowEvent || mev.scrollbar();

Expand Down Expand Up @@ -2954,11 +2951,6 @@ void EventHandler::notifyElementActivated()
m_lastDeferredTapElement = nullptr;
}

void EventHandler::notifySelectionChanged()
{
m_selectionInitiationState = ExtendedSelection;
}

bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt)
{
// FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do.
Expand Down
1 change: 0 additions & 1 deletion Source/core/page/EventHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ class EventHandler : public NoBaseWillBeGarbageCollectedFinalized<EventHandler>
bool useHandCursor(Node*, bool isOverLink);

void notifyElementActivated();
void notifySelectionChanged();

PassRefPtr<UserGestureToken> takeLastMouseDownGestureToken() { return m_lastMouseDownUserGestureToken.release(); }

Expand Down

0 comments on commit 7de2038

Please sign in to comment.