Bug 1547535 - Move all a11y code in nsIPresShell to mozilla::PresShell r=Jamie
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 30 Apr 2019 07:53:20 +0000
changeset 530698 8551820a482fd3cadd64b498514020480ff0e275
parent 530697 1e0e71568ab6fd65275cd079acd26d6e05a75ac7
child 530699 5d8653071324fa61f37cee5d1beee64da5f82e06
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamie
bugs1547535
milestone68.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 1547535 - Move all a11y code in nsIPresShell to mozilla::PresShell r=Jamie Differential Revision: https://phabricator.services.mozilla.com/D29196
dom/ipc/ContentParent.cpp
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsIPresShell.h
layout/forms/nsRangeFrame.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsPluginFrame.cpp
layout/generic/nsTextFrame.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -98,16 +98,17 @@
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/media/MediaParent.h"
 #include "mozilla/Move.h"
 #include "mozilla/net/NeckoParent.h"
 #include "mozilla/net/CookieServiceParent.h"
 #include "mozilla/net/PCookieServiceParent.h"
 #include "mozilla/plugins/PluginBridge.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/ProcessHangMonitor.h"
 #include "mozilla/ProcessHangMonitorIPC.h"
 #include "mozilla/RDDProcessManager.h"
 #include "mozilla/recordreplay/ParentIPC.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/ScriptPreloader.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
@@ -153,17 +154,16 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsILocalStorageManager.h"
 #include "nsIMemoryInfoDumper.h"
 #include "nsIMemoryReporter.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsIMutable.h"
 #include "nsIObserverService.h"
 #include "nsIParentChannel.h"
-#include "nsIPresShell.h"
 #include "nsIRemoteWindowContext.h"
 #include "nsIScriptError.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsISearchService.h"
 #include "nsIServiceWorkerManager.h"
 #include "nsISiteSecurityService.h"
 #include "nsISound.h"
 #include "mozilla/mozSpellChecker.h"
@@ -1276,29 +1276,29 @@ void ContentParent::Init() {
     cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
     obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-created",
                          cpId.get());
   }
 
 #ifdef ACCESSIBILITY
   // If accessibility is running in chrome process then start it in content
   // process.
-  if (nsIPresShell::IsAccessibilityActive()) {
+  if (PresShell::IsAccessibilityActive()) {
 #  if defined(XP_WIN)
     // Don't init content a11y if we detect an incompat version of JAWS in use.
     if (!mozilla::a11y::Compatibility::IsOldJAWS()) {
       Unused << SendActivateA11y(
           ::GetCurrentThreadId(),
           a11y::AccessibleWrap::GetContentProcessIdFor(ChildID()));
     }
 #  else
     Unused << SendActivateA11y(0, 0);
 #  endif
   }
-#endif
+#endif  // #ifdef ACCESSIBILITY
 
 #ifdef MOZ_GECKO_PROFILER
   Unused << SendInitProfiler(ProfilerParent::CreateForProcess(OtherPid()));
 #endif
 
   // Ensure that the default set of permissions are avaliable in the content
   // process before we try to load any URIs in it.
   EnsurePermissionsByKey(EmptyCString());
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -764,19 +764,16 @@ bool PresShell::AccessibleCaretEnabled(n
   }
   // Otherwise, disabled.
   return false;
 }
 
 nsIPresShell::nsIPresShell()
     : mViewManager(nullptr),
       mFrameManager(nullptr),
-#ifdef ACCESSIBILITY
-      mDocAccessible(nullptr),
-#endif
       mPaintCount(0),
       mAutoWeakFrames(nullptr),
       mCanvasBackgroundColor(NS_RGBA(0, 0, 0, 0)),
       mSelectionFlags(0),
       mChangeNestCount(0),
       mRenderFlags(0),
       mDidInitialize(false),
       mIsDestroying(false),
