diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 14:30:33 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 14:30:33 +0000 |
commit | c7621b85536ad0e53f55572d94f84aff23a4bb67 (patch) | |
tree | d08a58430bdbffc71987cd77a7751554d3c9260a /webkit/glue | |
parent | 135d522e066bf23b89d1adf5b2a2cde7fef07dff (diff) | |
download | chromium_src-c7621b85536ad0e53f55572d94f84aff23a4bb67.zip chromium_src-c7621b85536ad0e53f55572d94f84aff23a4bb67.tar.gz chromium_src-c7621b85536ad0e53f55572d94f84aff23a4bb67.tar.bz2 |
Fix handling of case where the same AccessibilityObject appears as a
child of more than one parent. Add some additional DCHECKs so that such
a problem would be caught even earlier if they were to reoccur.
BUG=75496
TEST=Addes new browser test CrossPlatformMultipleInheritanceAccessibility2
Review URL: http://codereview.chromium.org/6683010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webaccessibility.cc | 12 | ||||
-rw-r--r-- | webkit/glue/webaccessibility.h | 9 |
2 files changed, 12 insertions, 9 deletions
diff --git a/webkit/glue/webaccessibility.cc b/webkit/glue/webaccessibility.cc index 48cc339..09a9212 100644 --- a/webkit/glue/webaccessibility.cc +++ b/webkit/glue/webaccessibility.cc @@ -395,10 +395,10 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src, // 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 one of its - // ancestors. For child nodes that are actually parented to something - // else, store only the ID. - if (IsAncestorOf(src, child)) { + // Only recursively add child nodes that have this node as its + // unignored parent. For child nodes that are actually parented to + // somethinng else, store only the ID. + if (IsParentUnignoredOf(src, child)) { children.push_back(WebAccessibility(child, cache, include_children)); } else { indirect_child_ids.push_back(cache->addOrGetId(child)); @@ -407,11 +407,11 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src, } } -bool WebAccessibility::IsAncestorOf( +bool WebAccessibility::IsParentUnignoredOf( const WebKit::WebAccessibilityObject& ancestor, const WebKit::WebAccessibilityObject& child) { WebKit::WebAccessibilityObject parent = child.parentObject(); - while (!parent.isNull() && !parent.equals(ancestor)) + while (!parent.isNull() && parent.accessibilityIsIgnored()) parent = parent.parentObject(); return parent.equals(ancestor); } diff --git a/webkit/glue/webaccessibility.h b/webkit/glue/webaccessibility.h index b67ce83..85fe6d2 100644 --- a/webkit/glue/webaccessibility.h +++ b/webkit/glue/webaccessibility.h @@ -198,9 +198,12 @@ struct WebAccessibility { WebKit::WebAccessibilityCache* cache, bool include_children); - // Returns true if |ancestor| is an ancestor of |child|. - bool IsAncestorOf(const WebKit::WebAccessibilityObject& ancestor, - const WebKit::WebAccessibilityObject& child); + // Returns true if |ancestor| is the first unignored parent of |child|, + // which means that when walking up the parent chain from |child|, + // |ancestor| is the *first* ancestor that isn't marked as + // accessibilityIsIgnored(). + bool IsParentUnignoredOf(const WebKit::WebAccessibilityObject& ancestor, + const WebKit::WebAccessibilityObject& child); public: // This is a simple serializable struct. All member variables should be |