Bug 1520611 - Add pivot prune prefilter, use it in jsat. r=yzen

Differential Revision: https://phabricator.services.mozilla.com/D16742

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eitan Isaacson 2019-01-22 19:49:00 +00:00
Родитель 112ac1fb11
Коммит 89f866d37a
4 изменённых файлов: 25 добавлений и 15 удалений

Просмотреть файл

@ -847,6 +847,11 @@ nsresult RuleCache::ApplyFilter(Accessible* aAccessible, uint16_t* aResult) {
if (mPreFilter) {
uint64_t state = aAccessible->State();
if ((nsIAccessibleTraversalRule::PREFILTER_PLATFORM_PRUNED & mPreFilter) &&
nsAccUtils::MustPrune(aAccessible)) {
*aResult |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
}
if ((nsIAccessibleTraversalRule::PREFILTER_INVISIBLE & mPreFilter) &&
(state & states::INVISIBLE))
return NS_OK;
@ -879,5 +884,10 @@ nsresult RuleCache::ApplyFilter(Accessible* aAccessible, uint16_t* aResult) {
if (!matchesRole) return NS_OK;
}
return mRule->Match(ToXPC(aAccessible), aResult);
uint16_t matchResult = nsIAccessibleTraversalRule::FILTER_IGNORE;
nsresult rv = mRule->Match(ToXPC(aAccessible), &matchResult);
if (NS_SUCCEEDED(rv)) {
*aResult |= matchResult;
}
return rv;
}

Просмотреть файл

@ -227,11 +227,11 @@ interface nsIAccessibleTraversalRule : nsISupports
const unsigned short FILTER_IGNORE_SUBTREE = 0x2;
/* Pre-filters */
const unsigned long PREFILTER_INVISIBLE = 0x00000001;
const unsigned long PREFILTER_OFFSCREEN = 0x00000002;
const unsigned long PREFILTER_NOT_FOCUSABLE = 0x00000004;
const unsigned long PREFILTER_TRANSPARENT = 0x00000008;
const unsigned long PREFILTER_INVISIBLE = 0x00000001;
const unsigned long PREFILTER_OFFSCREEN = 0x00000002;
const unsigned long PREFILTER_NOT_FOCUSABLE = 0x00000004;
const unsigned long PREFILTER_TRANSPARENT = 0x00000008;
const unsigned long PREFILTER_PLATFORM_PRUNED = 0x00000010;
/**
* Pre-filter bitfield to filter out obviously ignorable nodes and lighten
* the load on match().

Просмотреть файл

@ -166,15 +166,15 @@ var gSimpleMatchFunc = function gSimpleMatchFunc(aAccessible) {
var gSimplePreFilter = Prefilters.DEFUNCT |
Prefilters.INVISIBLE |
Prefilters.TRANSPARENT;
Prefilters.TRANSPARENT |
Prefilters.PLATFORM_PRUNED;
var TraversalRules = { // jshint ignore:line
Simple: new BaseTraversalRule(gSimpleTraversalRoles, gSimpleMatchFunc),
SimpleOnScreen: new BaseTraversalRule(
gSimpleTraversalRoles, gSimpleMatchFunc,
Prefilters.DEFUNCT | Prefilters.INVISIBLE |
Prefilters.TRANSPARENT | Prefilters.OFFSCREEN),
gSimplePreFilter | Prefilters.OFFSCREEN),
Anchor: new BaseTraversalRule(
[Roles.LINK],

Просмотреть файл

@ -117,13 +117,13 @@
"4. Standard Lisp", "link-0", " Lisp",
"checkbox-1-5", " LeLisp", "• JavaScript",
"heading-5", "image-1", "image-2", "image-3",
"Not actually an image", "link-1", "anchor-1",
"link-2", "anchor-2", "link-3", "3", "1", "4",
"1", "Sunday", "M", "Week 1", "3", "4", "7", "2",
"5 8", "gridcell4", "Just an innocuous separator",
"link-1", "anchor-1", "link-2", "anchor-2",
"link-3", "3", "1", "4", "1", "Sunday", "M",
"Week 1", "3", "4", "7", "2", "5 8", "gridcell4",
"Dirty Words", "Meaning", "Mud", "Wet Dirt",
"Dirt", "Messy Stuff", "statusbar-1", "statusbar-2",
"switch-1", "This is a MathML formula ", "math-1",
"Dirt", "Messy Stuff", "statusbar-1",
"statusbar-2", "switch-1",
"This is a MathML formula ", "math-1",
"with some text after."]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Landmark, null,