From 176a31f4338b85faae3f900adff96325186ecf73 Mon Sep 17 00:00:00 2001 From: Alex Wallen Date: Mon, 7 Nov 2022 09:23:52 -1000 Subject: [PATCH] Revert "Remove deprecated calls to updateSemantics in `PlatformDispatcher` (#36673)" (flutter/engine#37388) This reverts commit 67115d7ce50c4abf646019ff0be2cf008c1e59ac. --- .../flutter/lib/ui/platform_dispatcher.dart | 21 +++++++++++++++++++ .../lib/web_ui/lib/platform_dispatcher.dart | 8 +++++++ .../lib/src/engine/platform_dispatcher.dart | 15 +++++++++++++ 3 files changed, 44 insertions(+) diff --git a/engine/src/flutter/lib/ui/platform_dispatcher.dart b/engine/src/flutter/lib/ui/platform_dispatcher.dart index e5ebda9961..20349ded2f 100644 --- a/engine/src/flutter/lib/ui/platform_dispatcher.dart +++ b/engine/src/flutter/lib/ui/platform_dispatcher.dart @@ -750,6 +750,27 @@ class PlatformDispatcher { _invoke(onAccessibilityFeaturesChanged, _onAccessibilityFeaturesChangedZone,); } + /// Change the retained semantics data about this platform dispatcher. + /// + /// If [semanticsEnabled] is true, the user has requested that this function + /// be called whenever the semantic content of this platform dispatcher + /// changes. + /// + /// In either case, this function disposes the given update, which means the + /// semantics update cannot be used further. + @Deprecated(''' + In a multi-view world, the platform dispatcher can no longer provide apis + to update semantics since each view will host its own semantics tree. + + Semantics updates must be passed to an individual [FlutterView]. To update + semantics, use PlatformDispatcher.instance.views to get a [FlutterView] and + call `updateSemantics`. + ''') + void updateSemantics(SemanticsUpdate update) => _updateSemantics(update); + + @FfiNative)>('PlatformConfigurationNativeApi::UpdateSemantics') + external static void _updateSemantics(SemanticsUpdate update); + /// The system-reported default locale of the device. /// /// This establishes the language and formatting conventions that application diff --git a/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart b/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart index 7c67e7c3d5..6d508576df 100644 --- a/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart +++ b/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart @@ -83,6 +83,14 @@ abstract class PlatformDispatcher { VoidCallback? get onAccessibilityFeaturesChanged; set onAccessibilityFeaturesChanged(VoidCallback? callback); + @Deprecated(''' + In a multi-view world, the platform dispatcher can no longer provide apis + to update semantics since each view will host its own semantics tree. + + Semantics updates must be passed to an individual [FlutterView]. To update + semantics, use PlatformDispatcher.instance.views to get a [FlutterView] and + call `updateSemantics`. + ''') void updateSemantics(SemanticsUpdate update); Locale get locale; diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart index fee88b2ca2..3cfbffeb1f 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart @@ -690,7 +690,22 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher { _onAccessibilityFeaturesChanged, _onAccessibilityFeaturesChangedZone); } + /// Change the retained semantics data about this window. + /// + /// If [semanticsEnabled] is true, the user has requested that this function + /// be called whenever the semantic content of this window changes. + /// + /// In either case, this function disposes the given update, which means the + /// semantics update cannot be used further. @override + @Deprecated(''' + In a multi-view world, the platform dispatcher can no longer provide apis + to update semantics since each view will host its own semantics tree. + + Semantics updates must be passed to an individual [FlutterView]. To update + semantics, use PlatformDispatcher.instance.views to get a [FlutterView] and + call `updateSemantics`. + ''') void updateSemantics(ui.SemanticsUpdate update) { EngineSemanticsOwner.instance.updateSemantics(update); }