Title: [154710] trunk
Revision
154710
Author
[email protected]
Date
2013-08-27 14:56:57 -0700 (Tue, 27 Aug 2013)

Log Message

<https://webkit.org/b/120117> AX: <noscript> contents are exposed as static text

Reviewed by Tim Horton.

Source/WebCore: 

If <noscript> is not being used (because there is script) then we need to ignore its contents for AX.

Test: accessibility/noscript-ignored.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::addCanvasChildren):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren):

LayoutTests: 

* accessibility/noscript-ignored-expected.txt: Added.
* accessibility/noscript-ignored.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154709 => 154710)


--- trunk/LayoutTests/ChangeLog	2013-08-27 21:38:12 UTC (rev 154709)
+++ trunk/LayoutTests/ChangeLog	2013-08-27 21:56:57 UTC (rev 154710)
@@ -1,3 +1,12 @@
+2013-08-27  Chris Fleizach  <[email protected]>
+
+        <https://webkit.org/b/120117> AX: <noscript> contents are exposed as static text
+
+        Reviewed by Tim Horton.
+
+        * accessibility/noscript-ignored-expected.txt: Added.
+        * accessibility/noscript-ignored.html: Added.
+
 2013-08-27  Robert Hogan  <[email protected]>
 
         cell width / offsetTop incorrect

Added: trunk/LayoutTests/accessibility/noscript-ignored-expected.txt (0 => 154710)


--- trunk/LayoutTests/accessibility/noscript-ignored-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/noscript-ignored-expected.txt	2013-08-27 21:56:57 UTC (rev 154710)
@@ -0,0 +1,10 @@
+This tests that elements inside noscript are ignored when making the accessible canvas children.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS canvas.childrenCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/noscript-ignored.html (0 => 154710)


--- trunk/LayoutTests/accessibility/noscript-ignored.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/noscript-ignored.html	2013-08-27 21:56:57 UTC (rev 154710)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<canvas width="200" height="100" id="canvas"><noscript><img id='hidden-image' src=''></noscript></canvas>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that elements inside noscript are ignored when making the accessible canvas children.");
+
+    var c = document.getElementById("canvas");
+    var ctx = c.getContext("2d");
+    ctx.fillStyle = "#FF0000";
+    ctx.fillRect(0, 0, 150, 75);
+
+    if (window.accessibilityController) {
+        var canvas = accessibilityController.accessibleElementById("canvas");
+        shouldBe("canvas.childrenCount", "0");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (154709 => 154710)


--- trunk/Source/WebCore/ChangeLog	2013-08-27 21:38:12 UTC (rev 154709)
+++ trunk/Source/WebCore/ChangeLog	2013-08-27 21:56:57 UTC (rev 154710)
@@ -1,3 +1,18 @@
+2013-08-27  Chris Fleizach  <[email protected]>
+
+        <https://webkit.org/b/120117> AX: <noscript> contents are exposed as static text
+
+        Reviewed by Tim Horton.
+
+        If <noscript> is not being used (because there is script) then we need to ignore its contents for AX.
+
+        Test: accessibility/noscript-ignored.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::addCanvasChildren):
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::canHaveChildren):
+
 2013-08-27  Anders Carlsson  <[email protected]>
 
         Stop using deleteAllValues in CClass

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (154709 => 154710)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2013-08-27 21:38:12 UTC (rev 154709)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2013-08-27 21:56:57 UTC (rev 154710)
@@ -374,6 +374,10 @@
     if (!node() && !isAccessibilityRenderObject())
         return false;
 
+    // When <noscript> is not being used (its renderer() == 0), ignore its children.
+    if (node() && !renderer() && node()->hasTagName(noscriptTag))
+        return false;
+    
     // Elements that should not have children
     switch (roleValue()) {
     case ImageRole:

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (154709 => 154710)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-08-27 21:38:12 UTC (rev 154709)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-08-27 21:56:57 UTC (rev 154710)
@@ -2852,7 +2852,9 @@
 
 void AccessibilityRenderObject::addCanvasChildren()
 {
-    if (!node() || !node()->hasTagName(canvasTag))
+    // Add the unrendered canvas children as AX nodes, unless we're not using a canvas renderer
+    // because JS is disabled for example.
+    if (!node() || !node()->hasTagName(canvasTag) || (renderer() && !renderer()->isCanvas()))
         return;
 
     // If it's a canvas, it won't have rendered children, but it might have accessible fallback content.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to