diff --git a/accessible/base/NotificationController.cpp b/accessible/base/NotificationController.cpp index 90722c63a4d7..b0794b3cbcc9 100644 --- a/accessible/base/NotificationController.cpp +++ b/accessible/base/NotificationController.cpp @@ -678,6 +678,8 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) { "isn't created!"); } + mDocument->ProcessPendingUpdates(); + nsTArray cache; // Process rendered text change notifications. diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 53a3cfa723e2..3083edd2d002 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -484,6 +484,22 @@ void nsAccessibilityService::ContentRangeInserted(PresShell* aPresShell, } } +void nsAccessibilityService::ScheduleAccessibilitySubtreeUpdate( + PresShell* aPresShell, nsIContent* aContent) { + DocAccessible* document = GetDocAccessible(aPresShell); +#ifdef A11Y_LOG + if (logging::IsEnabled(logging::eTree)) { + logging::MsgBegin("TREE", "schedule update; doc: %p", document); + logging::Node("content node", aContent); + logging::MsgEnd(); + } +#endif + + if (document) { + document->ScheduleTreeUpdate(aContent); + } +} + void nsAccessibilityService::ContentRemoved(PresShell* aPresShell, nsIContent* aChildNode) { DocAccessible* document = GetDocAccessible(aPresShell); @@ -518,6 +534,27 @@ void nsAccessibilityService::TableLayoutGuessMaybeChanged( } } +void nsAccessibilityService::ComboboxOptionMaybeChanged( + PresShell* aPresShell, nsIContent* aMutatingNode) { + DocAccessible* document = GetDocAccessible(aPresShell); + if (!document) { + return; + } + + for (nsIContent* cur = aMutatingNode; cur; cur = cur->GetParent()) { + if (cur->IsHTMLElement(nsGkAtoms::option)) { + if (LocalAccessible* accessible = document->GetAccessible(cur)) { + document->FireDelayedEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, + accessible); + break; + } + if (cur->IsHTMLElement(nsGkAtoms::select)) { + break; + } + } + } +} + void nsAccessibilityService::UpdateText(PresShell* aPresShell, nsIContent* aContent) { DocAccessible* document = GetDocAccessible(aPresShell); @@ -882,7 +919,7 @@ LocalAccessible* nsAccessibilityService::CreateAccessible( if (!frame || !frame->StyleVisibility()->IsVisible()) { // display:contents element doesn't have a frame, but retains the semantics. // All its children are unaffected. - if (nsCoreUtils::IsDisplayContents(content)) { + if (nsCoreUtils::CanCreateAccessibleWithoutFrame(content)) { const MarkupMapInfo* markupMap = GetMarkupMapInfoForNode(content); if (markupMap && markupMap->new_func) { RefPtr newAcc = diff --git a/accessible/base/nsAccessibilityService.h b/accessible/base/nsAccessibilityService.h index 262b27d16f30..47a35ff70d4f 100644 --- a/accessible/base/nsAccessibilityService.h +++ b/accessible/base/nsAccessibilityService.h @@ -166,6 +166,14 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager, void ContentRangeInserted(mozilla::PresShell* aPresShell, nsIContent* aStartChild, nsIContent* aEndChild); + /** + * Triggers a re-evaluation of the a11y tree of aContent after the next + * refresh. This is important because whether we create accessibles may + * depend on the frame tree / style. + */ + void ScheduleAccessibilitySubtreeUpdate(mozilla::PresShell* aPresShell, + nsIContent* aStartChild); + /** * Notification used to update the accessible tree when content is removed. */ @@ -177,6 +185,12 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager, void TableLayoutGuessMaybeChanged(mozilla::PresShell* aPresShell, nsIContent* aContent); + /** + * Notifies when a combobox