From 6c0098d40558c64cc99e0d7df361d9cd6760a892 Mon Sep 17 00:00:00 2001 From: James Teh Date: Sat, 19 Nov 2022 23:04:08 +0000 Subject: [PATCH] Bug 1801433: Remove PresShell::GetAccessibilityService/IsAccessibilityActive. r=emilio These have just called GetAccService for a long time now, so callers should just call that directly. Differential Revision: https://phabricator.services.mozilla.com/D162449 --- dom/ipc/ContentParent.cpp | 2 +- layout/base/PresShell.cpp | 19 +++---------------- layout/base/PresShell.h | 16 +--------------- layout/base/nsCSSFrameConstructor.cpp | 15 +++++---------- layout/forms/HTMLSelectEventListener.cpp | 4 ++-- layout/forms/nsRangeFrame.cpp | 3 +-- layout/generic/nsIFrame.cpp | 3 +-- layout/generic/nsTextFrame.cpp | 3 +-- layout/xul/tree/nsTreeBodyFrame.cpp | 13 ++++++------- 9 files changed, 21 insertions(+), 57 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index a9401408bd6b..a8b1890f23da 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1688,7 +1688,7 @@ void ContentParent::Init() { #ifdef ACCESSIBILITY // If accessibility is running in chrome process then start it in content // process. - if (PresShell::IsAccessibilityActive()) { + if (GetAccService()) { # if defined(XP_WIN) // Don't init content a11y if we detect an incompat version of JAWS in use. if (!mozilla::a11y::Compatibility::IsOldJAWS()) { diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 0f1c2ac808f2..2498abd6f01e 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -3331,7 +3331,7 @@ nsresult PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll, } #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->NotifyOfAnchorJumpTo(target); } #endif @@ -5641,8 +5641,7 @@ void PresShell::SetRenderingState(const RenderingState& aState) { mRenderingStateFlags = aState.mRenderingStateFlags; mResolution = aState.mResolution; #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->NotifyOfResolutionChange(this, GetResolution()); } #endif @@ -10867,18 +10866,6 @@ nsIFrame* PresShell::GetAbsoluteContainingBlock(nsIFrame* aFrame) { aFrame, nsCSSFrameConstructor::ABS_POS); } -#ifdef ACCESSIBILITY - -// static -bool PresShell::IsAccessibilityActive() { return GetAccService() != nullptr; } - -// static -nsAccessibilityService* PresShell::GetAccessibilityService() { - return GetAccService(); -} - -#endif // #ifdef ACCESSIBILITY - void PresShell::ActivenessMaybeChanged() { if (!mDocument) { return; @@ -11021,7 +11008,7 @@ void PresShell::SetIsActive(bool aIsActive, bool aIsInActiveTab) { if (aIsActive) { #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->PresShellActivated(this); } #endif diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h index 0c02d76cfb6b..992a2fb29336 100644 --- a/layout/base/PresShell.h +++ b/layout/base/PresShell.h @@ -56,9 +56,6 @@ class AutoPointerEventTargetUpdater; class AutoWeakFrame; class gfxContext; class MobileViewportManager; -#ifdef ACCESSIBILITY -class nsAccessibilityService; -#endif class nsAutoCauseReflowNotifier; class nsCanvasFrame; class nsCaret; @@ -233,16 +230,6 @@ class PresShell final : public nsStubDocumentObserver, 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 /** @@ -1921,8 +1908,7 @@ class PresShell final : public nsStubDocumentObserver, mPresShell->mRenderingStateFlags = mOldState.mRenderingStateFlags; mPresShell->mResolution = mOldState.mResolution; #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->NotifyOfResolutionChange(mPresShell, mPresShell->GetResolution()); } diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index f465a5928952..455322671d3b 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -6837,8 +6837,7 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent, #endif #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->ContentRangeInserted(mPresShell, aFirstNewContent, nullptr); } #endif @@ -6941,8 +6940,7 @@ void nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aStartChild, } #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->ContentRangeInserted(mPresShell, aStartChild, aEndChild); } #endif @@ -7340,8 +7338,7 @@ void nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aStartChild, #endif #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->ContentRangeInserted(mPresShell, aStartChild, aEndChild); } #endif @@ -7526,8 +7523,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild, #ifdef ACCESSIBILITY if (aFlags != REMOVE_FOR_RECONSTRUCTION) { - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->ContentRemoved(mPresShell, aChild); } } @@ -9820,8 +9816,7 @@ void nsCSSFrameConstructor::ProcessChildren( MOZ_ASSERT(listItem->HasAnyStateBits( NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER) == isOutsideMarker); #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { auto* marker = markerFrame->GetContent(); accService->ContentRangeInserted(mPresShell, marker, nullptr); } diff --git a/layout/forms/HTMLSelectEventListener.cpp b/layout/forms/HTMLSelectEventListener.cpp index d653f099ea6c..1d7cc057bb20 100644 --- a/layout/forms/HTMLSelectEventListener.cpp +++ b/layout/forms/HTMLSelectEventListener.cpp @@ -305,7 +305,7 @@ int32_t HTMLSelectEventListener::ItemsPerPage() const { void HTMLSelectEventListener::OptionValueMightHaveChanged( nsIContent* aMutatingNode) { #ifdef ACCESSIBILITY - if (nsAccessibilityService* acc = PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* acc = GetAccService()) { acc->ComboboxOptionMaybeChanged(mElement->OwnerDoc()->GetPresShell(), aMutatingNode); } @@ -362,7 +362,7 @@ void HTMLSelectEventListener::ComboboxMightHaveChanged() { // RemoveOption / etc takes care of keeping the displayed index up to date. ps->FrameNeedsReflow(f, IntrinsicDirty::StyleChange, NS_FRAME_IS_DIRTY); #ifdef ACCESSIBILITY - if (nsAccessibilityService* acc = PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* acc = GetAccService()) { acc->ScheduleAccessibilitySubtreeUpdate(ps, mElement); } #endif diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp index 51dc07ba97a8..0d55fe369904 100644 --- a/layout/forms/nsRangeFrame.cpp +++ b/layout/forms/nsRangeFrame.cpp @@ -446,8 +446,7 @@ void nsRangeFrame::UpdateForValueChange() { } #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->RangeValueChanged(PresShell(), mContent); } #endif diff --git a/layout/generic/nsIFrame.cpp b/layout/generic/nsIFrame.cpp index f2f379ad3072..e20f789b0ed2 100644 --- a/layout/generic/nsIFrame.cpp +++ b/layout/generic/nsIFrame.cpp @@ -6764,8 +6764,7 @@ void nsIFrame::DidReflow(nsPresContext* aPresContext, aPresContext->ReflowedFrame(); #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->NotifyOfPossibleBoundsChange(PresShell(), mContent); } #endif diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index c89992de8b87..1e1ad5830a76 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -9448,8 +9448,7 @@ class MOZ_STACK_CLASS ReflowTextA11yNotifier { ReflowTextA11yNotifier(nsPresContext* aPresContext, nsIContent* aContent) : mContent(aContent), mPresContext(aPresContext) {} ~ReflowTextA11yNotifier() { - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->UpdateText(mPresContext->PresShell(), mContent); } } diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index bae5ead5810f..5e83d76c9af3 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -400,8 +400,7 @@ nsresult nsTreeBodyFrame::SetView(nsITreeView* aView) { RefPtr treeContent = GetBaseElement(); if (treeContent) { #ifdef ACCESSIBILITY - if (nsAccessibilityService* accService = - PresShell::GetAccessibilityService()) { + if (nsAccessibilityService* accService = GetAccService()) { accService->TreeViewChanged(PresContext()->GetPresShell(), treeContent, mView); } @@ -527,7 +526,7 @@ nsresult nsTreeBodyFrame::InvalidateColumn(nsTreeColumn* aCol) { if (!aCol) return NS_ERROR_INVALID_ARG; #ifdef ACCESSIBILITY - if (PresShell::IsAccessibilityActive()) { + if (GetAccService()) { FireInvalidateEvent(-1, -1, aCol, aCol); } #endif // #ifdef ACCESSIBILITY @@ -547,7 +546,7 @@ nsresult nsTreeBodyFrame::InvalidateRow(int32_t aIndex) { if (mUpdateBatchNest) return NS_OK; #ifdef ACCESSIBILITY - if (PresShell::IsAccessibilityActive()) { + if (GetAccService()) { FireInvalidateEvent(aIndex, aIndex, nullptr, nullptr); } #endif // #ifdef ACCESSIBILITY @@ -566,7 +565,7 @@ nsresult nsTreeBodyFrame::InvalidateCell(int32_t aIndex, nsTreeColumn* aCol) { if (mUpdateBatchNest) return NS_OK; #ifdef ACCESSIBILITY - if (PresShell::IsAccessibilityActive()) { + if (GetAccService()) { FireInvalidateEvent(aIndex, aIndex, aCol, aCol); } #endif // #ifdef ACCESSIBILITY @@ -599,7 +598,7 @@ nsresult nsTreeBodyFrame::InvalidateRange(int32_t aStart, int32_t aEnd) { if (aEnd > last) aEnd = last; #ifdef ACCESSIBILITY - if (PresShell::IsAccessibilityActive()) { + if (GetAccService()) { int32_t end = mRowCount > 0 ? ((mRowCount <= aEnd) ? mRowCount - 1 : aEnd) : 0; FireInvalidateEvent(aStart, end, nullptr, nullptr); @@ -1516,7 +1515,7 @@ nsresult nsTreeBodyFrame::RowCountChanged(int32_t aIndex, int32_t aCount) { if (aCount == 0 || !mView) return NS_OK; // Nothing to do. #ifdef ACCESSIBILITY - if (PresShell::IsAccessibilityActive()) { + if (GetAccService()) { FireRowCountChangedEvent(aIndex, aCount); } #endif // #ifdef ACCESSIBILITY