Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 2781613003: Added a class acting as a fake caret for accessibility. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698