From cf0319510266f78392252dc3eb6e4681c0c78738 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Mon, 1 Feb 2016 17:05:45 -0500 Subject: [PATCH] Bug 1220502 - ignore not visible text nodes for tree update, r=tbsaunde, roc --- accessible/base/NotificationController.h | 11 +++++++++-- layout/generic/nsTextFrame.cpp | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h index 946b7964f0c..ab106fc00c1 100644 --- a/accessible/base/NotificationController.h +++ b/accessible/base/NotificationController.h @@ -122,8 +122,15 @@ public: */ 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(); } /** diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 8010ecac81c..8ebe07807c2 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -8498,7 +8498,9 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth, #ifdef ACCESSIBILITY // Schedule the update of accessible tree since rendered text might be changed. - ReflowTextA11yNotifier(presContext, mContent); + if (StyleVisibility()->IsVisible()) { + ReflowTextA11yNotifier(presContext, mContent); + } #endif /////////////////////////////////////////////////////////////////////