зеркало из https://github.com/mozilla/gecko-dev.git
Bug 504252 - Expose STATE_HASPOPUP on XUL elements that have an @popup attribute, r=surkov, r=davidb
This commit is contained in:
Родитель
a129d6ee41
Коммит
3e08a5604b
|
@ -181,6 +181,7 @@ ACCESSIBILITY_ATOM(minpos, "minpos") // XUL
|
|||
ACCESSIBILITY_ATOM(multiline, "multiline") // XUL
|
||||
ACCESSIBILITY_ATOM(name, "name")
|
||||
ACCESSIBILITY_ATOM(onclick, "onclick")
|
||||
ACCESSIBILITY_ATOM(popup, "popup")
|
||||
ACCESSIBILITY_ATOM(readonly, "readonly")
|
||||
ACCESSIBILITY_ATOM(scope, "scope") // HTML table
|
||||
ACCESSIBILITY_ATOM(simple, "simple") // XLink
|
||||
|
|
|
@ -1048,6 +1048,11 @@ nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
if (frame && (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW))
|
||||
*aState |= nsIAccessibleStates::STATE_FLOATING;
|
||||
|
||||
// Check if a XUL element has the popup attribute (an attached popup menu).
|
||||
if (content->IsNodeOfType(nsINode::eXUL))
|
||||
if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::popup))
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
|
||||
|
||||
// Add 'linked' state for simple xlink.
|
||||
if (nsCoreUtils::IsXLink(content))
|
||||
*aState |= nsIAccessibleStates::STATE_LINKED;
|
||||
|
@ -3222,6 +3227,11 @@ nsAccessible::GetActionRule(PRUint32 aStates)
|
|||
if (nsCoreUtils::IsXLink(content))
|
||||
return eJumpAction;
|
||||
|
||||
// Return "click" action on elements that have an attached popup menu.
|
||||
if (content->IsNodeOfType(nsINode::eXUL))
|
||||
if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::popup))
|
||||
return eClickAction;
|
||||
|
||||
// Has registered 'click' event handler.
|
||||
PRBool isOnclick = nsCoreUtils::HasListener(content,
|
||||
NS_LITERAL_STRING("click"));
|
||||
|
|
|
@ -128,10 +128,11 @@ _TEST_FILES =\
|
|||
test_role_nsHyperTextAcc.html \
|
||||
test_role_table_cells.html \
|
||||
test_states.html \
|
||||
test_states_editablebody.html \
|
||||
test_states_doc.html \
|
||||
test_states_docarticle.html \
|
||||
test_states_editablebody.html \
|
||||
test_states_frames.html \
|
||||
test_states_popup.xul \
|
||||
test_states_tree.xul \
|
||||
test_table_1.html \
|
||||
test_table_2.html \
|
||||
|
|
|
@ -50,6 +50,11 @@
|
|||
ID: "buttonmenu",
|
||||
actionName: "press",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "labelWithPopup",
|
||||
actionName: "click",
|
||||
events: CLICK_EVENTS
|
||||
}/*, // XXX: bug 490288
|
||||
{
|
||||
ID: "buttonmenu_item",
|
||||
|
@ -73,6 +78,11 @@
|
|||
title="nsIAccessible actions testing">
|
||||
Mozilla Bug 410765
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=504252"
|
||||
title="Expose STATE_HASPOPUP on XUL elements that have an @popup attribute">
|
||||
Mozilla Bug 504252
|
||||
</a><br/>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
@ -102,6 +112,10 @@
|
|||
<menuitem label="item1"/>
|
||||
</menupopup>
|
||||
</button>
|
||||
|
||||
<label id="labelWithPopup" value="file name"
|
||||
popup="fileContext"
|
||||
tabindex="0"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</window>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="XUL popup attribute test">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
function doTest()
|
||||
{
|
||||
// label with popup
|
||||
testStates("labelWithPopup", STATE_HASPOPUP);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<hbox flex="1" style="overflow: auto;">
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=504252"
|
||||
title="Expose STATE_HASPOPUP on XUL elements that have an @popup attribute">
|
||||
Mozilla Bug 504252
|
||||
</a><br/>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<!-- label with popup attribute -->
|
||||
<label id="labelWithPopup" value="file name"
|
||||
popup="fileContext"
|
||||
tabindex="0"/>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
Загрузка…
Ссылка в новой задаче