зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1662150: Add AXTableSearchKey to rotor r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D88892
This commit is contained in:
Родитель
75065bec8a
Коммит
4b9df7104c
|
@ -192,6 +192,13 @@ using namespace mozilla::a11y;
|
|||
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
|
||||
}
|
||||
|
||||
if ([key isEqualToString:@"AXTableSearchKey"]) {
|
||||
RotorTableRule rule = mImmediateDescendantsOnly
|
||||
? RotorTableRule(mStartElem)
|
||||
: RotorTableRule();
|
||||
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
|
||||
}
|
||||
|
||||
if ([key isEqualToString:@"AXLandmarkSearchKey"]) {
|
||||
RotorLandmarkRule rule = mImmediateDescendantsOnly
|
||||
? RotorLandmarkRule(mStartElem)
|
||||
|
|
|
@ -27,6 +27,12 @@ class RotorArticleRule final : public PivotRoleRule {
|
|||
explicit RotorArticleRule(AccessibleOrProxy& aDirectDescendantsFrom);
|
||||
};
|
||||
|
||||
class RotorTableRule final : public PivotRoleRule {
|
||||
public:
|
||||
explicit RotorTableRule();
|
||||
explicit RotorTableRule(AccessibleOrProxy& aDirectDescendantsFrom);
|
||||
};
|
||||
|
||||
class RotorLandmarkRule final : public PivotRoleRule {
|
||||
public:
|
||||
explicit RotorLandmarkRule();
|
||||
|
|
|
@ -24,6 +24,11 @@ RotorArticleRule::RotorArticleRule() : PivotRoleRule(roles::ARTICLE) {}
|
|||
RotorArticleRule::RotorArticleRule(AccessibleOrProxy& aDirectDescendantsFrom)
|
||||
: PivotRoleRule(roles::ARTICLE, aDirectDescendantsFrom) {}
|
||||
|
||||
RotorTableRule::RotorTableRule() : PivotRoleRule(roles::TABLE) {}
|
||||
|
||||
RotorTableRule::RotorTableRule(AccessibleOrProxy& aDirectDescendantsFrom)
|
||||
: PivotRoleRule(roles::TABLE, aDirectDescendantsFrom) {}
|
||||
|
||||
RotorLandmarkRule::RotorLandmarkRule() : PivotRoleRule(roles::LANDMARK) {}
|
||||
|
||||
RotorLandmarkRule::RotorLandmarkRule(AccessibleOrProxy& aDirectDescendantsFrom)
|
||||
|
|
|
@ -118,6 +118,136 @@ addAccessibleTask(
|
|||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test rotor with tables
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`
|
||||
<table id="shapes">
|
||||
<tr>
|
||||
<th>Shape</th>
|
||||
<th>Color</th>
|
||||
<th>Do I like it?</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Triangle</td>
|
||||
<td>Green</td>
|
||||
<td>No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Square</td>
|
||||
<td>Red</td>
|
||||
<td>Yes</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table id="food">
|
||||
<tr>
|
||||
<th>Grocery Item</th>
|
||||
<th>Quantity</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Onions</td>
|
||||
<td>2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Yogurt</td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Spinach</td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cherries</td>
|
||||
<td>12</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Carrots</td>
|
||||
<td>5</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<div role="table" id="ariaTable">
|
||||
<div role="row">
|
||||
<div role="cell">
|
||||
I am a tiny aria table
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<table role="grid" id="grid">
|
||||
<tr>
|
||||
<th>A</th>
|
||||
<th>B</th>
|
||||
<th>C</th>
|
||||
<th>D</th>
|
||||
<th>E</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>F</th>
|
||||
<th>G</th>
|
||||
<th>H</th>
|
||||
<th>I</th>
|
||||
<th>J</th>
|
||||
</tr>
|
||||
</table>
|
||||
`,
|
||||
async (browser, accDoc) => {
|
||||
const searchPred = {
|
||||
AXSearchKey: "AXTableSearchKey",
|
||||
AXImmediateDescendants: 1,
|
||||
AXResultsLimit: -1,
|
||||
AXDirection: "AXDirectionNext",
|
||||
};
|
||||
|
||||
const webArea = accDoc.nativeInterface.QueryInterface(
|
||||
Ci.nsIAccessibleMacInterface
|
||||
);
|
||||
is(
|
||||
webArea.getAttributeValue("AXRole"),
|
||||
"AXWebArea",
|
||||
"Got web area accessible"
|
||||
);
|
||||
|
||||
const tableCount = webArea.getParameterizedAttributeValue(
|
||||
"AXUIElementCountForSearchPredicate",
|
||||
NSDictionary(searchPred)
|
||||
);
|
||||
is(4, tableCount, "Found four tables");
|
||||
|
||||
const tables = webArea.getParameterizedAttributeValue(
|
||||
"AXUIElementsForSearchPredicate",
|
||||
NSDictionary(searchPred)
|
||||
);
|
||||
const shapes = getNativeInterface(accDoc, "shapes");
|
||||
const food = getNativeInterface(accDoc, "food");
|
||||
const ariaTable = getNativeInterface(accDoc, "ariaTable");
|
||||
const grid = getNativeInterface(accDoc, "grid");
|
||||
|
||||
is(
|
||||
shapes.getAttributeValue("AXColumnCount"),
|
||||
tables[0].getAttributeValue("AXColumnCount"),
|
||||
"Found correct first table"
|
||||
);
|
||||
is(
|
||||
food.getAttributeValue("AXColumnCount"),
|
||||
tables[1].getAttributeValue("AXColumnCount"),
|
||||
"Found correct second table"
|
||||
);
|
||||
is(
|
||||
ariaTable.getAttributeValue("AXColumnCount"),
|
||||
tables[2].getAttributeValue("AXColumnCount"),
|
||||
"Found correct third table"
|
||||
);
|
||||
is(
|
||||
grid.getAttributeValue("AXColumnCount"),
|
||||
tables[3].getAttributeValue("AXColumnCount"),
|
||||
"Found correct fourth table"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test rotor with landmarks
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче