Bug 1220502 - ignore not visible text nodes for tree update, r=tbsaunde,roc a=sylvestre
authorAlexander Surkov <surkov.alexander@gmail.com>
Mon, 01 Feb 2016 17:05:45 -0500
changeset 304020 e397f9ecd8310d03ef19ed9381caf89a137d187a
parent 304019 e0f6a424331b99f49b9e74ca8e29276828af3ecd
child 304021 1803328a709c1a84ba8aadeb203b8a85eae6ef18
push id9089
push userkwierso@gmail.com
push dateThu, 18 Feb 2016 00:04:26 +0000
treeherdermozilla-aurora@0add2d397bc6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde, roc, sylvestre
bugs1220502
milestone46.0a2
Bug 1220502 - ignore not visible text nodes for tree update, r=tbsaunde,roc a=sylvestre
accessible/base/NotificationController.h
layout/generic/nsTextFrame.cpp
--- a/accessible/base/NotificationController.h
+++ b/accessible/base/NotificationController.h
@@ -117,18 +117,25 @@ public:
    */
   void ScheduleChildDocBinding(DocAccessible* aDocument);
 
   /**
    * Schedule the accessible tree update because of rendered text changes.
    */
   inline void ScheduleTextUpdate(nsIContent* aTextNode)
   {
-    if (mTextHash.PutEntry(aTextNode))
-      ScheduleProcessing();
+    // Make sure we are not called with a node that is not in the DOM tree or
+    // not visible.
+    MOZ_ASSERT(aTextNode->GetParentNode(), "A text node is not in DOM");
+    MOZ_ASSERT(aTextNode->GetPrimaryFrame(), "A text node doesn't have a frame");
+    MOZ_ASSERT(aTextNode->GetPrimaryFrame()->StyleVisibility()->IsVisible(),
+               "A text node is not visible");
+
+    mTextHash.PutEntry(aTextNode);
+    ScheduleProcessing();
   }
 
   /**
    * Pend accessible tree update for content insertion.
    */
   void ScheduleContentInsertion(Accessible* aContainer,
                                 nsIContent* aStartChildNode,
                                 nsIContent* aEndChildNode);
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -8496,17 +8496,19 @@ nsTextFrame::ReflowText(nsLineLayout& aL
   ListTag(stdout);
   printf(": BeginReflow: availableWidth=%d\n", aAvailableWidth);
 #endif
 
   nsPresContext* presContext = PresContext();
 
 #ifdef ACCESSIBILITY
   // Schedule the update of accessible tree since rendered text might be changed.
-  ReflowTextA11yNotifier(presContext, mContent);
+  if (StyleVisibility()->IsVisible()) {
+    ReflowTextA11yNotifier(presContext, mContent);
+  }
 #endif
 
   /////////////////////////////////////////////////////////////////////
   // Set up flags and clear out state
   /////////////////////////////////////////////////////////////////////
 
   // Clear out the reflow state flags in mState. We also clear the whitespace
   // flags because this can change whether the frame maps whitespace-only text