mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 835121 - ARIA grid should be editable by default, r=tbsaunde
This commit is contained in:
parent
7adfc5e532
commit
4bb5310087
@ -272,6 +272,16 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState)
|
||||
return true;
|
||||
}
|
||||
|
||||
case eARIAReadonlyOrEditableIfDefined:
|
||||
{
|
||||
static const TokenTypeData data(
|
||||
nsGkAtoms::aria_readonly, eBoolType,
|
||||
0, states::READONLY, states::EDITABLE);
|
||||
|
||||
MapTokenType(aElement, aState, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
case eARIARequired:
|
||||
{
|
||||
static const TokenTypeData data(
|
||||
|
@ -39,6 +39,7 @@ enum EStateRule
|
||||
eARIAPressed,
|
||||
eARIAReadonly,
|
||||
eARIAReadonlyOrEditable,
|
||||
eARIAReadonlyOrEditableIfDefined,
|
||||
eARIARequired,
|
||||
eARIASelectable,
|
||||
eReadonlyUntilEditable,
|
||||
|
@ -178,7 +178,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
|
||||
eSelect | eTable,
|
||||
states::FOCUSABLE,
|
||||
eARIAMultiSelectable,
|
||||
eARIAReadonly
|
||||
eARIAReadonlyOrEditable
|
||||
},
|
||||
{ // gridcell
|
||||
&nsGkAtoms::gridcell,
|
||||
@ -190,7 +190,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
|
||||
eTableCell,
|
||||
kNoReqStates,
|
||||
eARIASelectable,
|
||||
eARIAReadonly
|
||||
eARIAReadonlyOrEditableIfDefined
|
||||
},
|
||||
{ // group
|
||||
&nsGkAtoms::group,
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "RootAccessible.h"
|
||||
#include "States.h"
|
||||
#include "StyleInfo.h"
|
||||
#include "TableAccessible.h"
|
||||
#include "TableCellAccessible.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
@ -1597,6 +1599,22 @@ Accessible::ApplyARIAState(uint64_t* aState) const
|
||||
if (aria::MapToState(mRoleMapEntry->attributeMap1, element, aState) &&
|
||||
aria::MapToState(mRoleMapEntry->attributeMap2, element, aState))
|
||||
aria::MapToState(mRoleMapEntry->attributeMap3, element, aState);
|
||||
|
||||
// ARIA gridcell inherits editable/readonly states from the grid until it's
|
||||
// overridden.
|
||||
if (mRoleMapEntry->Is(nsGkAtoms::gridcell) &&
|
||||
!(*aState & (states::READONLY | states::EDITABLE))) {
|
||||
const TableCellAccessible* cell = AsTableCell();
|
||||
if (cell) {
|
||||
TableAccessible* table = cell->Table();
|
||||
if (table) {
|
||||
Accessible* grid = table->AsAccessible();
|
||||
uint64_t gridState = 0;
|
||||
grid->ApplyARIAState(&gridState);
|
||||
*aState |= (gridState & (states::READONLY | states::EDITABLE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -514,6 +514,8 @@ public:
|
||||
virtual TableAccessible* AsTable() { return nullptr; }
|
||||
|
||||
virtual TableCellAccessible* AsTableCell() { return nullptr; }
|
||||
const TableCellAccessible* AsTableCell() const
|
||||
{ return const_cast<Accessible*>(this)->AsTableCell(); }
|
||||
|
||||
bool IsTableRow() const { return HasGenericType(eTableRow); }
|
||||
|
||||
|
@ -110,6 +110,20 @@
|
||||
// aria-readonly
|
||||
testStates("aria_readonly_textbox", STATE_READONLY);
|
||||
|
||||
// readonly/editable on grid and gridcell
|
||||
testStates("aria_grid_default", 0, EXT_STATE_EDITABLE,
|
||||
STATE_READONLY, 0);
|
||||
testStates("aria_grid_default_cell_readonly", STATE_READONLY, 0,
|
||||
0, EXT_STATE_EDITABLE);
|
||||
testStates("aria_grid_default_cell_inherited", 0, EXT_STATE_EDITABLE,
|
||||
STATE_READONLY, 0);
|
||||
testStates("aria_grid_readonly", STATE_READONLY, 0,
|
||||
0, EXT_STATE_EDITABLE);
|
||||
testStates("aria_grid_readonly_cell_editable", 0, EXT_STATE_EDITABLE,
|
||||
STATE_READONLY, 0);
|
||||
testStates("aria_grid_readonly_cell_inherited", STATE_READONLY, 0,
|
||||
0, EXT_STATE_EDITABLE);
|
||||
|
||||
// aria-selectable
|
||||
testStates("aria_selectable_listitem", STATE_SELECTABLE | STATE_SELECTED);
|
||||
|
||||
@ -230,6 +244,11 @@
|
||||
title="fix default horizontal / vertical state of role=scrollbar and ensure only one of horizontal / vertical states is exposed">
|
||||
Mozilla Bug 762876
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=835121
|
||||
title="ARIA grid should be editable by default">
|
||||
Mozilla Bug 835121
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
@ -265,7 +284,26 @@
|
||||
<div id="aria_multiline_textbox" role="textbox" aria-multiline="true"></div>
|
||||
<div id="aria_multiselectable_listbox" role="listbox" aria-multiselectable="true"></div>
|
||||
<div id="aria_pressed_button" role="button" aria-pressed="true">Button</div>
|
||||
<div id="aria_readonly_textbox" role="textbox" aria-readonly="true">This text should be readonly</div>
|
||||
|
||||
<div id="aria_readonly_textbox"
|
||||
role="textbox" aria-readonly="true">This text should be readonly</div>
|
||||
|
||||
<div id="aria_grid_default" role="grid">
|
||||
<div role="row">
|
||||
<div id="aria_grid_default_cell_readonly"
|
||||
role="gridcell" aria-readonly="true">gridcell1</div>
|
||||
<div id="aria_grid_default_cell_inherited"
|
||||
role="gridcell">gridcell2</div>
|
||||
</div>
|
||||
|
||||
<div id="aria_grid_readonly" role="grid" aria-readonly="true">
|
||||
<div role="row">
|
||||
<div id="aria_grid_readonly_cell_editable"
|
||||
role="gridcell" aria-readonly="false">gridcell1</div>
|
||||
<div id="aria_grid_readonly_cell_inherited"
|
||||
role="gridcell">gridcell2</div>
|
||||
</div>
|
||||
|
||||
<div role="listbox">
|
||||
<div id="aria_selectable_listitem" role="option" aria-selected="true">Item1</div>
|
||||
</div>
|
||||
@ -313,7 +351,7 @@
|
||||
<a id="aria_application_link" role="application" href="foo">app</a>
|
||||
<a id="aria_main_link" role="main" href="foo">main</a>
|
||||
<a id="aria_navigation_link" role="navigation" href="foo">nav</a>
|
||||
|
||||
|
||||
<!-- landmarks: anchors -->
|
||||
<a id="aria_application_anchor" role="application" name="app_anchor">app</a>
|
||||
<a id="aria_main_anchor" role="main" name="main_anchor">main</a>
|
||||
|
Loading…
Reference in New Issue
Block a user