From 8c661b3531dc93311e3622308b38e5cf5b1b9f78 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Thu, 12 Dec 2013 15:08:29 -0500 Subject: [PATCH] bug 883708 - don't assert when parent of reorder event is shown later r=surkov --- accessible/src/base/EventQueue.cpp | 13 ++++---- .../tests/mochitest/treeupdate/a11y.ini | 1 + .../mochitest/treeupdate/test_bug883708.xhtml | 33 +++++++++++++++++++ 3 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 accessible/tests/mochitest/treeupdate/test_bug883708.xhtml diff --git a/accessible/src/base/EventQueue.cpp b/accessible/src/base/EventQueue.cpp index 2e5b162fbede..b0a485f5937e 100644 --- a/accessible/src/base/EventQueue.cpp +++ b/accessible/src/base/EventQueue.cpp @@ -226,9 +226,7 @@ EventQueue::CoalesceReorderEvents(AccEvent* aTailEvent) // If tailEvent contains thisEvent // then - // if show of tailEvent contains a grand parent of thisEvent - // then assert - // else if hide of tailEvent contains a grand parent of thisEvent + // if show or hide of tailEvent contains a grand parent of thisEvent // then ignore thisEvent and its show and hide events // otherwise ignore thisEvent but not its show and hide events Accessible* thisParent = thisEvent->mAccessible; @@ -237,9 +235,12 @@ EventQueue::CoalesceReorderEvents(AccEvent* aTailEvent) AccReorderEvent* tailReorder = downcast_accEvent(aTailEvent); uint32_t eventType = tailReorder->IsShowHideEventTarget(thisParent); - if (eventType == nsIAccessibleEvent::EVENT_SHOW) { - NS_ERROR("Accessible tree was created after it was modified! Huh?"); - } else if (eventType == nsIAccessibleEvent::EVENT_HIDE) { + // Sometimes InvalidateChildren() and + // DocAccessible::CacheChildrenInSubtree() can conspire to reparent an + // accessible in this case no need for mutation events. Se bug 883708 + // for details. + if (eventType == nsIAccessibleEvent::EVENT_SHOW || + eventType == nsIAccessibleEvent::EVENT_HIDE) { AccReorderEvent* thisReorder = downcast_accEvent(thisEvent); thisReorder->DoNotEmitAll(); } else { diff --git a/accessible/tests/mochitest/treeupdate/a11y.ini b/accessible/tests/mochitest/treeupdate/a11y.ini index ed670758255b..0d64f6ef2be2 100644 --- a/accessible/tests/mochitest/treeupdate/a11y.ini +++ b/accessible/tests/mochitest/treeupdate/a11y.ini @@ -2,6 +2,7 @@ [test_ariadialog.html] [test_bug852150.xhtml] +[test_bug883708.xhtml] [test_bug895082.html] [test_canvas.html] [test_colorpicker.xul] diff --git a/accessible/tests/mochitest/treeupdate/test_bug883708.xhtml b/accessible/tests/mochitest/treeupdate/test_bug883708.xhtml new file mode 100644 index 000000000000..6265a1c7f00e --- /dev/null +++ b/accessible/tests/mochitest/treeupdate/test_bug883708.xhtml @@ -0,0 +1,33 @@ + + + + + + + + + + Mozilla Bug 883708 + + +

+ +
+  
+ +
+