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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager.cc

Issue 21269002: Make AccessibilityNodeData more compact. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win test Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility_manager.h" 5 #include "content/browser/accessibility/browser_accessibility_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/accessibility/browser_accessibility.h" 8 #include "content/browser/accessibility/browser_accessibility.h"
9 #include "content/common/accessibility_messages.h" 9 #include "content/common/accessibility_messages.h"
10 10
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // Look up the node by id. If it's not found, then either the root 331 // Look up the node by id. If it's not found, then either the root
332 // of the tree is being swapped, or we're out of sync with the renderer 332 // of the tree is being swapped, or we're out of sync with the renderer
333 // and this is a serious error. 333 // and this is a serious error.
334 BrowserAccessibility* instance = GetFromRendererID(src.id); 334 BrowserAccessibility* instance = GetFromRendererID(src.id);
335 if (!instance) { 335 if (!instance) {
336 if (src.role != AccessibilityNodeData::ROLE_ROOT_WEB_AREA) 336 if (src.role != AccessibilityNodeData::ROLE_ROOT_WEB_AREA)
337 return false; 337 return false;
338 instance = CreateNode(NULL, src.id, 0); 338 instance = CreateNode(NULL, src.id, 0);
339 } 339 }
340 340
341 if (src.bool_attributes.find( 341 // TODO(dmazzoni): avoid a linear scan here.
342 AccessibilityNodeData::ATTR_UPDATE_LOCATION_ONLY) != 342 for (size_t i = 0; i < src.bool_attributes.size(); i++) {
343 src.bool_attributes.end()) { 343 if (src.bool_attributes[i].first ==
344 instance->SetLocation(src.location); 344 AccessibilityNodeData::ATTR_UPDATE_LOCATION_ONLY) {
345 return true; 345 instance->SetLocation(src.location);
346 return true;
347 }
346 } 348 }
347 349
348 // Update all of the node-specific data, like its role, state, name, etc. 350 // Update all of the node-specific data, like its role, state, name, etc.
349 instance->InitializeData(src); 351 instance->InitializeData(src);
350 352
351 // 353 //
352 // Update the children in three steps: 354 // Update the children in three steps:
353 // 355 //
354 // 1. Iterate over the old children and delete nodes that are no longer 356 // 1. Iterate over the old children and delete nodes that are no longer
355 // in the tree. 357 // in the tree.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 // Keep track of what node is focused. 412 // Keep track of what node is focused.
411 if (src.role != AccessibilityNodeData::ROLE_ROOT_WEB_AREA && 413 if (src.role != AccessibilityNodeData::ROLE_ROOT_WEB_AREA &&
412 src.role != AccessibilityNodeData::ROLE_WEB_AREA && 414 src.role != AccessibilityNodeData::ROLE_WEB_AREA &&
413 (src.state >> AccessibilityNodeData::STATE_FOCUSED & 1)) { 415 (src.state >> AccessibilityNodeData::STATE_FOCUSED & 1)) {
414 SetFocus(instance, false); 416 SetFocus(instance, false);
415 } 417 }
416 return success; 418 return success;
417 } 419 }
418 420
419 } // namespace content 421 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698