diff options
author | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-19 09:23:41 +0000 |
---|---|---|
committer | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-19 09:23:41 +0000 |
commit | 81acd9115dc0c46bdf8615d300ecfa00c335806c (patch) | |
tree | f5a513475da1e8d17e7d6f077a5192c393d55e66 | |
parent | b5cd1624d02facb14809a3385d773209ccb932fd (diff) | |
download | chromium_src-81acd9115dc0c46bdf8615d300ecfa00c335806c.zip chromium_src-81acd9115dc0c46bdf8615d300ecfa00c335806c.tar.gz chromium_src-81acd9115dc0c46bdf8615d300ecfa00c335806c.tar.bz2 |
Revert 82076 - Fix handling of a case where an AccessibilityObject is listed as a child multiple times.BUG=79726TEST=browser_tests:RendererAccessibilityBrowserTest.CrossPlatformDuplicateChildrenAccessibilityReview URL: http://codereview.chromium.org/6873063
TBR=ctguil@chromium.org
Review URL: http://codereview.chromium.org/6880029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82085 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/accessibility/renderer_accessibility_browsertest.cc | 25 | ||||
-rw-r--r-- | webkit/glue/webaccessibility.cc | 13 |
2 files changed, 1 insertions, 37 deletions
diff --git a/chrome/browser/accessibility/renderer_accessibility_browsertest.cc b/chrome/browser/accessibility/renderer_accessibility_browsertest.cc index 93107cb..2944d43 100644 --- a/chrome/browser/accessibility/renderer_accessibility_browsertest.cc +++ b/chrome/browser/accessibility/renderer_accessibility_browsertest.cc @@ -317,29 +317,4 @@ IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, EXPECT_STREQ("Button 3", UTF16ToUTF8(button3.name).c_str()); } -IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, - CrossPlatformDuplicateChildrenAccessibility) { - // Here's another html snippet where WebKit has a parent node containing - // two duplicate child nodes. Instead of checking the exact output, just - // make sure that no id is reused in the resulting tree. - const char url_str[] = - "data:text/html," - "<!doctype html>" - "<script>" - " document.write('');" - " document.close();" - " setTimeout(function () {" - " document.write('<DT><em><sr><code ><h4 ></em><<');" - " document.close();" - " setTimeout('location.reload()', 0);" - " }, 0);" - "</script>"; - GURL url(url_str); - browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED); - - const WebAccessibility& tree = GetWebAccessibilityTree(); - base::hash_set<int> ids; - RecursiveAssertUniqueIds(tree, &ids); -} - } // namespace diff --git a/webkit/glue/webaccessibility.cc b/webkit/glue/webaccessibility.cc index 7992fe8..aef31e4 100644 --- a/webkit/glue/webaccessibility.cc +++ b/webkit/glue/webaccessibility.cc @@ -4,8 +4,6 @@ #include "webkit/glue/webaccessibility.h" -#include <set> - #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -389,10 +387,8 @@ 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. @@ -401,13 +397,6 @@ 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. - // TODO(ctguil): File webkit bug to track this issue. - 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 @@ -419,7 +408,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(child_id); + indirect_child_ids.push_back(cache->addOrGetId(child)); } } } |