diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 22:43:51 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 22:43:51 +0000 |
commit | 26aef306d96f8126e95787f40dae07282562ed65 (patch) | |
tree | 205c7feade5fa6fbcba3e9234e2a53f65f96d4c6 /content/browser/accessibility | |
parent | ab254696bbf9608710cb64e432457dbb4bf1ef63 (diff) | |
download | chromium_src-26aef306d96f8126e95787f40dae07282562ed65.zip chromium_src-26aef306d96f8126e95787f40dae07282562ed65.tar.gz chromium_src-26aef306d96f8126e95787f40dae07282562ed65.tar.bz2 |
Fix staleness in Mac accessibility tree.
After r186553, the browser accessibility tree updates more nodes
in place. This exposed a latent bug, which is that
BrowserAccessibilityCocoa was caching its children vector and not
refreshing it when the node's children changed. This change fixes it
so that any change to BrowserAccessibility's children results in
refreshing BrowserAccessibilityCocoa's children too.
Also fixes a mistake in the switch statement mapping Mac notifications.
BUG=none
TBR=dtseng
Review URL: https://chromiumcodereview.appspot.com/12719008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188221 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/accessibility')
5 files changed, 10 insertions, 8 deletions
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc index 84913a6..69ddddb9 100644 --- a/content/browser/accessibility/browser_accessibility.cc +++ b/content/browser/accessibility/browser_accessibility.cc @@ -89,10 +89,6 @@ bool BrowserAccessibility::IsNative() const { return false; } -void BrowserAccessibility::AddChild(BrowserAccessibility* child) { - children_.push_back(child); -} - void BrowserAccessibility::SwapChildren( std::vector<BrowserAccessibility*>& children) { children.swap(children_); diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h index ee74077..62fff55 100644 --- a/content/browser/accessibility/browser_accessibility.h +++ b/content/browser/accessibility/browser_accessibility.h @@ -77,10 +77,7 @@ class CONTENT_EXPORT BrowserAccessibility { // Initialize this object's data. void InitializeData(const AccessibilityNodeData& src); - // Add a child of this object. - void AddChild(BrowserAccessibility* child); - - void SwapChildren(std::vector<BrowserAccessibility*>& children); + virtual void SwapChildren(std::vector<BrowserAccessibility*>& children); // Update the parent and index in parent if this node has been moved. void UpdateParent(BrowserAccessibility* parent, int index_in_parent); diff --git a/content/browser/accessibility/browser_accessibility_mac.h b/content/browser/accessibility/browser_accessibility_mac.h index 10d2add..a3df865 100644 --- a/content/browser/accessibility/browser_accessibility_mac.h +++ b/content/browser/accessibility/browser_accessibility_mac.h @@ -25,6 +25,8 @@ class BrowserAccessibilityMac : public BrowserAccessibility { // Overrides from BrowserAccessibility. virtual void DetachTree(std::vector<BrowserAccessibility*>* nodes) OVERRIDE; + virtual void SwapChildren(std::vector<BrowserAccessibility*>& children) + OVERRIDE; // The BrowserAccessibilityCocoa associated with us. BrowserAccessibilityCocoa* native_view() const { diff --git a/content/browser/accessibility/browser_accessibility_mac.mm b/content/browser/accessibility/browser_accessibility_mac.mm index 7cb9d05..9d049b5 100644 --- a/content/browser/accessibility/browser_accessibility_mac.mm +++ b/content/browser/accessibility/browser_accessibility_mac.mm @@ -58,6 +58,12 @@ void BrowserAccessibilityMac::DetachTree( BrowserAccessibility::DetachTree(nodes); } +void BrowserAccessibilityMac::SwapChildren( + std::vector<BrowserAccessibility*>& children) { + [browser_accessibility_cocoa_ childrenChanged]; + BrowserAccessibility::SwapChildren(children); +} + BrowserAccessibilityCocoa* BrowserAccessibility::ToBrowserAccessibilityCocoa() { return static_cast<BrowserAccessibilityMac*>(this)-> native_view(); diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm index 2a4b254..06d380a 100644 --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm @@ -42,6 +42,7 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( event_id = NSAccessibilitySelectedRowsChangedNotification; else event_id = NSAccessibilityFocusedUIElementChangedNotification; + break; case AccessibilityNotificationAlert: // Not used on Mac. return; |