diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 99033272923231..9e15ba1c2ac23f 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -1641,8 +1641,16 @@ gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { // Check selection bound first (currently populated only for EditContext) const std::optional text_selection_bound = text_input_manager_->GetTextSelectionBounds(); - if (text_selection_bound) - return ConvertRectToScreen(text_selection_bound.value()); + if (text_selection_bound) { + const gfx::Rect screen = ConvertRectToScreen(text_selection_bound.value()); + const gfx::Rect view_screen = window_->GetBoundsInScreen(); + LOG(ERROR) << "[POC] RWHVA::GetCaretBounds editcontext_selection(widget)=" + << text_selection_bound->ToString() + << " -> caret(screen)=" << screen.ToString() + << " view_bounds(screen)=" << view_screen.ToString() + << " contained=" << view_screen.Contains(screen); + return screen; + } // If no selection bound, we fall back to use selection region. const TextInputManager::SelectionRegion* region = diff --git a/ui/base/ime/linux/fake_input_method_context.cc b/ui/base/ime/linux/fake_input_method_context.cc index 8b93b12f80b5b6..7279d140c81ea4 100644 --- a/ui/base/ime/linux/fake_input_method_context.cc +++ b/ui/base/ime/linux/fake_input_method_context.cc @@ -4,6 +4,8 @@ #include "ui/base/ime/linux/fake_input_method_context.h" +#include "base/logging.h" + namespace ui { FakeInputMethodContext::FakeInputMethodContext() = default; @@ -27,7 +29,12 @@ void FakeInputMethodContext::UpdateFocus( const TextInputClientAttributes& new_client_attributes, TextInputClient::FocusReason reason) {} -void FakeInputMethodContext::SetCursorLocation(const gfx::Rect& rect) {} +void FakeInputMethodContext::SetCursorLocation(const gfx::Rect& rect) { + LOG(ERROR) << "[POC] LinuxInputMethodContext::SetCursorLocation rect(screen)=" + << rect.ToString() + << " (with a real IBus/Fcitx backend this rect is handed verbatim " + "to gtk_im_context_set_cursor_location / zwp_text_input)"; +} void FakeInputMethodContext::SetSurroundingText( const std::u16string& text, diff --git a/ui/base/ime/linux/input_method_auralinux.cc b/ui/base/ime/linux/input_method_auralinux.cc index 64fabc71077431..f291bca7e267f6 100644 --- a/ui/base/ime/linux/input_method_auralinux.cc +++ b/ui/base/ime/linux/input_method_auralinux.cc @@ -6,6 +6,7 @@ #include "base/auto_reset.h" #include "base/environment.h" +#include "base/logging.h" #include "base/functional/bind.h" #include "base/strings/utf_offset_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -389,7 +390,11 @@ void InputMethodAuraLinux::OnCaretBoundsChanged(const TextInputClient* client) { if (!IsTextInputClientFocused(client)) return; NotifyTextInputCaretBoundsChanged(client); - context_->SetCursorLocation(GetTextInputClient()->GetCaretBounds()); + const gfx::Rect __poc_caret = GetTextInputClient()->GetCaretBounds(); + LOG(ERROR) << "[POC] InputMethodAuraLinux::OnCaretBoundsChanged -> " + "SetCursorLocation rect(screen)=" + << __poc_caret.ToString(); + context_->SetCursorLocation(__poc_caret); gfx::Range text_range, composition_range, selection_range; std::u16string text;