Commit 400afa3c authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Feed correct parent to AXTreeSerializer

There is a discrepancy between BlinkAXTreeSource::GetChildren() and
BlinkAXTreeSource::GetParent().

- GetChildren() does not return direct children when they are ignored
  and not included in the tree. This is because when
  AXNodeObject::InsertChild() visits an object that is ignored and not
  included in tree, it recurses and inserts the next generation.
- GetParent() always returns the direct parent.

This discrepancy an lead to confusion within AXTreeSerializer, with
respect to analyzing reparenting.

Bug: 651614
Change-Id: I4e4c8c6a2900cf5516cc98f3b260e619220ea7e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095882
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarAdam Ettenberger <Adam.Ettenberger@microsoft.com>
Reviewed-by: default avatarJacques Newman <janewman@microsoft.com>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750243}
parent 7d29108f
......@@ -1752,9 +1752,6 @@ bool WebAXObjectProxy::IsPressActionSupported() {
v8::Local<v8::Object> WebAXObjectProxy::ParentElement() {
accessibility_object_.UpdateLayoutAndCheckValidity();
blink::WebAXObject parent_object = accessibility_object_.ParentObject();
while (!parent_object.IsNull() &&
!parent_object.AccessibilityIsIncludedInTree())
parent_object = parent_object.ParentObject();
return factory_->GetOrCreate(parent_object);
}
......
......@@ -255,7 +255,7 @@ WebAXObject WebAXObject::ParentObject() const {
if (IsDetached())
return WebAXObject();
return WebAXObject(private_->ParentObject());
return WebAXObject(private_->ParentObjectIncludedInTree());
}
void WebAXObject::GetSparseAXAttributes(
......
<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<div id="parent">
<div style="display:none">
<div id="child" style="display:none">
Cats are liquid
</div>
</div>
</div>
<script>
function axElementById(id) {
return accessibilityController.accessibleElementById(id);
}
const parentObj = axElementById('parent');
const childObj = axElementById('child');
test(function(t) {
assert_true(Boolean(childObj));
}, "An object with display:none and @id is included in tree");
test(function(t) {
assert_equals(parentObj.childAtIndex(0), childObj);
}, "A child is included in tree");
test(function(t) {
assert_equals(childObj.parentElement(), parentObj);
}, "A parent is included in tree");
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment