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
This commit is contained in:
James Teh 2022-11-19 23:04:08 +00:00
Родитель 75c3be2a1e
Коммит 6c0098d405
9 изменённых файлов: 21 добавлений и 57 удалений

Просмотреть файл

@ -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()) {

Просмотреть файл

@ -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

Просмотреть файл

@ -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());
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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

Просмотреть файл

@ -446,8 +446,7 @@ void nsRangeFrame::UpdateForValueChange() {
}
#ifdef ACCESSIBILITY
if (nsAccessibilityService* accService =
PresShell::GetAccessibilityService()) {
if (nsAccessibilityService* accService = GetAccService()) {
accService->RangeValueChanged(PresShell(), mContent);
}
#endif

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -400,8 +400,7 @@ nsresult nsTreeBodyFrame::SetView(nsITreeView* aView) {
RefPtr<XULTreeElement> 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