diff options
author | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 10:16:06 +0000 |
---|---|---|
committer | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 10:16:06 +0000 |
commit | 55cb9d5693f8b8e9ebac337d55c2dcab4cd27dd0 (patch) | |
tree | 7dd1f3046822169f8c8aad1a632a418b2286ab2c /webkit/glue/webaccessibility.cc | |
parent | de23076e49e26a331f9154e733bb545c20170f99 (diff) | |
download | chromium_src-55cb9d5693f8b8e9ebac337d55c2dcab4cd27dd0.zip chromium_src-55cb9d5693f8b8e9ebac337d55c2dcab4cd27dd0.tar.gz chromium_src-55cb9d5693f8b8e9ebac337d55c2dcab4cd27dd0.tar.bz2 |
Revert 82261 - Revert 82256 - unit_tests failures were unrelated - Fix handling of a case where an AccessibilityObject is listed as a child multiple times.BUG=79726TEST=browser_tests:RendererAccessibilityBrowserTest.CrossPlatformDuplicateChildrenAccessibilityCommitted: http://src.chromium.org/viewvc/chrome?view=rev&revision=82076Review URL: http://codereview.chromium.org/6873063TBR=ctguil@chromium.orgReview URL: http://codereview.chromium.org/6877076
TBR=ctguil@chromium.org
Review URL: http://codereview.chromium.org/6873108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82278 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webaccessibility.cc')
-rw-r--r-- | webkit/glue/webaccessibility.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/webkit/glue/webaccessibility.cc b/webkit/glue/webaccessibility.cc index aef31e4..615aeda 100644 --- a/webkit/glue/webaccessibility.cc +++ b/webkit/glue/webaccessibility.cc @@ -4,6 +4,8 @@ #include "webkit/glue/webaccessibility.h" +#include <set> + #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -387,8 +389,10 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src, if (include_children) { // Recursively create children. int child_count = src.childCount(); + std::set<int32> child_ids; for (int i = 0; i < child_count; i++) { WebAccessibilityObject child = src.childAt(i); + int32 child_id = cache->addOrGetId(child); // The child may be invalid due to issues in webkit accessibility code. // Don't add children that are invalid thus preventing a crash. @@ -397,6 +401,13 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src, if (!child.isValid()) continue; + // Children may duplicated in the webkit accessibility tree. Only add a + // child once for the web accessibility tree. + // https://bugs.webkit.org/show_bug.cgi?id=58930 + if (child_ids.find(child_id) != child_ids.end()) + continue; + child_ids.insert(child_id); + // Some nodes appear in the tree in more than one place: for example, // a cell in a table appears as a child of both a row and a column. // Only recursively add child nodes that have this node as its @@ -408,7 +419,7 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src, if (is_iframe || IsParentUnignoredOf(src, child)) { children.push_back(WebAccessibility(child, cache, include_children)); } else { - indirect_child_ids.push_back(cache->addOrGetId(child)); + indirect_child_ids.push_back(child_id); } } } |