summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2018-05-24 12:19:56 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2018-07-19 07:30:32 +0000
commitfeed8bf3d12bb4050a7b10d2b4d4608021d52959 (patch)
tree399b9af8c31783709fc0726d30a7bd87242681e9 /src/core/render_widget_host_view_qt.cpp
parent4b7bcec6c80ae7b4ecf433b6d7b87abb0f387be7 (diff)
Return invalid ImCursorRectangle when height is zero
The test tst_QWebEngineView::microFocusCoordinates is flaky due to a timing issue where TextInputManager::GetSelectionRegion() returns a selection rectangle with zero height if called too soon after the HTMLElement.focus() call. Change-Id: Iba52eadd6c2d4f9027284fedbff40c3fcc951a28 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 695e9cc74..9424b2ae4 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -1140,10 +1140,12 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query)
case Qt::ImCursorRectangle: {
if (text_input_manager_) {
if (auto *region = text_input_manager_->GetSelectionRegion()) {
- gfx::Rect caretRect = gfx::RectBetweenSelectionBounds(region->anchor, region->focus);
- if (caretRect.width() == 0)
- caretRect.set_width(1); // IME API on Windows expects a width > 0
- return toQt(caretRect);
+ if (region->focus.GetHeight() > 0) {
+ gfx::Rect caretRect = gfx::RectBetweenSelectionBounds(region->anchor, region->focus);
+ if (caretRect.width() == 0)
+ caretRect.set_width(1); // IME API on Windows expects a width > 0
+ return toQt(caretRect);
+ }
}
}
return QVariant();