Index: third_party/WebKit/Source/core/editing/SelectionController.cpp |
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp |
index 2879cc9efe038d8f372021a6157f19adf7061d17..9175a5df766c23656db207fa0446c1b0e133b1a3 100644 |
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp |
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp |
@@ -1051,12 +1051,16 @@ bool SelectionController::mouseDownWasSingleClickInSelection() const { |
} |
void SelectionController::notifySelectionChanged() { |
- if (selection().getSelectionType() == SelectionType::RangeSelection) |
- m_selectionState = SelectionState::ExtendedSelection; |
- else if (selection().getSelectionType() == SelectionType::CaretSelection) |
- m_selectionState = SelectionState::PlacedCaret; |
- else |
+ const SelectionInDOMTree& selection = this->selection().selectionInDOMTree(); |
+ if (selection.isNone()) { |
m_selectionState = SelectionState::HaveNotStartedSelection; |
+ return; |
+ } |
+ if (selection.isCaret() && selection.granularity() == CharacterGranularity) { |
+ m_selectionState = SelectionState::PlacedCaret; |
+ return; |
+ } |
+ m_selectionState = SelectionState::ExtendedSelection; |
} |
FrameSelection& SelectionController::selection() const { |