Closed Bug 418043 Opened 16 years ago Closed 16 years ago

add mochitest for bug 308564

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: surkov, Assigned: surkov)

References

Details

Attachments

(2 files)

Attached patch patchSplinter Review
Do not invalidate tree accessible if tree view is changed because while we recreating tree accessible we miss important events. But it's usual thing to work with tree immediately after tree view is changed.
Attachment #303827 - Flags: review?(aaronleventhal)
Status: NEW → ASSIGNED
Comment on attachment 303827 [details] [diff] [review]
patch

Surkov mentioned that this is not really just adding a test. He has an explanation.
Attachment #303827 - Flags: review?(aaronleventhal) → review?(Evan.Yan)
I put some explanation into description of the bug. But I change the bug title. If you need any additional clarification about this I will do.
Summary: mochitest for bug 308564 → don't invalidate tree when view is changed and add mochitest for bug 308564
In what kind of scenario, we will get "TreeViewChanged" event?
I can only get "TreeViewChanged" event when switch to another folder in Thunderbird. Is the dom tree node still the same or a new one when get the event? If it's the same node, I think it's reasonable to not invalidate tree accessible.
Example from mochitest:

gTreeBox.view = gView; // "TreeViewChanged" will be fired
++gView.mRowCount;
gTreeBox.rowCountChanged(0, 1); // We can't process this event correctly due to tree accessible invalidation

I don't know thunderbird implementation but I guess it's the same tree but another view because columns are the same and it doesn't make sense to create tree node. But if they will recreate tree then we fall into usual scenario and will invalidate it.
Evan, the scenario that bug 308564 was created for was the change in a tree item when the number of unread messages gets updated in a folder (for example when synchronizing with a newsgroup).
Comment on attachment 303827 [details] [diff] [review]
patch

>+  nsCOMPtr<nsIAccessibleEvent> event =
>+    new nsAccEvent(nsIAccessibleEvent::EVENT_DOM_DESTROY,
>+                   accessible, PR_FALSE);
>+  paccessible->FireAccessibleEvent(event);

This will fire accessible event for every tree item, so that when switching folders in Thunderbird, hundreds of events will be fired. I would prefer the way we do now - just invalidate and fire event for the tree accessible.

Why will recreating tree accessible make us miss events?
(In reply to comment #7)
> (From update of attachment 303827 [details] [diff] [review])
> >+  nsCOMPtr<nsIAccessibleEvent> event =
> >+    new nsAccEvent(nsIAccessibleEvent::EVENT_DOM_DESTROY,
> >+                   accessible, PR_FALSE);
> >+  paccessible->FireAccessibleEvent(event);
> 
> This will fire accessible event for every tree item, so that when switching
> folders in Thunderbird, hundreds of events will be fired. I would prefer the
> way we do now - just invalidate and fire event for the tree accessible.

But we do this in any way in nsDocAccessible::FireShowHideEvents. And tree accessible shouldn't be recreated because nothing happens with it.

> Why will recreating tree accessible make us miss events?
> 

We send delayed event to the tree and after delay we recreate it therefore we catch events before we invalidate the tree. The tree has obsolete view and we can't process event correctly.
(In reply to comment #8)
> But we do this in any way in nsDocAccessible::FireShowHideEvents.

Do we? I didn't see that.

> And tree accessible shouldn't be recreated because nothing happens with it.

Yes, I agree. However, hundreds of events seems worse to me.

> We send delayed event to the tree and after delay we recreate it therefore we
> catch events before we invalidate the tree. The tree has obsolete view and we
> can't process event correctly.
> 
If we use EVENT_DOM_DESTROY when handling "TreeViewChanged" evnet:

662     return accService->InvalidateSubtreeFor(eventShell, treeContent,
663                  nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE);

so that invalidate will take place with no delay. Then will the missing event problem get fixed?
"TreeViewChanged" event doesn't sound like a async event to me.
Comment on attachment 303827 [details] [diff] [review]
patch

clear review for now until the comment is answered/addressed.
Attachment #303827 - Flags: review?(Evan.Yan)
I don't think it helps because we always fire hide events by delays. I would agree hundreds of events isn't good but that's what's actually happen. It sounds like AI and we should do this when accessible has many removed children.
(In reply to comment #11)
> I don't think it helps because we always fire hide events by delays.

Any idea, Evan?
Could we do a trick to fire hide/show event on tree accessible but actually do not recreate it? Could we lie to screen readers?
(In reply to comment #12)
> (In reply to comment #11)
> > I don't think it helps because we always fire hide events by delays.
> 
> Any idea, Evan?
> 
Let's make clear how the event is missing first. This is my understanding, please correct me if I'm wrong.

First, Some dom event comes, which makes us invalidate the tree accessible and fire accessible events by delays. Then some other dom event comes before the tree accessible actually being invalidated and the accessible event actually getting fired. Because we're still holding the invalid tree accessible, so that we failed handling the new coming event.

If that's right, I think it would fix the problem to use a sync event so that we'll invalidate the tree accessible with no delay. Then when the new event comes, tree accessible will be recreated.

(In reply to comment #13)
> Could we do a trick to fire hide/show event on tree accessible but actually do
> not recreate it? Could we lie to screen readers?
> 
Sounds fine to me.
It's strange but it doesn't fail for me anymore. Evan, could you try it?
Attachment #306829 - Flags: review?(Evan.Yan)
Comment on attachment 306829 [details] [diff] [review]
mochitest patch only

please change the bug subject correspondingly.
Attachment #306829 - Flags: review?(Evan.Yan) → review+
Summary: don't invalidate tree when view is changed and add mochitest for bug 308564 → add mochitest for bug 308564
checked in

/cvsroot/mozilla/accessible/tests/mochitest/test_bug368835.xul,v  <--  test_bug368835.xul
new revision: 1.5; previous revision: 1.4
done

Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: