diff options
Diffstat (limited to 'content/browser/accessibility')
3 files changed, 19 insertions, 3 deletions
diff --git a/content/browser/accessibility/browser_accessibility_manager_win.cc b/content/browser/accessibility/browser_accessibility_manager_win.cc index 9aa5d4a..974b033 100644 --- a/content/browser/accessibility/browser_accessibility_manager_win.cc +++ b/content/browser/accessibility/browser_accessibility_manager_win.cc @@ -37,12 +37,14 @@ BrowserAccessibilityManagerWin::BrowserAccessibilityManagerWin( BrowserAccessibilityDelegate* delegate, BrowserAccessibilityFactory* factory) : BrowserAccessibilityManager(initial_tree, delegate, factory), - parent_hwnd_(accessible_hwnd->GetParent()), parent_iaccessible_(parent_iaccessible), tracked_scroll_object_(NULL), accessible_hwnd_(accessible_hwnd) { ui::win::CreateATLModuleIfNeeded(); - accessible_hwnd_->set_browser_accessibility_manager(this); + if (accessible_hwnd_) { + accessible_hwnd_->set_browser_accessibility_manager(this); + parent_hwnd_ = accessible_hwnd->GetParent(); + } } BrowserAccessibilityManagerWin::~BrowserAccessibilityManagerWin() { @@ -69,10 +71,17 @@ ui::AXTreeUpdate BrowserAccessibilityManagerWin::GetEmptyDocument() { return update; } +void BrowserAccessibilityManagerWin::SetAccessibleHWND( + LegacyRenderWidgetHostHWND* accessible_hwnd) { + accessible_hwnd_ = accessible_hwnd; + accessible_hwnd_->set_browser_accessibility_manager(this); + parent_hwnd_ = accessible_hwnd->GetParent(); +} + void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event, LONG child_id) { // Don't fire events if this view isn't hooked up to its parent. - if (!parent_iaccessible()) + if (!parent_iaccessible() || !parent_hwnd()) return; // If on Win 7 and complete accessibility is enabled, use the fake child HWND diff --git a/content/browser/accessibility/browser_accessibility_manager_win.h b/content/browser/accessibility/browser_accessibility_manager_win.h index 18260e4..90914db 100644 --- a/content/browser/accessibility/browser_accessibility_manager_win.h +++ b/content/browser/accessibility/browser_accessibility_manager_win.h @@ -40,6 +40,8 @@ class CONTENT_EXPORT BrowserAccessibilityManagerWin parent_iaccessible_ = parent_iaccessible; } + void SetAccessibleHWND(LegacyRenderWidgetHostHWND* accessible_hwnd); + // Calls NotifyWinEvent if the parent window's IAccessible pointer is known. void MaybeCallNotifyWinEvent(DWORD event, LONG child_id); diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc index e98ae71..60728e0 100644 --- a/content/browser/accessibility/browser_accessibility_win.cc +++ b/content/browser/accessibility/browser_accessibility_win.cc @@ -739,6 +739,9 @@ STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) { return E_INVALIDARG; *window_handle = manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd(); + if (!*window_handle) + return E_FAIL; + return S_OK; } @@ -992,6 +995,8 @@ STDMETHODIMP BrowserAccessibilityWin::get_imagePosition( if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { HWND parent_hwnd = manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd(); + if (!parent_hwnd) + return E_FAIL; POINT top_left = {0, 0}; ::ClientToScreen(parent_hwnd, &top_left); *x = GetLocation().x() + top_left.x; |