diff options
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 136371a91..655871c9c 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -77,6 +77,9 @@ #include "ui/base/cursor/cursors_aura.h" #endif +#include <private/qguiapplication_p.h> +#include <qpa/qplatforminputcontext.h> +#include <qpa/qplatformintegration.h> #include <QEvent> #include <QFocusEvent> #include <QGuiApplication> @@ -292,6 +295,9 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget if (GetTextInputManager()) GetTextInputManager()->AddObserver(this); + + const QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext(); + m_imeHasHiddenTextCapability = context && context->hasCapability(QPlatformInputContext::HiddenTextCapability); } RenderWidgetHostViewQt::~RenderWidgetHostViewQt() @@ -735,7 +741,7 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana Q_UNUSED(did_update_state); ui::TextInputType type = getTextInputType(); - m_delegate->inputMethodStateChanged(type != ui::TEXT_INPUT_TYPE_NONE); + m_delegate->inputMethodStateChanged(type != ui::TEXT_INPUT_TYPE_NONE, type == ui::TEXT_INPUT_TYPE_PASSWORD); m_delegate->setInputMethodHints(toQtInputMethodHints(type)); const content::TextInputState *state = text_input_manager_->GetTextInputState(); @@ -973,8 +979,16 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query) { switch (query) { - case Qt::ImEnabled: - return QVariant(getTextInputType() != ui::TEXT_INPUT_TYPE_NONE); + case Qt::ImEnabled: { + ui::TextInputType type = getTextInputType(); + bool editorVisible = type != ui::TEXT_INPUT_TYPE_NONE; + // IME manager should disable composition on input fields with ImhHiddenText hint if supported + if (m_imeHasHiddenTextCapability) + return QVariant(editorVisible); + + bool passwordInput = type == ui::TEXT_INPUT_TYPE_PASSWORD; + return QVariant(editorVisible && !passwordInput); + } case Qt::ImFont: // TODO: Implement this return QVariant(); |