зеркало из https://github.com/mozilla/gecko-dev.git
Bug 705179 - Implement initial canvas accessible and baseline test. r=surkov,ehsan
This commit is contained in:
Родитель
525673815e
Коммит
899b2bf2a0
|
@ -50,6 +50,7 @@
|
|||
#include "nsIContentViewer.h"
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsHTMLCanvasAccessible.h"
|
||||
#include "nsHTMLImageMapAccessible.h"
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsHTMLSelectAccessible.h"
|
||||
|
@ -275,6 +276,16 @@ nsAccessibilityService::CreateHTMLComboboxAccessible(nsIContent* aContent,
|
|||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccessible>
|
||||
nsAccessibilityService::CreateHTMLCanvasAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
|
||||
nsAccessible* accessible = new nsHTMLCanvasAccessible(aContent, weakShell);
|
||||
NS_IF_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccessible>
|
||||
nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
|
|
|
@ -83,6 +83,8 @@ public:
|
|||
CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
virtual already_AddRefed<nsAccessible>
|
||||
CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<nsAccessible>
|
||||
CreateHTMLCanvasAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
virtual already_AddRefed<nsAccessible>
|
||||
CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
virtual already_AddRefed<nsAccessible>
|
||||
|
|
|
@ -50,6 +50,7 @@ LIBXUL_LIBRARY = 1
|
|||
|
||||
|
||||
CPPSRCS = \
|
||||
nsHTMLCanvasAccessible.cpp \
|
||||
nsHTMLFormControlAccessible.cpp \
|
||||
nsHTMLImageAccessible.cpp \
|
||||
nsHTMLImageMapAccessible.cpp \
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLCanvasAccessible.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
nsHTMLCanvasAccessible::
|
||||
nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
|
||||
nsHyperTextAccessible(aContent, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsHTMLCanvasAccessible::NativeRole()
|
||||
{
|
||||
return nsIAccessibleRole::ROLE_CANVAS;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHyperTextAccessible.h"
|
||||
|
||||
#ifndef _nsHTMLCanvasAccessible_H_
|
||||
#define _nsHTMLCanvasAccessible_H_
|
||||
|
||||
/**
|
||||
* HTML canvas accessible (html:canvas).
|
||||
*/
|
||||
class nsHTMLCanvasAccessible : public nsHyperTextAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLCanvasAccessible() { }
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -7,6 +7,7 @@ const ROLE_APPLICATION = nsIAccessibleRole.ROLE_APPLICATION;
|
|||
const ROLE_APP_ROOT = nsIAccessibleRole.ROLE_APP_ROOT;
|
||||
const ROLE_AUTOCOMPLETE = nsIAccessibleRole.ROLE_AUTOCOMPLETE;
|
||||
const ROLE_BUTTONDROPDOWNGRID = nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
|
||||
const ROLE_CANVAS = nsIAccessibleRole.ROLE_CANVAS;
|
||||
const ROLE_CAPTION = nsIAccessibleRole.ROLE_CAPTION;
|
||||
const ROLE_CELL = nsIAccessibleRole.ROLE_CELL;
|
||||
const ROLE_CHECKBUTTON = nsIAccessibleRole.ROLE_CHECKBUTTON;
|
||||
|
|
|
@ -52,6 +52,7 @@ _TEST_FILES =\
|
|||
test_aria_imgmap.html \
|
||||
test_aria_presentation.html \
|
||||
test_button.xul \
|
||||
test_canvas.html \
|
||||
test_combobox.xul \
|
||||
test_cssoverflow.html \
|
||||
test_dochierarchy.html \
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=495912
|
||||
-->
|
||||
<head>
|
||||
<title>File Input Control tests</title>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../role.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var accTree = {
|
||||
role: ROLE_CANVAS,
|
||||
children: [
|
||||
]
|
||||
};
|
||||
testAccessibleTree("canvas", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="Expose alternative content in Canvas element to ATs"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=495912">Mozilla Bug 495912</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<canvas id="canvas" tabindex="0">
|
||||
fallback content.
|
||||
</canvas>
|
||||
|
||||
<script type="text/javascript">
|
||||
var c=document.getElementById("canvas");
|
||||
var cxt=c.getContext("2d");
|
||||
cxt.fillStyle="#005500";
|
||||
cxt.fillRect(0,0,150,75);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -52,6 +52,10 @@
|
|||
|
||||
#include "gfxContext.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsAccessibilityService.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
|
@ -360,6 +364,10 @@ nsHTMLCanvasFrame::GetContinuationOffset(nscoord* aWidth) const
|
|||
already_AddRefed<nsAccessible>
|
||||
nsHTMLCanvasFrame::CreateAccessible()
|
||||
{
|
||||
nsAccessibilityService* accService = nsIPresShell::AccService();
|
||||
if (accService) {
|
||||
return accService->CreateHTMLCanvasAccessible(mContent, PresContext()->PresShell());
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче