Commit dcc6c2f2 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Changing CSS display must update ax tree

The accessible tree was not being updated when layout tree included
nodeless objects, which are used to parent inline objects
when they have block siblings. This fixes the closest node logic used
to find a node for a layout object or layout ancestor.

Bug: 895183
Change-Id: Iec46a5d97f60137a35350a9c4a5c89d45056a9a0
Reviewed-on: https://chromium-review.googlesource.com/c/1280789Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599697}
parent 14f0d10a
...@@ -279,6 +279,16 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSFontFamily) { ...@@ -279,6 +279,16 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSFontFamily) {
RunCSSTest(FILE_PATH_LITERAL("font-family.html")); RunCSSTest(FILE_PATH_LITERAL("font-family.html"));
} }
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
AccessibilityCSSDisplayToInline) {
RunCSSTest(FILE_PATH_LITERAL("display-to-inline.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
AccessibilityCSSDisplayToBlock) {
RunCSSTest(FILE_PATH_LITERAL("display-to-block.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
AccessibilityCSSInlinePositionRelative) { AccessibilityCSSInlinePositionRelative) {
RunCSSTest(FILE_PATH_LITERAL("inline-position-relative.html")); RunCSSTest(FILE_PATH_LITERAL("inline-position-relative.html"));
......
rootWebArea
++genericContainer
++++staticText name='Cats'
++++++inlineTextBox name='Cats'
++genericContainer
++++checkBox name='done' checkedState=false
<!--
@WAIT-FOR:done
-->
<div>
<div>Cats</div>
<div id="block" style="display:none;">
<input type="checkbox" aria-label="done">
</div>
<div></div>
</div>
<script>
setTimeout(()=> {
document.getElementById('block').style.display = 'block';
}, 100);
</script>
rootWebArea
++staticText name='Cats '
++++inlineTextBox name='Cats '
++genericContainer
++++checkBox name='done' checkedState=false
<!--
@WAIT-FOR:done
-->
<div>
Cats
<span id="inline" style="display:none;">
<input type="checkbox" aria-label="done">
</span>
<div></div>
</div>
<script>
setTimeout(()=> {
document.getElementById('inline').style.display = 'inline';
}, 200);
</script>
...@@ -717,20 +717,21 @@ void AXObjectCacheImpl::ChildrenChanged(Node* node) { ...@@ -717,20 +717,21 @@ void AXObjectCacheImpl::ChildrenChanged(Node* node) {
ChildrenChanged(Get(node), node); ChildrenChanged(Get(node), node);
} }
void AXObjectCacheImpl::ChildrenChanged(LayoutObject* layout_object) { // Return a node for the current layout object or ancestor layout object.
Node* GetClosestNodeForLayoutObject(LayoutObject* layout_object) {
if (!layout_object) if (!layout_object)
return; return nullptr;
Node* node = layout_object->GetNode(); Node* node = layout_object->GetNode();
LayoutObject* parent = layout_object->Parent(); return node ? node : GetClosestNodeForLayoutObject(layout_object->Parent());
while (!node && parent) { }
node = layout_object->GetNode();
parent = parent->Parent();
}
if (!node) void AXObjectCacheImpl::ChildrenChanged(LayoutObject* layout_object) {
if (!layout_object)
return; return;
if (node->GetDocument().NeedsLayoutTreeUpdateForNode(*node)) { Node* node = GetClosestNodeForLayoutObject(layout_object);
if (node && node->GetDocument().NeedsLayoutTreeUpdateForNode(*node)) {
nodes_changed_during_layout_.push_back(node); nodes_changed_during_layout_.push_back(node);
return; return;
} }
...@@ -979,12 +980,8 @@ void AXObjectCacheImpl::HandlePossibleRoleChange(Node* node) { ...@@ -979,12 +980,8 @@ void AXObjectCacheImpl::HandlePossibleRoleChange(Node* node) {
if (!node) if (!node)
return; // Virtual AOM node. return; // Virtual AOM node.
AXObject* obj = Get(node);
if (!obj && IsHTMLSelectElement(node))
obj = GetOrCreate(node);
// Invalidate the current object and make the parent reconsider its children. // Invalidate the current object and make the parent reconsider its children.
if (obj) { if (AXObject* obj = Get(node)) {
// Save parent for later use. // Save parent for later use.
AXObject* parent = obj->ParentObject(); AXObject* parent = obj->ParentObject();
......
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