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

Side by Side Diff: webkit/glue/webaccessibilitymanager_impl.cc

Issue 118206: Fixes an issue where the MSAA information was not reported back correctly to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webaccessibilitymanager_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "AXObjectCache.h" 7 #include "AXObjectCache.h"
8 #include "Document.h" 8 #include "Document.h"
9 #include "Frame.h" 9 #include "Frame.h"
10 #include "RefPtr.h" 10 #include "RefPtr.h"
(...skipping 17 matching lines...) Expand all
28 }; 28 };
29 29
30 /*static*/ 30 /*static*/
31 WebAccessibilityManager* WebAccessibilityManager::Create() { 31 WebAccessibilityManager* WebAccessibilityManager::Create() {
32 return new WebAccessibilityManagerImpl(); 32 return new WebAccessibilityManagerImpl();
33 } 33 }
34 34
35 // class WebAccessibilityManagerImpl 35 // class WebAccessibilityManagerImpl
36 WebAccessibilityManagerImpl::WebAccessibilityManagerImpl() 36 WebAccessibilityManagerImpl::WebAccessibilityManagerImpl()
37 : root_(new GlueAccessibilityObjectRoot), 37 : root_(new GlueAccessibilityObjectRoot),
38 acc_obj_id_(0) { 38 acc_obj_id_(1000) {
39 } 39 }
40 40
41 WebAccessibilityManagerImpl::~WebAccessibilityManagerImpl() { 41 WebAccessibilityManagerImpl::~WebAccessibilityManagerImpl() {
42 int_to_glue_acc_obj_map_.clear(); 42 int_to_glue_acc_obj_map_.clear();
43 acc_obj_to_int_map_.clear(); 43 acc_obj_to_int_map_.clear();
44 } 44 }
45 45
46 bool WebAccessibilityManagerImpl::GetAccObjInfo(WebView* view, 46 bool WebAccessibilityManagerImpl::GetAccObjInfo(WebView* view,
47 const WebAccessibility::InParams& in_params, 47 const WebAccessibility::InParams& in_params,
48 WebAccessibility::OutParams* out_params) { 48 WebAccessibility::OutParams* out_params) {
49 if (!root_->acc_obj_root_ && !InitAccObjRoot(view)) { 49 if (!root_->acc_obj_root_ && !InitAccObjRoot(view)) {
50 // Failure in retrieving or initializing the root. 50 // Failure in retrieving or initializing the root.
51 return false; 51 return false;
52 } 52 }
53 53
54 // Function input parameters. 54 // Function input parameters.
55 int object_id = in_params.object_id; 55 int object_id = in_params.object_id;
56 int child_id = in_params.child_id; 56 int child_id = in_params.child_id;
57 57
58 if (!in_params.direct_descendant) { 58 // Since ids assigned by Chrome starts at 1000, whereas platform-specific ids
59 // used to reference a child will be in a wholly different range, we know
60 // that any id that high should be treated as a non-direct descendant.
61 if (in_params.child_id >= 1000) {
59 // Object is not a direct child, re-map the input parameters accordingly. 62 // Object is not a direct child, re-map the input parameters accordingly.
60 // The object to be retrieved is referred to by the |in_params.child_id|, as 63 // The object to be retrieved is referred to by the |in_params.child_id|, as
61 // a result of e.g. a focus event. The local |child_id| is set to 0, to 64 // a result of e.g. a focus event. The local |child_id| is set to 0, to
62 // indicate that any function call should refer to the object itself. 65 // indicate that any function call should refer to the object itself.
63 object_id = in_params.child_id; 66 object_id = in_params.child_id;
64 child_id = 0; 67 child_id = 0;
65 } 68 }
66 69
67 // Find GlueAccessibilityObject requested by |object_id|. 70 // Find GlueAccessibilityObject requested by |object_id|.
68 IntToGlueAccObjMap::iterator it = 71 IntToGlueAccObjMap::iterator it =
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (it->second) { 243 if (it->second) {
241 // Erase element from reverse hashmap. 244 // Erase element from reverse hashmap.
242 AccObjToIntMap::iterator it2 = 245 AccObjToIntMap::iterator it2 =
243 acc_obj_to_int_map_.find(it->second->accessibilityObject()); 246 acc_obj_to_int_map_.find(it->second->accessibilityObject());
244 247
245 if (it2 != acc_obj_to_int_map_.end()) 248 if (it2 != acc_obj_to_int_map_.end())
246 acc_obj_to_int_map_.erase(it2); 249 acc_obj_to_int_map_.erase(it2);
247 } 250 }
248 int_to_glue_acc_obj_map_.erase(it); 251 int_to_glue_acc_obj_map_.erase(it);
249 252
250 if (acc_obj_id == 0) { 253 if (acc_obj_id == 1000) {
251 // Invalidate root. 254 // Invalidate root.
252 root_->acc_obj_root_ = 0; 255 root_->acc_obj_root_ = 0;
253 } 256 }
254 return true; 257 return true;
255 } 258 }
256 259
257 int WebAccessibilityManagerImpl::FocusAccObj( 260 int WebAccessibilityManagerImpl::FocusAccObj(
258 WebCore::AccessibilityObject* acc_obj) { 261 WebCore::AccessibilityObject* acc_obj) {
259 if (!acc_obj) { 262 if (!acc_obj) {
260 // Return with failure. 263 // Return with failure.
261 return -1; 264 return -1;
262 } 265 }
263 266
264 AccObjToIntMap::iterator it = acc_obj_to_int_map_.find(acc_obj); 267 AccObjToIntMap::iterator it = acc_obj_to_int_map_.find(acc_obj);
265 268
266 if (it != acc_obj_to_int_map_.end()) 269 if (it != acc_obj_to_int_map_.end())
267 return it->second; 270 return it->second;
268 271
269 // Insert new accessibility object in hashmaps and return its newly 272 // Insert new accessibility object in hashmaps and return its newly
270 // assigned accessibility object id. 273 // assigned accessibility object id.
271 int_to_glue_acc_obj_map_[acc_obj_id_] = 274 int_to_glue_acc_obj_map_[acc_obj_id_] =
272 GlueAccessibilityObject::CreateInstance(acc_obj); 275 GlueAccessibilityObject::CreateInstance(acc_obj);
273 acc_obj_to_int_map_[acc_obj] = acc_obj_id_; 276 acc_obj_to_int_map_[acc_obj] = acc_obj_id_;
274 277
275 return acc_obj_id_++; 278 return acc_obj_id_++;
276 } 279 }
277 280
278 } // namespace webkit_glue 281 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webaccessibilitymanager_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698