mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Bug 577727 - Make pinned tabs distinguishable from other tabs for accessibility. r=marcoz
This commit is contained in:
parent
020a93e885
commit
b83dad4641
@ -5,7 +5,7 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(7fe1ee90-edaa-43f1-9f3b-071099b51f08)]
|
||||
[scriptable, uuid(f1e0fbb7-fde4-4519-9383-2bcbee428513)]
|
||||
interface nsIAccessibleStates : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -71,5 +71,6 @@ interface nsIAccessibleStates : nsISupports
|
||||
const unsigned long EXT_STATE_ENABLED = 0x00002000; // A widget that is not unavailable
|
||||
const unsigned long EXT_STATE_SENSITIVE = 0x00004000; // Same as ENABLED for now
|
||||
const unsigned long EXT_STATE_EXPANDABLE = 0x00008000; // If COLLAPSED or EXPANDED
|
||||
const unsigned long EXT_STATE_PINNED = 0x00010000; // Indicates object is pinned.
|
||||
};
|
||||
|
||||
|
@ -25,6 +25,8 @@ The following nsIAccessible states aren't translated, just ignored:
|
||||
Supported via ATK_ROLE_PASSWORD_TEXT
|
||||
STATE_HASPOPUP: Object displays a pop-up menu or window when invoked.
|
||||
No ATK equivalent. The nsIAccessible state is not currently supported.
|
||||
STATE_PINNED: The object is pinned, usually indicating it is fixed in place and has permanence.
|
||||
No ATK equivalent. The nsIAccessible state is not currently supported.
|
||||
|
||||
The following ATK states are not supported:
|
||||
ATK_STATE_ARMED: No clear use case, used briefly when button is activated
|
||||
@ -108,5 +110,6 @@ static const AtkStateMap gAtkStateMap[] = { // Cross Platfor
|
||||
{ ATK_STATE_ENABLED, kMapDirectly }, // states::ENABLED = 1 << 44
|
||||
{ ATK_STATE_SENSITIVE, kMapDirectly }, // states::SENSITIVE = 1 << 45
|
||||
{ ATK_STATE_EXPANDABLE, kMapDirectly }, // states::EXPANDABLE = 1 << 46
|
||||
{ kNone, kNoSuchState }, // = 1 << 47
|
||||
{ kNone, kMapDirectly }, // states::PINNED = 1 << 47
|
||||
{ kNone, kNoSuchState }, // = 1 << 48
|
||||
};
|
||||
|
@ -272,6 +272,11 @@ namespace states {
|
||||
* @see EXPANDED and COLLAPSED states.
|
||||
*/
|
||||
const uint64_t EXPANDABLE = ((uint64_t) 0x1) << 46;
|
||||
|
||||
/**
|
||||
* The object is pinned, usually indicating it is fixed in place and has permanence.
|
||||
*/
|
||||
const uint64_t PINNED = ((uint64_t) 0x1) << 47;
|
||||
} // namespace states
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
@ -1256,6 +1256,8 @@ AccessibleWrap::get_states(AccessibleStates *aStates)
|
||||
*aStates |= IA2_STATE_VERTICAL;
|
||||
if (state & states::CHECKED)
|
||||
*aStates |= IA2_STATE_CHECKABLE;
|
||||
if (state & states::PINNED)
|
||||
*aStates |= IA2_STATE_PINNED;
|
||||
|
||||
return S_OK;
|
||||
|
||||
|
@ -83,13 +83,19 @@ XULTabAccessible::NativeState()
|
||||
// get focus and disable status from base class
|
||||
uint64_t state = AccessibleWrap::NativeState();
|
||||
|
||||
// Check whether the tab is selected
|
||||
// Check whether the tab is selected and/or pinned
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> tab(do_QueryInterface(mContent));
|
||||
if (tab) {
|
||||
bool selected = false;
|
||||
if (NS_SUCCEEDED(tab->GetSelected(&selected)) && selected)
|
||||
state |= states::SELECTED;
|
||||
|
||||
if (mContent && mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::pinned) &&
|
||||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::pinned,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
state |= states::PINNED;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ const EXT_STATE_ENABLED = nsIAccessibleStates.EXT_STATE_ENABLED;
|
||||
const EXT_STATE_EXPANDABLE = nsIAccessibleStates.EXT_STATE_EXPANDABLE;
|
||||
const EXT_STATE_HORIZONTAL = nsIAccessibleStates.EXT_STATE_HORIZONTAL;
|
||||
const EXT_STATE_MULTI_LINE = nsIAccessibleStates.EXT_STATE_MULTI_LINE;
|
||||
const EXT_STATE_PINNED = nsIAccessibleStates.EXT_STATE_PINNED;
|
||||
const EXT_STATE_SENSITIVE = nsIAccessibleStates.EXT_STATE_SENSITIVE;
|
||||
const EXT_STATE_SINGLE_LINE = nsIAccessibleStates.EXT_STATE_SINGLE_LINE;
|
||||
const EXT_STATE_STALE = nsIAccessibleStates.EXT_STATE_STALE;
|
||||
|
@ -30,6 +30,7 @@ MOCHITEST_A11Y_FILES =\
|
||||
test_selects.html \
|
||||
test_stale.html \
|
||||
test_textbox.xul \
|
||||
test_tabs.xul \
|
||||
test_tree.xul \
|
||||
test_visibility.html \
|
||||
test_visibility.xul \
|
||||
|
70
accessible/tests/mochitest/states/test_tabs.xul
Normal file
70
accessible/tests/mochitest/states/test_tabs.xul
Normal file
@ -0,0 +1,70 @@
|
||||
<?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="Accessible XUL tabbox hierarchy tests">
|
||||
|
||||
<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="../common.js" />
|
||||
<script type="application/javascript"
|
||||
src="../role.js" />
|
||||
<script type="application/javascript"
|
||||
src="../states.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
function doTest()
|
||||
{
|
||||
testStates("tab1", 0, EXT_STATE_PINNED);
|
||||
testStates("tab2", 0, 0, 0, EXT_STATE_PINNED);
|
||||
testStates("tab3", 0, 0, 0, EXT_STATE_PINNED);
|
||||
|
||||
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=577727"
|
||||
title="Make pinned tabs distinguishable from other tabs for accessibility">
|
||||
Mozilla Bug 577727
|
||||
</a><br/>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<vbox flex="1">
|
||||
<tabbox>
|
||||
<tabs id="tabs">
|
||||
<tab id="tab1" label="tab1" pinned="true"/>
|
||||
<tab id="tab2" label="tab2" pinned="false"/>
|
||||
<tab id="tab3" label="tab3"/>
|
||||
</tabs>
|
||||
<tabpanels id="tabpanels">
|
||||
<tabpanel/>
|
||||
<tabpanel/>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
@ -834,6 +834,7 @@ GK_ATOM(percent, "percent")
|
||||
GK_ATOM(persist, "persist")
|
||||
GK_ATOM(phase, "phase")
|
||||
GK_ATOM(ping, "ping")
|
||||
GK_ATOM(pinned,"pinned")
|
||||
GK_ATOM(placeholder, "placeholder")
|
||||
GK_ATOM(plaintext, "plaintext")
|
||||
GK_ATOM(playbackrate, "playbackrate")
|
||||
|
Loading…
x
Reference in New Issue
Block a user