summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/render_widget_host_view_qt.cpp20
-rw-r--r--src/core/render_widget_host_view_qt.h2
-rw-r--r--src/core/render_widget_host_view_qt_delegate.h2
3 files changed, 20 insertions, 4 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();
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 63efad87e..0db5df862 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -270,6 +270,8 @@ private:
uint m_cursorPosition;
bool m_emptyPreviousSelection;
QString m_surroundingText;
+
+ bool m_imeHasHiddenTextCapability;
};
} // namespace QtWebEngineCore
diff --git a/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h
index 7461e7608..a126410ed 100644
--- a/src/core/render_widget_host_view_qt_delegate.h
+++ b/src/core/render_widget_host_view_qt_delegate.h
@@ -106,7 +106,7 @@ public:
virtual void updateCursor(const QCursor &) = 0;
virtual void resize(int width, int height) = 0;
virtual void move(const QPoint &) = 0;
- virtual void inputMethodStateChanged(bool editorVisible) = 0;
+ virtual void inputMethodStateChanged(bool editorVisible, bool passwordInput) = 0;
virtual void setInputMethodHints(Qt::InputMethodHints hints) = 0;
virtual void setClearColor(const QColor &color) = 0;
};