AX: Image attachment in email does not show up in AX tree
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jul 2016 00:41:46 +0000 (00:41 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jul 2016 00:41:46 +0000 (00:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=159422

Reviewed by Joanmarie Diggs.

Source/WebCore:

When an image loads after the accessibility tree has already been created, the ignored status
of that image does not get updated.

Test: accessibility/image-load-on-delay.html

* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageChanged):

LayoutTests:

* accessibility/image-load-on-delay-expected.txt: Added.
* accessibility/image-load-on-delay.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202841 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/image-load-on-delay-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/image-load-on-delay.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderImage.cpp

index d67adb4..5c4c535 100644 (file)
@@ -1,3 +1,13 @@
+2016-07-05  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Image attachment in email does not show up in AX tree
+        https://bugs.webkit.org/show_bug.cgi?id=159422
+
+        Reviewed by Joanmarie Diggs.
+
+        * accessibility/image-load-on-delay-expected.txt: Added.
+        * accessibility/image-load-on-delay.html: Added.
+
 2016-07-05  Ryan Haddad  <ryanhaddad@apple.com>
 
         Land test expectations for rdar://problem/27182687.
diff --git a/LayoutTests/accessibility/image-load-on-delay-expected.txt b/LayoutTests/accessibility/image-load-on-delay-expected.txt
new file mode 100644 (file)
index 0000000..d738314
--- /dev/null
@@ -0,0 +1,12 @@
+1  2
+This verifies that when an image loads its resource late, the AX tree is updated to re-add the image.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+BEFORE: Group count: 2
+AFTER: Group count: 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/image-load-on-delay.html b/LayoutTests/accessibility/image-load-on-delay.html
new file mode 100644 (file)
index 0000000..86ff27d
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div id="content">
+<button>1</button>
+<img src="resources/___.png" width=100 height=100 id="image">
+<button>2</button>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+    description("This verifies that when an image loads its resource late, the AX tree is updated to re-add the image.");
+
+    if (window.accessibilityController) {
+          window.jsTestIsAsync = true;
+          var content = accessibilityController.accessibleElementById("content");
+          debug("BEFORE: Group count: " + content.childrenCount);
+
+          document.getElementById("image").onload = function() {
+              debug("AFTER: Group count: " + content.childrenCount);
+              finishJSTest();
+          };
+
+          setTimeout(function() { 
+              document.getElementById("image").src = "resources/cake.png"; 
+          }, 1000);
+    }
+
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index 74dd5de..7ef7c00 100644 (file)
@@ -1,3 +1,18 @@
+2016-07-05  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Image attachment in email does not show up in AX tree
+        https://bugs.webkit.org/show_bug.cgi?id=159422
+
+        Reviewed by Joanmarie Diggs.
+
+        When an image loads after the accessibility tree has already been created, the ignored status
+        of that image does not get updated.
+
+        Test: accessibility/image-load-on-delay.html
+
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::imageChanged):
+
 2016-07-05  Alex Christensen  <achristensen@webkit.org>
 
         Fix Windows build.
index 281ff86..9ba7cd4 100644 (file)
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "RenderImage.h"
 
+#include "AXObjectCache.h"
 #include "BitmapImage.h"
 #include "CachedImage.h"
 #include "FocusController.h"
@@ -252,6 +253,11 @@ void RenderImage::imageChanged(WrappedImagePtr newImage, const IntRect* rect)
         imageSizeChange = setImageSizeForAltText(imageResource().cachedImage());
     }
 
+    if (UNLIKELY(AXObjectCache::accessibilityEnabled())) {
+        if (AXObjectCache* cache = document().existingAXObjectCache())
+            cache->recomputeIsIgnored(this);
+    }
+
     repaintOrMarkForLayout(imageSizeChange, rect);
 }