Don't traverse pivot inside of ignored subtree.

RESOLVED FIXED in mozilla25

Status

()

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: eeejay, Assigned: eeejay)

Tracking

unspecified
mozilla25
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
The pivot position could be inside of an ignored subtree because:
1. A previous traversal rule did not ignore that subtree.
2. A parent node has changed in a way that now its subtree should be ignored.

When we are in this state, doing a moveNext or movePrevious should not move to a node that is supposed to be pruned by the current rule.
(Assignee)

Comment 1

5 years ago
Created attachment 774144 [details] [diff] [review]
Start pivot searches from outside the ignored subtree.
Attachment #774144 - Flags: review?(surkov.alexander)
Comment on attachment 774144 [details] [diff] [review]
Start pivot searches from outside the ignored subtree.

Review of attachment 774144 [details] [diff] [review]:
-----------------------------------------------------------------

otherwise it looks ok

::: accessible/src/base/nsAccessiblePivot.cpp
@@ +423,5 @@
> +{
> +  Accessible* matched = aAccessible;
> +  *aResult = aCache.ApplyFilter(aAccessible, aFilterResult);
> +
> +  if (aAccessible != mRoot) {

active root I guess

::: accessible/src/base/nsAccessiblePivot.h
@@ +96,5 @@
> +   */
> +  Accessible* GetSearchStartPosition(Accessible* aAccessible,
> +                                     RuleCache& aCache,
> +                                     uint16_t* aFilterResult,
> +                                     nsresult* aResult);

maybe AdjustStartPosition and I'd like to see extended comment describing why the given anchor may be changed

::: accessible/tests/mochitest/pivot.js
@@ +71,5 @@
>  
>  /**
> + * A checker for virtual cursor changed by assignment events.
> + */
> +function VCSimpleChangedChecker(aDocAcc)

I'd name it as VCChangedReasonNoneChecker or would pass reason as an argument

@@ +207,5 @@
>   * @param aRule            [in] traversal rule object
>   * @param aIdOrNameOrAcc   [in] id, accessible or accessible name to expect
>   *                         virtual cursor to land on after performing move method.
>   *                         false if no move is expected.
> + * @param aInitialPos      [in] initial vc position to set before move.

position setting is kind of movement, doesn't it work if you handle it as two separate queue items

@@ +223,4 @@
>      VCChangedChecker.
>        storePreviousPosAndOffset(aDocAcc.virtualCursor);
>      var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aRule);
> +    SimpleTest.is(!!moved, !!expectMove,

I bet that if !!a == !!b then a == b
Attachment #774144 - Flags: review?(surkov.alexander) → review+
(Assignee)

Comment 3

5 years ago
(In reply to alexander :surkov from comment #2)
> Comment on attachment 774144 [details] [diff] [review]
> Start pivot searches from outside the ignored subtree.
> 
> Review of attachment 774144 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> otherwise it looks ok
> 
> ::: accessible/src/base/nsAccessiblePivot.cpp
> @@ +423,5 @@
> > +{
> > +  Accessible* matched = aAccessible;
> > +  *aResult = aCache.ApplyFilter(aAccessible, aFilterResult);
> > +
> > +  if (aAccessible != mRoot) {
> 
> active root I guess

Should check for both actually, don't want to drift beyond the pivot root if the position is not in the mModalRoot.

> 
> ::: accessible/src/base/nsAccessiblePivot.h
> @@ +96,5 @@
> > +   */
> > +  Accessible* GetSearchStartPosition(Accessible* aAccessible,
> > +                                     RuleCache& aCache,
> > +                                     uint16_t* aFilterResult,
> > +                                     nsresult* aResult);
> 
> maybe AdjustStartPosition and I'd like to see extended comment describing
> why the given anchor may be changed
> 

Sounds good, done.

> ::: accessible/tests/mochitest/pivot.js
> @@ +71,5 @@
> >  
> >  /**
> > + * A checker for virtual cursor changed by assignment events.
> > + */
> > +function VCSimpleChangedChecker(aDocAcc)
> 
> I'd name it as VCChangedReasonNoneChecker or would pass reason as an argument
> 

Yeah, we could do the latter. Originally it wasn't working for me because I was getting dupe event errors, but now I learned to use the match method in the checker.

> @@ +207,5 @@
> >   * @param aRule            [in] traversal rule object
> >   * @param aIdOrNameOrAcc   [in] id, accessible or accessible name to expect
> >   *                         virtual cursor to land on after performing move method.
> >   *                         false if no move is expected.
> > + * @param aInitialPos      [in] initial vc position to set before move.
> 
> position setting is kind of movement, doesn't it work if you handle it as
> two separate queue items
> 

Yeah, good point. I'll separate it.

> @@ +223,4 @@
> >      VCChangedChecker.
> >        storePreviousPosAndOffset(aDocAcc.virtualCursor);
> >      var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aRule);
> > +    SimpleTest.is(!!moved, !!expectMove,
> 
> I bet that if !!a == !!b then a == b

Not really, a could be true, and b could be 1, or a can be false and b can be "". Double ! is like casting to boolean.
(Assignee)

Comment 4

5 years ago
Created attachment 775924 [details] [diff] [review]
Bug 892607 - Start pivot searches from outside the ignored subtree. r=surkov
Attachment #774144 - Attachment is obsolete: true
(In reply to Eitan Isaacson [:eeejay] from comment #3)

> > >      VCChangedChecker.
> > >        storePreviousPosAndOffset(aDocAcc.virtualCursor);
> > >      var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aRule);
> > > +    SimpleTest.is(!!moved, !!expectMove,
> > 
> > I bet that if !!a == !!b then a == b
> 
> Not really, a could be true, and b could be 1, or a can be false and b can
> be "". Double ! is like casting to boolean.

a small comment would be nice

Comment 6

5 years ago
https://hg.mozilla.org/mozilla-central/rev/e33505d7b796
Assignee: nobody → eitan
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.