OLD | NEW |
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/browser/accessibility/browser_accessibility_state_impl.h" | 9 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
10 #include "content/common/accessibility_messages.h" | 10 #include "content/common/accessibility_messages.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 // If the node has changed roles, don't reuse a BrowserAccessibility | 350 // If the node has changed roles, don't reuse a BrowserAccessibility |
351 // object, that could confuse a screen reader. | 351 // object, that could confuse a screen reader. |
352 // TODO(dtseng): Investigate when this gets hit; See crbug.com/93095. | 352 // TODO(dtseng): Investigate when this gets hit; See crbug.com/93095. |
353 DCHECK(!instance || instance->role() == src.role); | 353 DCHECK(!instance || instance->role() == src.role); |
354 | 354 |
355 // If we're reusing a node, it should already be detached from a parent | 355 // If we're reusing a node, it should already be detached from a parent |
356 // and any children. If not, that means we have a serious bug somewhere, | 356 // and any children. If not, that means we have a serious bug somewhere, |
357 // like the same child is reachable from two places in the same tree. | 357 // like the same child is reachable from two places in the same tree. |
358 if (instance && (instance->parent() != NULL || instance->child_count() > 0)) { | 358 if (instance && (instance->parent() != NULL || instance->child_count() > 0)) { |
359 NOTREACHED(); | 359 // TODO(dmazzoni): investigate this: http://crbug.com/161726 |
| 360 LOG(WARNING) << "Reusing node that wasn't detached from parent"; |
360 instance = NULL; | 361 instance = NULL; |
361 } | 362 } |
362 | 363 |
363 if (instance) { | 364 if (instance) { |
364 // If we're reusing a node, update its parent and increment its | 365 // If we're reusing a node, update its parent and increment its |
365 // reference count. | 366 // reference count. |
366 instance->UpdateParent(parent, index_in_parent); | 367 instance->UpdateParent(parent, index_in_parent); |
367 instance->InternalAddReference(); | 368 instance->InternalAddReference(); |
368 send_show_events = false; | 369 send_show_events = false; |
369 } else { | 370 } else { |
(...skipping 25 matching lines...) Expand all Loading... |
395 // that subtree. | 396 // that subtree. |
396 if (send_show_events) | 397 if (send_show_events) |
397 NotifyAccessibilityEvent(AccessibilityNotificationObjectShow, instance); | 398 NotifyAccessibilityEvent(AccessibilityNotificationObjectShow, instance); |
398 | 399 |
399 instance->PostInitialize(); | 400 instance->PostInitialize(); |
400 | 401 |
401 return instance; | 402 return instance; |
402 } | 403 } |
403 | 404 |
404 } // namespace content | 405 } // namespace content |
OLD | NEW |