Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(969)

Unified Diff: Source/core/editing/SelectionController.cpp

Issue 1049233003: Keep the selection of the text field when changed by JS. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/SelectionController.h ('k') | Source/core/input/EventHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/SelectionController.cpp
diff --git a/Source/core/editing/SelectionController.cpp b/Source/core/editing/SelectionController.cpp
index 537e809b2414b2b0777f4e30a9eb21f3a858e83b..b000f175d4c699892e1ccb42205d836e6ccab4db 100644
--- a/Source/core/editing/SelectionController.cpp
+++ b/Source/core/editing/SelectionController.cpp
@@ -193,7 +193,7 @@ bool SelectionController::handleMousePressEventSingleClickAlgorithm(const MouseE
granularity = selection().granularity();
expandSelectionUsingGranularity(newSelection, selection().granularity());
}
- } else {
+ } else if (m_selectionState != SelectionState::ExtendedSelection) {
newSelection = expandSelectionToRespectUserSelectAll(innerNode, VisibleSelection(visiblePos));
}
@@ -618,6 +618,16 @@ bool SelectionController::mouseDownWasSingleClickInSelection() const
return m_mouseDownWasSingleClickInSelection;
}
+void SelectionController::notifySelectionChanged()
+{
+ if (selection().selectionType() == SelectionType::RangeSelection)
+ m_selectionState = SelectionState::ExtendedSelection;
+ else if (selection().selectionType() == SelectionType::CaretSelection)
+ m_selectionState = SelectionState::PlacedCaret;
+ else
+ m_selectionState = SelectionState::HaveNotStartedSelection;
+}
+
FrameSelection& SelectionController::selection() const
{
return m_frame->selection();
« no previous file with comments | « Source/core/editing/SelectionController.h ('k') | Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698