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

Unified Diff: content/browser/renderer_host/legacy_render_widget_host_win.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: content/browser/renderer_host/legacy_render_widget_host_win.cc
diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc
index c619024b9d201e64a4d29ee70c5c3b9c87bf3c5c..af1d083f2fc116d90ea0c2a723765632f97d9e7c 100644
--- a/content/browser/renderer_host/legacy_render_widget_host_win.cc
+++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc
@@ -4,6 +4,8 @@
#include "content/browser/renderer_host/legacy_render_widget_host_win.h"
+#include <atlcom.h>
+
#include <memory>
#include "base/command_line.h"
@@ -15,6 +17,7 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "content/public/common/content_switches.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/window_event_target.h"
@@ -170,24 +173,31 @@ LRESULT LegacyRenderWidgetHostHWND::OnGetObject(UINT message,
return static_cast<LRESULT>(0L);
}
- if (static_cast<DWORD>(OBJID_CLIENT) != obj_id || !host_)
- return static_cast<LRESULT>(0L);
-
- RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(
- host_->GetRenderWidgetHost());
- if (!rwhi)
- return static_cast<LRESULT>(0L);
-
- BrowserAccessibilityManagerWin* manager =
- static_cast<BrowserAccessibilityManagerWin*>(
- rwhi->GetRootBrowserAccessibilityManager());
- if (!manager)
- return static_cast<LRESULT>(0L);
+ if (static_cast<DWORD>(OBJID_CLIENT) == obj_id && host_) {
+ RenderWidgetHostImpl* rwhi =
+ RenderWidgetHostImpl::From(host_->GetRenderWidgetHost());
+ if (!rwhi)
+ return static_cast<LRESULT>(0L);
+
+ BrowserAccessibilityManagerWin* manager =
+ static_cast<BrowserAccessibilityManagerWin*>(
+ rwhi->GetRootBrowserAccessibilityManager());
+ if (!manager)
+ return static_cast<LRESULT>(0L);
+
+ base::win::ScopedComPtr<IAccessible> root(
+ ToBrowserAccessibilityWin(manager->GetRoot()));
+ return LresultFromObject(IID_IAccessible, w_param,
+ static_cast<IAccessible*>(root.Detach()));
+ } else if (static_cast<DWORD>(OBJID_CARET) == obj_id) {
dougt 2017/03/28 15:23:44 nit: the above if-stmt returns making the followi
+ // 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);
dougt 2017/03/28 15:23:44 I am confused by this DCHECK. Are you concerned wi
+ return LresultFromObject(IID_IAccessible, w_param,
+ static_cast<IAccessible*>(&fake_caret));
+ }
- base::win::ScopedComPtr<IAccessible> root(
- ToBrowserAccessibilityWin(manager->GetRoot()));
- return LresultFromObject(IID_IAccessible, w_param,
- static_cast<IAccessible*>(root.Detach()));
+ return static_cast<LRESULT>(0L);
}
// We send keyboard/mouse/touch messages to the parent window via SendMessage.

Powered by Google App Engine
This is Rietveld 408576698