зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1113153 - use 'paragraph' role for paragraphs only, introduce 'text' role for small text containers, r=marcoz
This commit is contained in:
Родитель
8674a0606d
Коммит
7f0a2bcc08
|
@ -103,6 +103,10 @@ MARKUPMAP(li,
|
|||
New_HTMLListitem,
|
||||
0)
|
||||
|
||||
MARKUPMAP(map,
|
||||
nullptr,
|
||||
roles::TEXT_CONTAINER)
|
||||
|
||||
MARKUPMAP(math,
|
||||
New_HyperText,
|
||||
roles::MATHML_MATH)
|
||||
|
@ -304,6 +308,10 @@ MARKUPMAP(output,
|
|||
roles::SECTION,
|
||||
Attr(live, polite))
|
||||
|
||||
MARKUPMAP(p,
|
||||
nullptr,
|
||||
roles::PARAGRAPH)
|
||||
|
||||
MARKUPMAP(progress,
|
||||
New_HTMLProgress,
|
||||
0)
|
||||
|
|
|
@ -981,7 +981,13 @@ enum Role {
|
|||
*/
|
||||
RADIO_GROUP = 168,
|
||||
|
||||
LAST_ROLE = RADIO_GROUP
|
||||
/**
|
||||
* A text container exposing brief amount of information. See related
|
||||
* TEXT_CONTAINER role.
|
||||
*/
|
||||
TEXT = 169,
|
||||
|
||||
LAST_ROLE = TEXT
|
||||
};
|
||||
|
||||
} // namespace role
|
||||
|
|
|
@ -754,7 +754,7 @@ ROLE(TERMINAL,
|
|||
|
||||
ROLE(TEXT_CONTAINER,
|
||||
"text container",
|
||||
ATK_ROLE_TEXT,
|
||||
ATK_ROLE_SECTION,
|
||||
NSAccessibilityGroupRole,
|
||||
USE_ROLE_STRING,
|
||||
IA2_ROLE_TEXT_FRAME,
|
||||
|
@ -1367,3 +1367,12 @@ ROLE(RADIO_GROUP,
|
|||
ROLE_SYSTEM_GROUPING,
|
||||
ROLE_SYSTEM_GROUPING,
|
||||
eNoNameRule)
|
||||
|
||||
ROLE(TEXT,
|
||||
"text",
|
||||
ATK_ROLE_STATIC,
|
||||
NSAccessibilityGroupRole,
|
||||
USE_ROLE_STRING,
|
||||
IA2_ROLE_TEXT_FRAME,
|
||||
eNameFromSubtreeIfReqRule)
|
||||
|
||||
|
|
|
@ -63,12 +63,11 @@ HyperTextAccessible::NativeRole()
|
|||
if (r != roles::NOTHING)
|
||||
return r;
|
||||
|
||||
// Treat block frames as paragraphs
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::blockFrame)
|
||||
return roles::PARAGRAPH;
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::inlineFrame)
|
||||
return roles::TEXT;
|
||||
|
||||
return roles::TEXT_CONTAINER; // In ATK this works
|
||||
return roles::TEXT_CONTAINER;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* Defines cross platform (Gecko) roles.
|
||||
*/
|
||||
[scriptable, uuid(00f9e831-3198-40b7-9186-5251474d4d7a)]
|
||||
[scriptable, uuid(94add87a-190c-443e-9549-d11131affb2a)]
|
||||
interface nsIAccessibleRole : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -974,4 +974,10 @@ interface nsIAccessibleRole : nsISupports
|
|||
* A group containing radio buttons
|
||||
*/
|
||||
const unsigned long ROLE_RADIO_GROUP = 168;
|
||||
|
||||
/**
|
||||
* A text container exposing brief amount of information. See related
|
||||
* TEXT_CONTAINER role.
|
||||
*/
|
||||
const unsigned long ROLE_TEXT = 169;
|
||||
};
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
children: [ { role: ROLE_TEXT_LEAF } ]
|
||||
}
|
||||
]
|
||||
|
@ -81,7 +81,7 @@
|
|||
// HTML:address
|
||||
|
||||
obj = {
|
||||
todo_role: ROLE_PARAGRAPH,
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
|
||||
};
|
||||
testElm("address", obj);
|
||||
|
@ -188,7 +188,7 @@
|
|||
testElm("blockquote", obj);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HTML:br
|
||||
// HTML:br contained by paragraph
|
||||
|
||||
obj = {
|
||||
role: ROLE_PARAGRAPH,
|
||||
|
@ -1062,7 +1062,7 @@
|
|||
// HTML:pre
|
||||
|
||||
obj = {
|
||||
role: ROLE_PARAGRAPH,
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ]
|
||||
};
|
||||
testElm("pre", obj);
|
||||
|
@ -1087,7 +1087,7 @@
|
|||
// HTML:q
|
||||
|
||||
obj = {
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
|
||||
children: [
|
||||
{ role: ROLE_STATICTEXT }, // left quote
|
||||
|
@ -1233,7 +1233,7 @@
|
|||
// HTML:time
|
||||
|
||||
obj = {
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
attributes: { "xml-roles": "time", "datetime": "2001-05-15 19:00" },
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ]
|
||||
};
|
||||
|
|
|
@ -111,6 +111,7 @@ const ROLE_STATUSBAR = nsIAccessibleRole.ROLE_STATUSBAR;
|
|||
const ROLE_SWITCH = nsIAccessibleRole.ROLE_SWITCH;
|
||||
const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
|
||||
const ROLE_TERM = nsIAccessibleRole.ROLE_TERM;
|
||||
const ROLE_TEXT = nsIAccessibleRole.ROLE_TEXT;
|
||||
const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
|
||||
const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
|
||||
const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
testRole("aria_list", ROLE_LIST);
|
||||
testRole("aria_listbox", ROLE_LISTBOX);
|
||||
testRole("aria_listitem", ROLE_LISTITEM);
|
||||
testRole("aria_log", ROLE_TEXT_CONTAINER); // weak role
|
||||
testRole("aria_log", ROLE_TEXT); // weak role
|
||||
testRole("aria_marquee", ROLE_ANIMATION);
|
||||
testRole("aria_math", ROLE_FLAT_EQUATION);
|
||||
testRole("aria_menu", ROLE_MENUPOPUP);
|
||||
|
@ -48,7 +48,7 @@
|
|||
testRole("aria_menuitemcheckbox", ROLE_CHECK_MENU_ITEM);
|
||||
testRole("aria_menuitemradio", ROLE_RADIO_MENU_ITEM);
|
||||
testRole("aria_note", ROLE_NOTE);
|
||||
testRole("aria_presentation", ROLE_TEXT_CONTAINER); // weak role
|
||||
testRole("aria_presentation", ROLE_TEXT); // weak role
|
||||
testRole("aria_progressbar", ROLE_PROGRESSBAR);
|
||||
testRole("aria_radio", ROLE_RADIOBUTTON);
|
||||
testRole("aria_radiogroup", ROLE_RADIO_GROUP);
|
||||
|
@ -66,7 +66,7 @@
|
|||
testRole("aria_tablist", ROLE_PAGETABLIST);
|
||||
testRole("aria_tabpanel", ROLE_PROPERTYPAGE);
|
||||
testRole("aria_textbox", ROLE_ENTRY);
|
||||
testRole("aria_timer", ROLE_TEXT_CONTAINER); // weak role
|
||||
testRole("aria_timer", ROLE_TEXT); // weak role
|
||||
testRole("aria_toolbar", ROLE_TOOLBAR);
|
||||
testRole("aria_tooltip", ROLE_TOOLTIP);
|
||||
testRole("aria_tree", ROLE_OUTLINE);
|
||||
|
|
|
@ -67,9 +67,9 @@
|
|||
testRole("definitiondescription", ROLE_DEFINITION);
|
||||
|
||||
// Has click, mousedown or mouseup listeners.
|
||||
testRole("span1", ROLE_TEXT_CONTAINER);
|
||||
testRole("span2", ROLE_TEXT_CONTAINER);
|
||||
testRole("span3", ROLE_TEXT_CONTAINER);
|
||||
testRole("span1", ROLE_TEXT);
|
||||
testRole("span2", ROLE_TEXT);
|
||||
testRole("span3", ROLE_TEXT);
|
||||
|
||||
// Test role of listbox inside combobox
|
||||
testRole("listbox1", ROLE_COMBOBOX_LIST);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
role: ROLE_LIST,
|
||||
children: [
|
||||
{ // li
|
||||
role: ROLE_PARAGRAPH,
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
children: [
|
||||
{ // li text leaf
|
||||
role: ROLE_TEXT_LEAF,
|
||||
|
|
|
@ -73,10 +73,10 @@
|
|||
// Presentation list, expose generic accesisble for list items.
|
||||
tree =
|
||||
{ SECTION: [ // container
|
||||
{ PARAGRAPH: [ // li generic accessible inside 'presentation' role
|
||||
{ TEXT_CONTAINER: [ // li generic accessible inside 'presentation' role
|
||||
{ TEXT_LEAF: [ ] } // li text
|
||||
] },
|
||||
{ PARAGRAPH: [ // li generic accessible inside 'none' role
|
||||
{ TEXT_CONTAINER: [ // li generic accessible inside 'none' role
|
||||
{ TEXT_LEAF: [ ] } // li text
|
||||
] }
|
||||
] };
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
{
|
||||
var tree =
|
||||
{ DOCUMENT: [
|
||||
{ PARAGRAPH: [ // head
|
||||
{ PARAGRAPH: [ // link
|
||||
{ TEXT_CONTAINER: [ // head
|
||||
{ TEXT_CONTAINER: [ // link
|
||||
{ STATICTEXT: [] }, // generated content
|
||||
{ STATICTEXT: [] } // generated content
|
||||
] }
|
||||
] },
|
||||
{ TEXT_LEAF: [ ] }, // body text
|
||||
{ ENTRY: [ ] }, // input under document element
|
||||
{ PARAGRAPH: [ // link under document element
|
||||
{ TEXT_CONTAINER: [ // link under document element
|
||||
{ TEXT_LEAF: [ ] }, // link content
|
||||
{ STATICTEXT: [ ] }, // generated content
|
||||
{ STATICTEXT: [ ] } // generated content
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
document.getElementsByTagName("img")[0].firstChild.data = "2";
|
||||
|
||||
var accTree = {
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
children: [ { role: ROLE_TEXT_LEAF } ]
|
||||
};
|
||||
testAccessibleTree("the_img", accTree);
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
children: []
|
||||
},
|
||||
{ // abbr tag
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
name: "accessibility",
|
||||
children: [
|
||||
{ // text leaf with actual text
|
||||
|
@ -150,7 +150,7 @@
|
|||
children: []
|
||||
},
|
||||
{ // acronym tag
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
name: "personal computer",
|
||||
children: [
|
||||
{ // text leaf with actual text
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
function removeTextData(aID)
|
||||
function removeTextData(aID, aRole)
|
||||
{
|
||||
this.containerNode = getNode(aID);
|
||||
this.textNode = this.containerNode.firstChild;
|
||||
|
@ -96,7 +96,7 @@
|
|||
this.invoke = function removeTextData_invoke()
|
||||
{
|
||||
var tree = {
|
||||
role: ROLE_PARAGRAPH,
|
||||
role: aRole,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TEXT_LEAF,
|
||||
|
@ -112,7 +112,7 @@
|
|||
this.finalCheck = function removeTextData_finalCheck()
|
||||
{
|
||||
var tree = {
|
||||
role: ROLE_PARAGRAPH,
|
||||
role: aRole,
|
||||
children: []
|
||||
};
|
||||
testAccessibleTree(this.containerNode, tree);
|
||||
|
@ -147,8 +147,8 @@
|
|||
gQueue.push(new setOnClickNRoleAttrs("span"));
|
||||
|
||||
// text data removal of text node should remove its text accessible
|
||||
gQueue.push(new removeTextData("p"));
|
||||
gQueue.push(new removeTextData("pre"));
|
||||
gQueue.push(new removeTextData("p", ROLE_PARAGRAPH));
|
||||
gQueue.push(new removeTextData("pre", ROLE_TEXT_CONTAINER));
|
||||
|
||||
gQueue.invoke(); // SimpleTest.finish() will be called in the end
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче