Index: ui/views/win/hwnd_message_handler.cc |
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc |
index 94ba71385f4323bd06674ea29a4fb9beabdf41cf..74c92cf9d5f8a380ed0cb4e29c78d3e60c661f18 100644 |
--- a/ui/views/win/hwnd_message_handler.cc |
+++ b/ui/views/win/hwnd_message_handler.cc |
@@ -20,8 +20,11 @@ |
#include "base/threading/thread_task_runner_handle.h" |
#include "base/time/time.h" |
#include "base/trace_event/trace_event.h" |
+#include "base/win/scoped_comptr.h" |
#include "base/win/scoped_gdi_object.h" |
#include "base/win/windows_version.h" |
+#include "ui/accessibility/platform/ax_fake_caret_win.h" |
+#include "ui/accessibility/platform/ax_platform_node_win.h" |
#include "ui/base/view_prop.h" |
#include "ui/base/win/internal_constants.h" |
#include "ui/base/win/lock_state.h" |
@@ -1521,10 +1524,16 @@ LRESULT HWNDMessageHandler::OnGetObject(UINT message, |
// Retrieve MSAA dispatch object for the root view. |
base::win::ScopedComPtr<IAccessible> root( |
delegate_->GetNativeViewAccessible()); |
- |
- // Create a reference that MSAA will marshall to the client. |
reference_result = LresultFromObject(IID_IAccessible, w_param, |
static_cast<IAccessible*>(root.Detach())); |
+ } else if (static_cast<DWORD>(OBJID_CARET) == obj_id) { |
+ // Used by some assistive software to retrieve the location of the caret. |
+ ui::AXFakeCaretWin* fake_caret = ui::g_ax_fake_caret_win.Pointer(); |
+ DCHECK(fake_caret); |
+ base::win::ScopedComPtr<IAccessible> fake_caret_accessible = |
+ fake_caret->GetCaret(); |
+ reference_result = LresultFromObject(IID_IAccessible, w_param, |
+ fake_caret_accessible.Detach()); |
} |
return reference_result; |