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 1dbcea22c11137511a37a9d744ab15e6b0b1e8ff..a037be36e3f44b07b4cbc2240c271a4476c931a2 100644 |
--- a/ui/views/win/hwnd_message_handler.cc |
+++ b/ui/views/win/hwnd_message_handler.cc |
@@ -4,6 +4,8 @@ |
#include "ui/views/win/hwnd_message_handler.h" |
+#include <atlbase.h> |
+#include <atlcom.h> |
#include <dwmapi.h> |
#include <oleacc.h> |
#include <shellapi.h> |
@@ -22,6 +24,7 @@ |
#include "base/trace_event/trace_event.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/base/view_prop.h" |
#include "ui/base/win/internal_constants.h" |
#include "ui/base/win/lock_state.h" |
@@ -1510,10 +1513,14 @@ 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. |
+ CComObjectStack<ui::AXFakeCaretWin> fake_caret; |
+ DCHECK_EQ(fake_caret.m_hResFinalConstruct, S_OK); |
+ reference_result = LresultFromObject( |
+ IID_IAccessible, w_param, static_cast<IAccessible*>(&fake_caret)); |
} |
return reference_result; |