Title: [100584] trunk
Revision
100584
Author
dmazz...@google.com
Date
2011-11-17 01:44:01 -0800 (Thu, 17 Nov 2011)

Log Message

Accessibility: Chromium requires an AX notification when an iframe loads.
https://bugs.webkit.org/show_bug.cgi?id=72239

Source/WebCore:

When a document finishes loading, we were sending an AXLoadComplete if it
was the top document. Now, if it's a document in an iframe, send an
AXLayoutComplete on the iframe.

Reviewed by Chris Fleizach.

Test: accessibility/loading-iframe-sends-notification.html

* dom/Document.cpp:
(WebCore::Document::implicitClose):

LayoutTests:

Reviewed by Chris Fleizach.

* accessibility/loading-iframe-sends-notification.html: Added.
* platform/chromium/accessibility/loading-iframe-sends-notification-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (100583 => 100584)


--- trunk/LayoutTests/ChangeLog	2011-11-17 09:27:43 UTC (rev 100583)
+++ trunk/LayoutTests/ChangeLog	2011-11-17 09:44:01 UTC (rev 100584)
@@ -1,3 +1,13 @@
+2011-11-17  Dominic Mazzoni  <dmazz...@google.com>
+
+        Accessibility: Chromium requires an AX notification when an iframe loads.
+        https://bugs.webkit.org/show_bug.cgi?id=72239
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/loading-iframe-sends-notification.html: Added.
+        * platform/chromium/accessibility/loading-iframe-sends-notification-expected.txt: Added.
+
 2011-11-17  Adam Barth  <aba...@webkit.org>
 
         CSP report-only mode doesn't work from an HTTP header

Added: trunk/LayoutTests/accessibility/loading-iframe-sends-notification.html (0 => 100584)


--- trunk/LayoutTests/accessibility/loading-iframe-sends-notification.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/loading-iframe-sends-notification.html	2011-11-17 09:44:01 UTC (rev 100584)
@@ -0,0 +1,69 @@
+<html>
+<head>
+<script src=""
+
+  <script>
+    if (window.layoutTestController)
+        layoutTestController.waitUntilDone();
+
+    function runTest()
+    {
+        description("This tests that when an iframe finishes loading, it sends a layout complete notification.");
+
+        if (window.accessibilityController) {
+            // Initially, the iframe's webarea is empty.
+            window.root = accessibilityController.rootElement;
+            window.body = root.childAtIndex(0);
+            window.iframe = body.childAtIndex(1).childAtIndex(0);
+            window.scrollarea = iframe.childAtIndex(0);
+            window.subwebarea = scrollarea.childAtIndex(0);
+            shouldBeFalse("subwebarea.childrenCount > 0");
+
+            iframe.addNotificationListener(function (notification) {
+                // Make sure that we get a LayoutComplete notification and that
+                // immediately after the notification is received, the iframe's
+                // webarea has content.
+                debug('Got notification on iframe: ' + notification);
+                window.newScrollarea = iframe.childAtIndex(0);
+                window.newSubwebarea = newScrollarea.childAtIndex(0);
+                shouldBeTrue("newSubwebarea.childrenCount > 0");
+            });
+        }
+
+        window.iframeElement = document.getElementById("iframe");
+        iframeElement.addEventListener("load", function() {
+            window.setTimeout(function() {
+                debug('<br /><span class="pass">TEST COMPLETE</span>');
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone();
+            }, 10);
+        }, false);
+
+        // Load content into the iframe. This will trigger the event
+        // handler above, which will check that the accessibility tree
+        // was updated with new content.
+        window.iframeElement.src = "" me</button></body>";
+
+    }
+
+    window.addEventListener('load', function() {
+        setTimeout(runTest, 10);
+    }, false);
+
+  </script>
+</head>
+<body>
+
+<p>Before</p>
+
+<iframe id="iframe"></iframe>
+
+<p>After</p>
+
+<p>End of test</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium/accessibility/loading-iframe-sends-notification-expected.txt (0 => 100584)


--- trunk/LayoutTests/platform/chromium/accessibility/loading-iframe-sends-notification-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/accessibility/loading-iframe-sends-notification-expected.txt	2011-11-17 09:44:01 UTC (rev 100584)
@@ -0,0 +1,18 @@
+Before
+
+
+After
+
+End of test
+
+This tests that when an iframe finishes loading, it sends a layout complete notification.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS subwebarea.childrenCount > 0 is false
+Got notification on iframe: LayoutComplete
+PASS newSubwebarea.childrenCount > 0 is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (100583 => 100584)


--- trunk/Source/WebCore/ChangeLog	2011-11-17 09:27:43 UTC (rev 100583)
+++ trunk/Source/WebCore/ChangeLog	2011-11-17 09:44:01 UTC (rev 100584)
@@ -1,3 +1,19 @@
+2011-11-17  Dominic Mazzoni  <dmazz...@google.com>
+
+        Accessibility: Chromium requires an AX notification when an iframe loads.
+        https://bugs.webkit.org/show_bug.cgi?id=72239
+
+        When a document finishes loading, we were sending an AXLoadComplete if it
+        was the top document. Now, if it's a document in an iframe, send an
+        AXLayoutComplete on the iframe.
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/loading-iframe-sends-notification.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::implicitClose):
+
 2011-11-16  Mark Rowe  <mr...@apple.com>
 
         <http://webkit.org/b/72574> Remove unnecessary use of CarbonCore APIs from Audio code

Modified: trunk/Source/WebCore/dom/Document.cpp (100583 => 100584)


--- trunk/Source/WebCore/dom/Document.cpp	2011-11-17 09:27:43 UTC (rev 100583)
+++ trunk/Source/WebCore/dom/Document.cpp	2011-11-17 09:44:01 UTC (rev 100584)
@@ -2252,13 +2252,27 @@
     }
 
 #if PLATFORM(MAC) || PLATFORM(CHROMIUM)
-    if (f && renderObject && this == topDocument() && AXObjectCache::accessibilityEnabled()) {
+    if (f && renderObject && AXObjectCache::accessibilityEnabled()) {
         // The AX cache may have been cleared at this point, but we need to make sure it contains an
         // AX object to send the notification to. getOrCreate will make sure that an valid AX object
         // exists in the cache (we ignore the return value because we don't need it here). This is 
         // only safe to call when a layout is not in progress, so it can not be used in postNotification.    
         axObjectCache()->getOrCreate(renderObject);
-        axObjectCache()->postNotification(renderObject, AXObjectCache::AXLoadComplete, true);
+        if (this == topDocument())
+            axObjectCache()->postNotification(renderObject, AXObjectCache::AXLoadComplete, true);
+        else {
+            // AXLoadComplete can only be posted on the top document, so if it's a document
+            // in an iframe that just finished loading, post a notification on the iframe
+            // element instead.
+            ScrollView* scrollView = frame()->view();
+            if (scrollView && scrollView->isFrameView()) {
+                HTMLFrameOwnerElement* owner = static_cast<FrameView*>(scrollView)->frame()->ownerElement();
+                if (owner && owner->renderer()) {
+                    AccessibilityObject* axIFrame = axObjectCache()->getOrCreate(owner->renderer());
+                    axObjectCache()->postNotification(axIFrame, axIFrame->document(), AXObjectCache::AXLayoutComplete, true);
+                }
+            }
+        }
     }
 #endif
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to