@@ -810,16 +807,19 @@ nsIPresShell::nsIPresShell()
       mFontSizeInflationLineThreshold(0),
       mInFlush(false),
       mCurrentEventFrame(nullptr) {
 }
 
 PresShell::PresShell()
     : mCaretEnabled(false),
       mMouseLocation(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
+#ifdef ACCESSIBILITY
+      mDocAccessible(nullptr),
+#endif  // #ifdef ACCESSIBILITY
       mAPZFocusSequenceNumber(0),
       mActiveSuppressDisplayport(0),
       mNeedLayoutFlush(true),
       mNeedStyleFlush(true),
       mNeedThrottledAnimationFlush(true),
       mVisualViewportSizeSet(false),
       mDocumentLoading(false),
       mNoDelayedMouseEvents(false),
@@ -3158,20 +3158,21 @@ nsresult PresShell::GoToAnchor(const nsA
         // Scroll to the top of the page
         sf->ScrollTo(nsPoint(0, 0), ScrollMode::Instant);
       }
     }
   }
 
 #ifdef ACCESSIBILITY
   if (anchorTarget) {
-    nsAccessibilityService* accService = AccService();
-    if (accService) accService->NotifyOfAnchorJumpTo(anchorTarget);
-  }
-#endif
+    if (nsAccessibilityService* accService = GetAccessibilityService()) {
+      accService->NotifyOfAnchorJumpTo(anchorTarget);
+    }
+  }
+#endif  // #ifdef ACCESSIBILITY
 
   return rv;
 }
 
 nsresult PresShell::ScrollToAnchor() {
   if (!mLastAnchorScrolledTo) {
     return NS_OK;
   }
@@ -10351,22 +10352,26 @@ void ReflowCountMgr::DisplayDiffsInTotal
 #endif  // MOZ_REFLOW_PERF
 
 nsIFrame* nsIPresShell::GetAbsoluteContainingBlock(nsIFrame* aFrame) {
   return FrameConstructor()->GetAbsoluteContainingBlock(
       aFrame, nsCSSFrameConstructor::ABS_POS);
 }
 
 #ifdef ACCESSIBILITY
-bool nsIPresShell::IsAccessibilityActive() {
-  return GetAccService() != nullptr;
-}
-
-nsAccessibilityService* nsIPresShell::AccService() { return GetAccService(); }
-#endif
+
+// static
+bool PresShell::IsAccessibilityActive() { return GetAccService() != nullptr; }
+
+// static
+nsAccessibilityService* PresShell::GetAccessibilityService() {
+  return GetAccService();
+}
+
+#endif  // #ifdef ACCESSIBILITY
 
 // Asks our docshell whether we're active.
 void PresShell::QueryIsActive() {
   nsCOMPtr<nsISupports> container = mPresContext->GetContainerWeak();
   if (mDocument) {
     Document* displayDoc = mDocument->GetDisplayDocument();
     if (displayDoc) {
       // Ok, we're an external resource document -- we need to use our display
@@ -10429,22 +10434,22 @@ nsresult PresShell::SetIsActive(bool aIs
 
   // Propagate state-change to my resource documents' PresShells
   mDocument->EnumerateExternalResources(SetExternalResourceIsActive,
                                         &aIsActive);
   mDocument->EnumerateActivityObservers(SetPluginIsActive, &aIsActive);
   nsresult rv = UpdateImageLockingState();
 #ifdef ACCESSIBILITY
   if (aIsActive) {
-    nsAccessibilityService* accService = AccService();
-    if (accService) {
+    if (nsAccessibilityService* accService =
+            PresShell::GetAccessibilityService()) {
       accService->PresShellActivated(this);
     }
   }
-#endif
+#endif  // #ifdef ACCESSIBILITY
   return rv;
 }
 
 RefPtr<MobileViewportManager> PresShell::GetMobileViewportManager() const {
   return mMobileViewportManager;
 }
 
 void PresShell::UpdateViewportOverridden(bool aAfterInitialization) {
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -106,16 +106,40 @@ class PresShell final : public nsIPresSh
   }
 
   static void ClearMouseCaptureOnView(nsView* aView);
 
   // If a frame in the subtree rooted at aFrame is capturing the mouse then
   // clears that capture.
   static void ClearMouseCapture(nsIFrame* aFrame);
 
+#ifdef ACCESSIBILITY
+  /**
+   * Return the document accessible for this PresShell if there is one.
+   */
+  a11y::DocAccessible* GetDocAccessible() const { return mDocAccessible; }
+
+  /**
+   * Set the document accessible for this PresShell.
+   */
+  void SetDocAccessible(a11y::DocAccessible* aDocAccessible) {
+    mDocAccessible = aDocAccessible;
+  }
+
+  /**
+   * Return true if accessibility is active.
+   */
+  static bool IsAccessibilityActive();
+
+  /**
+   * Return accessibility service if accessibility is active.
+   */
+  static nsAccessibilityService* GetAccessibilityService();
+#endif  // #ifdef ACCESSIBILITY
+
   void Init(Document*, nsPresContext*, nsViewManager*);
   void Destroy() override;
 
   NS_IMETHOD GetSelectionFromScript(RawSelectionType aRawSelectionType,
                                     dom::Selection** aSelection) override;
   dom::Selection* GetSelection(RawSelectionType aRawSelectionType) override;
 
   dom::Selection* GetCurrentSelection(SelectionType aSelectionType) override;
@@ -1774,16 +1798,20 @@ class PresShell final : public nsIPresSh
 
   // Information needed to properly handle scrolling content into view if the
   // pre-scroll reflow flush can be interrupted.  mContentToScrollTo is non-null
   // between the initial scroll attempt and the first time we finish processing
   // all our dirty roots.  mContentToScrollTo has a content property storing the
   // details for the scroll operation, see ScrollIntoViewData above.
   nsCOMPtr<nsIContent> mContentToScrollTo;
 
+#ifdef ACCESSIBILITY
+  a11y::DocAccessible* mDocAccessible;
+#endif  // #ifdef ACCESSIBILITY
+
   nsSize mVisualViewportSize;
 
   mozilla::Maybe<nsPoint> mVisualViewportOffset;
 
   TimeStamp mLastOSWake;
 
   // The focus sequence number of the last processed input event
   uint64_t mAPZFocusSequenceNumber;
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -6882,17 +6882,18 @@ void nsCSSFrameConstructor::ContentAppen
 #ifdef DEBUG
   if (gReallyNoisyContentUpdates) {
     printf("nsCSSFrameConstructor::ContentAppended: resulting frame model:\n");
     parentFrame->List(stdout);
   }
 #endif
 
 #ifdef ACCESSIBILITY
-  if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
+  if (nsAccessibilityService* accService =
+          PresShell::GetAccessibilityService()) {
     accService->ContentRangeInserted(mPresShell, aFirstNewContent, nullptr);
   }
 #endif
 }
 
 void nsCSSFrameConstructor::ContentInserted(nsIContent* aChild,
                                             nsILayoutHistoryState* aFrameState,
                                             InsertionKind aInsertionKind) {
@@ -6994,17 +6995,18 @@ void nsCSSFrameConstructor::ContentRange
     if (aFrameState) {
       // Restore frame state for the root scroll frame if there is one
       if (nsIFrame* rootScrollFrame = mPresShell->GetRootScrollFrame()) {
         RestoreFrameStateFor(rootScrollFrame, aFrameState);
       }
     }
 
 #ifdef ACCESSIBILITY
-    if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
+    if (nsAccessibilityService* accService =
+            PresShell::GetAccessibilityService()) {
       accService->ContentRangeInserted(mPresShell, aStartChild, aEndChild);
     }
 #endif
 
     return;
   }
 
   InsertionPoint insertion;
@@ -7360,17 +7362,18 @@ void nsCSSFrameConstructor::ContentRange
     printf(
         "nsCSSFrameConstructor::ContentRangeInserted: resulting frame "
         "model:\n");
     insertion.mParentFrame->List(stdout);
   }
 #endif
 
 #ifdef ACCESSIBILITY
-  if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
+  if (nsAccessibilityService* accService =
+          PresShell::GetAccessibilityService()) {
     accService->ContentRangeInserted(mPresShell, aStartChild, aEndChild);
   }
 #endif
 }
 
 bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
                                            nsIContent* aOldNextSibling,
                                            RemoveFlags aFlags) {
@@ -7560,17 +7563,18 @@ bool nsCSSFrameConstructor::ContentRemov
       LAYOUT_PHASE_TEMP_EXIT();
       RecreateFramesForContent(grandparentFrame->GetContent(),
                                InsertionKind::Async);
       LAYOUT_PHASE_TEMP_REENTER();
       return true;
     }
 
 #ifdef ACCESSIBILITY
-    if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
+    if (nsAccessibilityService* accService =
+            PresShell::GetAccessibilityService()) {
       accService->ContentRemoved(mPresShell, aChild);
     }
 #endif
 
     // Examine the containing-block for the removed content and see if
     // :first-letter style applies.
     nsIFrame* inflowChild = childFrame;
     if (childFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
@@ -11693,17 +11697,18 @@ void nsCSSFrameConstructor::GenerateChil
     // Pass null for the PendingBinding.
     ProcessChildren(state, aFrame->GetContent(), aFrame->Style(), aFrame, false,
                     childList, false, nullptr);
 
     aFrame->SetInitialChildList(kPrincipalList, childList);
   }
 
 #ifdef ACCESSIBILITY
-  if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
+  if (nsAccessibilityService* accService =
+          PresShell::GetAccessibilityService()) {
     if (nsIContent* child = aFrame->GetContent()->GetFirstChild()) {
       accService->ContentRangeInserted(mPresShell, child, nullptr);
     }
   }
 #endif
 
   // call XBL constructors after the frames are created
   mPresShell->GetDocument()->BindingManager()->ProcessAttachedQueue();
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -217,32 +217,16 @@ class nsIPresShell : public nsStubDocume
   Document* GetDocument() const { return mDocument; }
 
   nsPresContext* GetPresContext() const { return mPresContext; }
 
   nsViewManager* GetViewManager() const { return mViewManager; }
 
   nsRefreshDriver* GetRefreshDriver() const;
 
-#ifdef ACCESSIBILITY
-  /**
-   * Return the document accessible for this pres shell if there is one.
-   */
-  mozilla::a11y::DocAccessible* GetDocAccessible() const {
-    return mDocAccessible;
-  }
-
-  /**
-   * Set the document accessible for this pres shell.
-   */
-  void SetDocAccessible(mozilla::a11y::DocAccessible* aDocAccessible) {
-    mDocAccessible = aDocAccessible;
-  }
-#endif
-
   nsCSSFrameConstructor* FrameConstructor() const {
     return mFrameConstructor.get();
   }
 
   /**
    * FrameSelection will return the Frame based selection API.
    * You cannot go back and forth anymore with QI between nsIDOM sel and
    * nsIFrame sel.
@@ -728,28 +712,16 @@ class nsIPresShell : public nsStubDocume
 
 #ifdef DEBUG
   // Debugging hooks
   virtual void ListComputedStyles(FILE* out, int32_t aIndent = 0) = 0;
 
   virtual void ListStyleSheets(FILE* out, int32_t aIndent = 0) = 0;
 #endif
 
-#ifdef ACCESSIBILITY
-  /**
-   * Return true if accessibility is active.
-   */
-  static bool IsAccessibilityActive();
-
-  /**
-   * Return accessibility service if accessibility is active.
-   */
-  static nsAccessibilityService* AccService();
-#endif
-
   /**
    * Stop all active elements (plugins and the caret) in this presentation and
    * in the presentations of subdocuments.  Resets painting to a suppressed
    * state.
    * XXX this should include image animations
    */
   virtual void Freeze() = 0;
   bool IsFrozen() { return mFrozen; }
@@ -1319,19 +1291,16 @@ class nsIPresShell : public nsStubDocume
   RefPtr<nsFrameSelection> mSelection;
   RefPtr<nsCaret> mCaret;
   RefPtr<nsCaret> mOriginalCaret;
   RefPtr<mozilla::AccessibleCaretEventHub> mAccessibleCaretEventHub;
   // Pointer into mFrameConstructor - this is purely so that GetRootFrame() can
   // be inlined:
   nsFrameManager* mFrameManager;
   mozilla::WeakPtr<nsDocShell> mForwardingContainer;
-#ifdef ACCESSIBILITY
-  mozilla::a11y::DocAccessible* mDocAccessible;
-#endif
 
   // The `performance.now()` value when we last started to process reflows.
   DOMHighResTimeStamp mLastReflowStart{0.0};
 
   // At least on Win32 and Mac after interupting a reflow we need to post
   // the resume reflow event off a timer to avoid event starvation because
   // posted messages are processed before other messages when the modal
   // moving/sizing loop is running, see bug 491700 for details.
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -584,18 +584,18 @@ void nsRangeFrame::UpdateForValueChange(
   }
   if (IsThemed()) {
     // We don't know the exact dimensions or location of the thumb when native
     // theming is applied, so we just repaint the entire range.
     InvalidateFrame();
   }
 
 #ifdef ACCESSIBILITY
-  nsAccessibilityService* accService = nsIPresShell::AccService();
-  if (accService) {
+  if (nsAccessibilityService* accService =
+          PresShell::GetAccessibilityService()) {
     accService->RangeValueChanged(PresShell(), mContent);
   }
 #endif
 
   SchedulePaint();
 }
 
 void nsRangeFrame::DoUpdateThumbPosition(nsIFrame* aThumbFrame,
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -152,34 +152,34 @@ void nsBulletFrame::DidSetComputedStyle(
     // No image request on the new ComputedStyle.
     DeregisterAndCancelImageRequest();
   }
 
 #ifdef ACCESSIBILITY
   // Update the list bullet accessible. If old style list isn't available then
   // no need to update the accessible tree because it's not created yet.
   if (aOldComputedStyle) {
-    nsAccessibilityService* accService = nsIPresShell::AccService();
-    if (accService) {
+    if (nsAccessibilityService* accService =
+            PresShell::GetAccessibilityService()) {
       const nsStyleList* oldStyleList = aOldComputedStyle->StyleList();
       bool hadBullet = oldStyleList->GetListStyleImage() ||
                        !oldStyleList->mCounterStyle.IsNone();
 
       const nsStyleList* newStyleList = StyleList();
       bool hasBullet = newStyleList->GetListStyleImage() ||
                        !newStyleList->mCounterStyle.IsNone();
 
       if (hadBullet != hasBullet) {
         nsIContent* listItem = mContent->GetParent();
         accService->UpdateListBullet(PresContext()->GetPresShell(), listItem,
                                      hasBullet);
       }
     }
   }
-#endif
+#endif  // #ifdef ACCESSIBILITY
 }
 
 class nsDisplayBulletGeometry
     : public nsDisplayItemGenericGeometry,
       public nsImageGeometryMixin<nsDisplayBulletGeometry> {
  public:
   nsDisplayBulletGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
       : nsDisplayItemGenericGeometry(aItem, aBuilder),
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -334,18 +334,19 @@ nsresult nsPluginFrame::PrepForDrawing(n
     RegisterPluginForGeometryUpdates();
   }
 
   if (!IsHidden()) {
     viewMan->SetViewVisibility(view, nsViewVisibility_kShow);
   }
 
 #ifdef ACCESSIBILITY
-  nsAccessibilityService* accService = nsIPresShell::AccService();
-  if (accService) {
+  ;
+  if (nsAccessibilityService* accService =
+          PresShell::GetAccessibilityService()) {
     accService->RecreateAccessible(PresShell(), mContent);
   }
 #endif
 
   return NS_OK;
 }
 
 #define EMBED_DEF_WIDTH 240
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -8656,18 +8656,18 @@ void nsTextFrame::Reflow(nsPresContext* 
 /**
  * Notifies accessibility about text reflow. Used by nsTextFrame::ReflowText.
  */
 class MOZ_STACK_CLASS ReflowTextA11yNotifier {
  public:
   ReflowTextA11yNotifier(nsPresContext* aPresContext, nsIContent* aContent)
       : mContent(aContent), mPresContext(aPresContext) {}
   ~ReflowTextA11yNotifier() {
-    nsAccessibilityService* accService = nsIPresShell::AccService();
-    if (accService) {
+    if (nsAccessibilityService* accService =
+            PresShell::GetAccessibilityService()) {
       accService->UpdateText(mPresContext->PresShell(), mContent);
     }
   }
 
  private:
   ReflowTextA11yNotifier();
   ReflowTextA11yNotifier(const ReflowTextA11yNotifier&);
   ReflowTextA11yNotifier& operator=(const ReflowTextA11yNotifier&);
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -395,21 +395,22 @@ nsresult nsTreeBodyFrame::SetView(nsITre
 
   // Changing the view causes us to refetch our data.  This will
   // necessarily entail a full invalidation of the tree.
   Invalidate();
 
   RefPtr<XULTreeElement> treeContent = GetBaseElement();
   if (treeContent) {
 #ifdef ACCESSIBILITY
-    nsAccessibilityService* accService = nsIPresShell::AccService();
-    if (accService)
+    if (nsAccessibilityService* accService =
+            PresShell::GetAccessibilityService()) {
       accService->TreeViewChanged(PresContext()->GetPresShell(), treeContent,
                                   mView);
-#endif
+    }
+#endif  // #ifdef ACCESSIBILITY
     FireDOMEvent(NS_LITERAL_STRING("TreeViewChanged"), treeContent);
   }
 
   if (mView) {
     // Give the view a new empty selection object to play with, but only if it
     // doesn't have one already.
     nsCOMPtr<nsITreeSelection> sel;
     mView->GetSelection(getter_AddRefs(sel));
@@ -517,56 +518,59 @@ nsresult nsTreeBodyFrame::Invalidate() {
 }
 
 nsresult nsTreeBodyFrame::InvalidateColumn(nsTreeColumn* aCol) {
   if (mUpdateBatchNest) return NS_OK;
 
   if (!aCol) return NS_ERROR_INVALID_ARG;
 
 #ifdef ACCESSIBILITY
-  if (nsIPresShell::IsAccessibilityActive())
+  if (PresShell::IsAccessibilityActive()) {
     FireInvalidateEvent(-1, -1, aCol, aCol);
-#endif
+  }
+#endif  // #ifdef ACCESSIBILITY
 
   nsRect columnRect;
   nsresult rv = aCol->GetRect(this, mInnerBox.y, mInnerBox.height, &columnRect);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // When false then column is out of view
   if (OffsetForHorzScroll(columnRect, true))
     InvalidateFrameWithRect(columnRect);
 
   return NS_OK;
 }
 
 nsresult nsTreeBodyFrame::InvalidateRow(int32_t aIndex) {
   if (mUpdateBatchNest) return NS_OK;
 
 #ifdef ACCESSIBILITY
-  if (nsIPresShell::IsAccessibilityActive())
+  if (PresShell::IsAccessibilityActive()) {
     FireInvalidateEvent(aIndex, aIndex, nullptr, nullptr);
-#endif
+  }
+#endif  // #ifdef ACCESSIBILITY
 
   aIndex -= mTopRowIndex;
   if (aIndex < 0 || aIndex > mPageLength) return NS_OK;
 
   nsRect rowRect(mInnerBox.x, mInnerBox.y + mRowHeight * aIndex,
                  mInnerBox.width, mRowHeight);
   InvalidateFrameWithRect(rowRect);
 
   return NS_OK;
 }
 
 nsresult nsTreeBodyFrame::InvalidateCell(int32_t aIndex, nsTreeColumn* aCol) {
   if (mUpdateBatchNest) return NS_OK;
 
 #ifdef ACCESSIBILITY
-  if (nsIPresShell::IsAccessibilityActive())
+  if (PresShell::IsAccessibilityActive()) {
     FireInvalidateEvent(aIndex, aIndex, aCol, aCol);
-#endif
+  }
+#endif  // #ifdef ACCESSIBILITY
 
   aIndex -= mTopRowIndex;
   if (aIndex < 0 || aIndex > mPageLength) return NS_OK;
 
   if (!aCol) return NS_ERROR_INVALID_ARG;
 
   nsRect cellRect;
   nsresult rv = aCol->GetRect(this, mInnerBox.y + mRowHeight * aIndex,
@@ -586,22 +590,22 @@ nsresult nsTreeBodyFrame::InvalidateRang
   int32_t last = LastVisibleRow();
   if (aStart > aEnd || aEnd < mTopRowIndex || aStart > last) return NS_OK;
 
   if (aStart < mTopRowIndex) aStart = mTopRowIndex;
 
   if (aEnd > last) aEnd = last;
 
 #ifdef ACCESSIBILITY
-  if (nsIPresShell::IsAccessibilityActive()) {
+  if (PresShell::IsAccessibilityActive()) {
     int32_t end =
         mRowCount > 0 ? ((mRowCount <= aEnd) ? mRowCount - 1 : aEnd) : 0;
     FireInvalidateEvent(aStart, end, nullptr, nullptr);
   }
-#endif
+#endif  // #ifdef ACCESSIBILITY
 
   nsRect rangeRect(mInnerBox.x,
                    mInnerBox.y + mRowHeight * (aStart - mTopRowIndex),
                    mInnerBox.width, mRowHeight * (aEnd - aStart + 1));
   InvalidateFrameWithRect(rangeRect);
 
   return NS_OK;
 }
@@ -1580,19 +1584,20 @@ nsresult nsTreeBodyFrame::CreateTimer(co
   timer.forget(aTimer);
   return NS_OK;
 }
 
 nsresult nsTreeBodyFrame::RowCountChanged(int32_t aIndex, int32_t aCount) {
   if (aCount == 0 || !mView) return NS_OK;  // Nothing to do.
 
 #ifdef ACCESSIBILITY
-  if (nsIPresShell::IsAccessibilityActive())
+  if (PresShell::IsAccessibilityActive()) {
     FireRowCountChangedEvent(aIndex, aCount);
-#endif
+  }
+#endif  // #ifdef ACCESSIBILITY
 
   // Adjust our selection.
   nsCOMPtr<nsITreeSelection> sel;
   mView->GetSelection(getter_AddRefs(sel));
   if (sel) sel->AdjustSelection(aIndex, aCount);
 
   if (mUpdateBatchNest) return NS_OK;