Commit ecbec4dd authored by James Wallace-Lee's avatar James Wallace-Lee Committed by Commit Bot

Force accessibility tree layout when CSS transform changes

When a node's CSS transform changes, the accessibility tree should
perform a layout so that focus appears in the correct location.

R=dmazzoni@chromium.org, ikilpatrick@chromium.org

Bug: 610840
Test: DumpAccessibilityTreeTest.AccessibilityTransform
Change-Id: I2517358ea8f8b8a2b24c2daf358dca2058fe1c37
Reviewed-on: https://chromium-review.googlesource.com/1108393
Commit-Queue: James Wallace-Lee <jamwalla@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570135}
parent 3f54bc2f
......@@ -289,6 +289,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
RunCSSTest(FILE_PATH_LITERAL("table-incomplete.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSTransform) {
RunCSSTest(FILE_PATH_LITERAL("transform.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityA) {
RunHtmlTest(FILE_PATH_LITERAL("a.html"));
}
......
rootWebArea pageLocation=(0, 0)
++genericContainer pageLocation=(0, 0) name='Done'
++genericContainer pageLocation=(0, 50)
++++paragraph pageLocation=(0, 50)
++++++staticText pageLocation=(0, 50) name='content'
++++++++inlineTextBox pageLocation=(0, 50) name='content'
<!--
@BLINK-ALLOW:pageLocation=(0, 0)
@BLINK-ALLOW:pageLocation=(0, 50)
@WAIT-FOR:Done
-->
<!DOCTYPE html>
<html>
<head>
<style>
div, p {
margin: 0;
padding: 0;
border: 0;
top: 0;
left: 0;
}
div {
position: fixed;
}
#outer {
transform: TranslateY(2px);
}
</style>
</head>
<body>
<div id="status" aria-label="Working"></div>
<div id="outer">
<p>content</p>
</div>
<script>
setTimeout(function() {
document.getElementById("outer").style.transform = "translateY(50px)";
}, 10);
setTimeout(function() {
document.getElementById("status").setAttribute("aria-label", "Done");
}, 20);
</script>
</body>
</html>
......@@ -67,6 +67,7 @@ class CORE_EXPORT AXObjectCache
virtual void ListboxOptionStateChanged(HTMLOptionElement*) = 0;
virtual void ListboxSelectedChildrenChanged(HTMLSelectElement*) = 0;
virtual void ListboxActiveIndexChanged(HTMLSelectElement*) = 0;
virtual void LocationChanged(LayoutObject*) = 0;
virtual void RadiobuttonRemovedFromGroup(HTMLInputElement*) = 0;
virtual void Remove(AccessibleNode*) = 0;
......
......@@ -2126,6 +2126,11 @@ void LayoutObject::StyleWillChange(StyleDifference diff,
cache->ChildrenChanged(Parent());
}
if (diff.TransformChanged()) {
if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache())
cache->LocationChanged(this);
}
// Keep layer hierarchy visibility bits up to date if visibility changes.
if (visibility_changed) {
// We might not have an enclosing layer yet because we might not be in the
......
......@@ -822,6 +822,10 @@ void AXObjectCacheImpl::ListboxActiveIndexChanged(HTMLSelectElement* select) {
ToAXListBox(obj)->ActiveIndexChanged();
}
void AXObjectCacheImpl::LocationChanged(LayoutObject* layout_object) {
PostNotification(layout_object, kAXLocationChanged);
}
void AXObjectCacheImpl::RadiobuttonRemovedFromGroup(
HTMLInputElement* group_member) {
AXObject* obj = Get(group_member);
......
......@@ -115,6 +115,7 @@ class MODULES_EXPORT AXObjectCacheImpl
void ListboxOptionStateChanged(HTMLOptionElement*) override;
void ListboxSelectedChildrenChanged(HTMLSelectElement*) override;
void ListboxActiveIndexChanged(HTMLSelectElement*) override;
void LocationChanged(LayoutObject*) override;
void RadiobuttonRemovedFromGroup(HTMLInputElement*) override;
void Remove(AccessibleNode*) override;
......
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