diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 4f6d6d0ea..49c07d3ed 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -808,6 +808,8 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana if (!state) return; + // At this point it is unknown whether the text input state has been updated due to a text selection. + // Keep the cursor position updated for cursor movements too. if (GetSelectedText().empty()) m_cursorPosition = state->selection_start; @@ -891,6 +893,11 @@ void RenderWidgetHostViewQt::selectionChanged() } if (GetSelectedText().empty()) { + // RenderWidgetHostViewQt::OnUpdateTextInputStateCalled() does not update the cursor position + // if the selection is cleared because TextInputState changes before the TextSelection change. + Q_ASSERT(text_input_manager_->GetTextInputState()); + m_cursorPosition = text_input_manager_->GetTextInputState()->selection_start; + m_anchorPositionWithinSelection = m_cursorPosition; m_cursorPositionWithinSelection = m_cursorPosition; |