summaryrefslogtreecommitdiffstats
path: root/content/browser/accessibility/browser_accessibility_manager_win.cc
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-25 01:14:45 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-25 01:14:45 +0000
commit3144b899bb8629e4eca7c2f4667f2b6fa7c62499 (patch)
tree52cb8c8da81c8393b9d18c834e388ca3beab6e8b /content/browser/accessibility/browser_accessibility_manager_win.cc
parentf0739527baf1af66ee8238ae7294a24ebb01a729 (diff)
downloadchromium_src-3144b899bb8629e4eca7c2f4667f2b6fa7c62499.zip
chromium_src-3144b899bb8629e4eca7c2f4667f2b6fa7c62499.tar.gz
chromium_src-3144b899bb8629e4eca7c2f4667f2b6fa7c62499.tar.bz2
Allow the IAccessible parent to be known late in the game.
In the case of a tab loading in the background, accessibility notifications may arrive from the renderer before the tab's WebContents is added to a WebView. In this case, the accessible parent isn't yet known. Handle this case by allowing the RWHVA's BrowserAccessibilityManager to be created without an accessible parent and then receive that parent (from a WebContentsImpl) when the WebContents is finally attached to a WebView. BUG=242524 R=dmazzoni@chromium.org Review URL: https://chromiumcodereview.appspot.com/15744014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/accessibility/browser_accessibility_manager_win.cc')
-rw-r--r--content/browser/accessibility/browser_accessibility_manager_win.cc26
1 files changed, 15 insertions, 11 deletions
diff --git a/content/browser/accessibility/browser_accessibility_manager_win.cc b/content/browser/accessibility/browser_accessibility_manager_win.cc
index 33e4614..b956d21 100644
--- a/content/browser/accessibility/browser_accessibility_manager_win.cc
+++ b/content/browser/accessibility/browser_accessibility_manager_win.cc
@@ -53,6 +53,12 @@ AccessibilityNodeData BrowserAccessibilityManagerWin::GetEmptyDocument() {
return empty_document;
}
+void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event,
+ LONG child_id) {
+ if (parent_iaccessible())
+ ::NotifyWinEvent(event, parent_hwnd(), OBJID_CLIENT, child_id);
+}
+
void BrowserAccessibilityManagerWin::AddNodeToMap(BrowserAccessibility* node) {
BrowserAccessibilityManager::AddNodeToMap(node);
LONG unique_id_win = node->ToBrowserAccessibilityWin()->unique_id_win();
@@ -151,14 +157,14 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
break;
}
- // Pass the node's unique id in the |child_id| argument to NotifyWinEvent;
- // the AT client will then call get_accChild on the HWND's accessibility
- // object and pass it that same id, which we can use to retrieve the
- // IAccessible for this node.
- LONG child_id = node->ToBrowserAccessibilityWin()->unique_id_win();
-
- if (event_id != EVENT_MIN)
- NotifyWinEvent(event_id, parent_hwnd(), OBJID_CLIENT, child_id);
+ if (event_id != EVENT_MIN) {
+ // Pass the node's unique id in the |child_id| argument to NotifyWinEvent;
+ // the AT client will then call get_accChild on the HWND's accessibility
+ // object and pass it that same id, which we can use to retrieve the
+ // IAccessible for this node.
+ LONG child_id = node->ToBrowserAccessibilityWin()->unique_id_win();
+ MaybeCallNotifyWinEvent(event_id, child_id);
+ }
// If this is a layout complete notification (sent when a container scrolls)
// and there is a descendant tracked object, send a notification on it.
@@ -166,10 +172,8 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
if (type == AccessibilityNotificationLayoutComplete &&
tracked_scroll_object_ &&
tracked_scroll_object_->IsDescendantOf(node)) {
- NotifyWinEvent(
+ MaybeCallNotifyWinEvent(
IA2_EVENT_VISIBLE_DATA_CHANGED,
- parent_hwnd(),
- OBJID_CLIENT,
tracked_scroll_object_->ToBrowserAccessibilityWin()->unique_id_win());
tracked_scroll_object_->Release();
tracked_scroll_object_ = NULL;