Bug 1220502 - ignore not visible text nodes for tree update, r=tbsaunde, roc
authorAlexander Surkov <surkov.alexander@gmail.com>
Mon, 01 Feb 2016 17:05:45 -0500
changeset 282573 c3dd7dab0b0018d1adc5ce6e3daf173ce812490b
parent 282572 53354197432f5f80d3bdcd7aaca801b09c85c239
child 282574 512497f6a7edcdbff533e4adc8f400de5b2845c0
push id71229
push usersurkov.alexander@gmail.com
push dateMon, 01 Feb 2016 22:06:05 +0000
treeherdermozilla-inbound@c3dd7dab0b00 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde, roc
bugs1220502
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1220502 - ignore not visible text nodes for tree update, r=tbsaunde, roc
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
@@ -8493,17 +8493,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