Bug 1322593 - Don't coalesce non contiguous text changes under the same accessible. r=davidb, a=gchang
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Thu, 19 Jan 2017 16:35:17 -0500
changeset 378147 babb718be60a568a490fb1458c069a3feebdd504
parent 378146 3664b17ad3c4c5d6b29133a1fe98fae73194b905
child 378148 eb3fc0d1eacef3105b18bfd8aceb5765f7ac6ef8
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb, gchang
bugs1322593
milestone53.0a2
Bug 1322593 - Don't coalesce non contiguous text changes under the same accessible. r=davidb, a=gchang
accessible/base/NotificationController.cpp
--- a/accessible/base/NotificationController.cpp
+++ b/accessible/base/NotificationController.cpp
@@ -215,46 +215,46 @@ NotificationController::QueueMutationEve
 
   if (prevEvent && prevEvent->GetEventType() == nsIAccessibleEvent::EVENT_HIDE &&
       mutEvent->IsHide()) {
     AccHideEvent* prevHide = downcast_accEvent(prevEvent);
     AccTextChangeEvent* prevTextChange = prevHide->mTextChangeEvent;
     if (prevTextChange && prevHide->Parent() == mutEvent->Parent()) {
       if (prevHide->mNextSibling == target) {
         target->AppendTextTo(prevTextChange->mModifiedText);
+        prevHide->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
       } else if (prevHide->mPrevSibling == target) {
         nsString temp;
         target->AppendTextTo(temp);
 
         uint32_t extraLen = temp.Length();
         temp += prevTextChange->mModifiedText;;
         prevTextChange->mModifiedText = temp;
         prevTextChange->mStart -= extraLen;
+        prevHide->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
       }
-
-      prevHide->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
     }
   } else if (prevEvent && mutEvent->IsShow() &&
              prevEvent->GetEventType() == nsIAccessibleEvent::EVENT_SHOW) {
     AccShowEvent* prevShow = downcast_accEvent(prevEvent);
     AccTextChangeEvent* prevTextChange = prevShow->mTextChangeEvent;
     if (prevTextChange && prevShow->Parent() == target->Parent()) {
       int32_t index = target->IndexInParent();
       int32_t prevIndex = prevShow->GetAccessible()->IndexInParent();
       if (prevIndex + 1 == index) {
         target->AppendTextTo(prevTextChange->mModifiedText);
+        prevShow->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
       } else if (index + 1 == prevIndex) {
         nsString temp;
         target->AppendTextTo(temp);
         prevTextChange->mStart -= temp.Length();
         temp += prevTextChange->mModifiedText;
         prevTextChange->mModifiedText = temp;
+        prevShow->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
       }
-
-      prevShow->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
     }
   }
 
   if (!mutEvent->mTextChangeEvent) {
     mutEvent->mTextChangeEvent =
       new AccTextChangeEvent(container, offset, text, mutEvent->IsShow(),
                              aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
   }