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

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
Index: Source/core/editing/SelectionController.cpp
diff --git a/Source/core/editing/SelectionController.cpp b/Source/core/editing/SelectionController.cpp
index 6544f3ce7d923d24655242e3ee59a7adbd8fbac6..d2e0e6678f4664efc926bc0146d4c3362f292dcb 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()
+{
yosin_UTC9 2015/07/06 01:57:30 It is better to have a function which maps |Select
Miyoung Shin(g) 2015/07/13 03:32:57 Done.
+ if (selection().isRange())
+ m_selectionState = SelectionState::ExtendedSelection;
+ else if (selection().isCaret())
+ m_selectionState = SelectionState::PlacedCaret;
+ else
+ m_selectionState = SelectionState::HaveNotStartedSelection;
+}
+
FrameSelection& SelectionController::selection() const
{
return m_frame->selection();

Powered by Google App Engine
This is Rietveld 408576698