Commit 09630020 authored by cfleizach@apple.com's avatar cfleizach@apple.com

<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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e0c78159
2013-08-27 Chris Fleizach <cfleizach@apple.com>
<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 <robert@webkit.org>
cell width / offsetTop incorrect
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
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">
<canvas width="200" height="100" id="canvas"><noscript><img id='hidden-image' src='resources/cake.png'></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="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
2013-08-27 Chris Fleizach <cfleizach@apple.com>
<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 <andersca@apple.com>
Stop using deleteAllValues in CClass
......@@ -374,6 +374,10 @@ bool AccessibilityNodeObject::canHaveChildren() const
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:
......
......@@ -2852,7 +2852,9 @@ void AccessibilityRenderObject::addRemoteSVGChildren()
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.
......
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