Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
| 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 9c5ce2cd0dc3fec706c09019966b7989d2e25ec5..99129252a9068f36b7fbae015186d99fe7e8403e 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -63,6 +63,7 @@ |
| #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
| #include "ui/accessibility/platform/aura_window_properties.h" |
| +#include "ui/accessibility/platform/ax_fake_caret_win.h" |
|
dmazzoni
2017/03/28 15:41:21
I think this needs to go in the #if defined(OS_WIN
|
| #include "ui/aura/client/aura_constants.h" |
| #include "ui/aura/client/cursor_client.h" |
| #include "ui/aura/client/cursor_client_observer.h" |
| @@ -2338,7 +2339,6 @@ void RenderWidgetHostViewAura::OnSelectionBoundsChanged( |
| void RenderWidgetHostViewAura::OnTextSelectionChanged( |
| TextInputManager* text_input_manager, |
| RenderWidgetHostViewBase* updated_view) { |
| -#if defined(USE_X11) && !defined(OS_CHROMEOS) |
| if (!GetTextInputManager()) |
| return; |
| @@ -2355,6 +2355,7 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( |
| if (!focused_view) |
| return; |
| +#if defined(USE_X11) && !defined(OS_CHROMEOS) |
| const TextInputManager::TextSelection* selection = |
| GetTextInputManager()->GetTextSelection(focused_view); |
| if (selection->selected_text().length()) { |
| @@ -2362,7 +2363,25 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( |
| ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| clipboard_writer.WriteText(selection->selected_text()); |
| } |
| -#endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| + |
| +// #endif defined(USE_X11) && !defined(OS_CHROMEOS) |
| +#elseif defined(OS_WIN) |
| + // Some assistive software need to track the location of the caret. |
| + if (!GetRenderWidgetHost() || |
| + !GetRenderWidgetHost()->GetRootBrowserAccessibilityManager()) |
|
dmazzoni
2017/03/28 15:41:21
Would it be possible to make this code work withou
|
| + return; |
| + |
| + // Not using |GetCaretBounds| because it includes the whole of the selection, |
| + // not just the focus. |
| + const TextInputManager::SelectionRegion* region = |
| + GetTextInputManager()->GetSelectionRegion(focused_view); |
| + if (!region) |
| + return; |
| + gfx::Rect caret_rect = ConvertRectToScreen(gfx::Rect( |
| + region->focus.edge_top_rounded().x(), |
| + region->focus.edge_top_rounded().y(), 1, region->focus.GetHeight())); |
| + ui::AXFakeCaretWin::SetBounds(caret_rect); |
| +#endif // defined(OS_WIN) |
| } |
| void RenderWidgetHostViewAura::SetPopupChild( |