From 747af49bde03d73a1bd02d7798fabe619148e6f8 Mon Sep 17 00:00:00 2001 From: a-wallen Date: Wed, 5 Oct 2022 17:33:41 -0700 Subject: [PATCH 1/5] Deprecate `platform_dispatcher` apis in favor of updateSemantics in FlutterView --- lib/ui/window.dart | 31 ++++++++++++++++--- .../lib/src/engine/platform_dispatcher.dart | 9 ++++++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 6450fad95c413..10da64cd30da0 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -267,14 +267,14 @@ abstract class FlutterView { @FfiNative)>('PlatformConfigurationNativeApi::Render') external static void _render(Scene scene); - /// Change the retained semantics data about this [FlutterView]. + /// Change the retained semantics data about this platform dispatcher. /// - /// If [PlatformDispatcher.semanticsEnabled] is true, the user has requested that this function - /// be called whenever the semantic content of this [FlutterView] + /// If [semanticsEnabled] is true, the user has requested that this function + /// be called whenever the semantic content of this platform dispatcher /// changes. /// - /// This function disposes the given update, which means the semantics update - /// cannot be used further. + /// In either case, this function disposes the given update, which means the + /// semantics update cannot be used further. void updateSemantics(SemanticsUpdate update) => _updateSemantics(update); @FfiNative)>('PlatformConfigurationNativeApi::UpdateSemantics') @@ -734,6 +734,27 @@ class SingletonFlutterWindow extends FlutterWindow { platformDispatcher.onAccessibilityFeaturesChanged = callback; } +<<<<<<< HEAD +======= + /// Change the retained semantics data about this window. + /// + /// {@macro dart.ui.window.functionForwardWarning} + /// + /// 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(''' + A singleton flutter window no longer manages semantics trees. In a multi-view + world, each flutter view must manage its own semantics tree. + + Call updateSemantics() from FlutterView instead. + ''') + void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update); + +>>>>>>> ccc5c13a67 (Deprecate `platform_dispatcher` apis in favor of updateSemantics in FlutterView) /// Sends a message to a platform-specific plugin. /// /// {@macro dart.ui.window.functionForwardWarning} diff --git a/lib/web_ui/lib/src/engine/platform_dispatcher.dart b/lib/web_ui/lib/src/engine/platform_dispatcher.dart index 3cfbffeb1fcc2..6018f22aec8eb 100644 --- a/lib/web_ui/lib/src/engine/platform_dispatcher.dart +++ b/lib/web_ui/lib/src/engine/platform_dispatcher.dart @@ -699,12 +699,21 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher { /// semantics update cannot be used further. @override @Deprecated(''' +<<<<<<< HEAD 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`. +======= + 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 flutter view. To update + semantics, use PlatformDispatcher.instance.views to get a flutter view and + call `updateSemantics`. +>>>>>>> ccc5c13a67 (Deprecate `platform_dispatcher` apis in favor of updateSemantics in FlutterView) ''') void updateSemantics(ui.SemanticsUpdate update) { EngineSemanticsOwner.instance.updateSemantics(update); From fbf61277d56a77bf1d6753b89ab47e50043e9a02 Mon Sep 17 00:00:00 2001 From: a-wallen Date: Fri, 7 Oct 2022 17:48:59 -0700 Subject: [PATCH 2/5] Testing this commit, will explain later --- lib/ui/platform_dispatcher.dart | 21 ------------------- lib/ui/window.dart | 21 ------------------- lib/web_ui/lib/platform_dispatcher.dart | 10 +-------- .../lib/src/engine/platform_dispatcher.dart | 4 ++++ lib/web_ui/lib/window.dart | 5 ++++- 5 files changed, 9 insertions(+), 52 deletions(-) diff --git a/lib/ui/platform_dispatcher.dart b/lib/ui/platform_dispatcher.dart index c2f7a223ab42d..1e1d08b6907e9 100644 --- a/lib/ui/platform_dispatcher.dart +++ b/lib/ui/platform_dispatcher.dart @@ -750,27 +750,6 @@ 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/lib/ui/window.dart b/lib/ui/window.dart index 10da64cd30da0..c669e7d22bf3d 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -734,27 +734,6 @@ class SingletonFlutterWindow extends FlutterWindow { platformDispatcher.onAccessibilityFeaturesChanged = callback; } -<<<<<<< HEAD -======= - /// Change the retained semantics data about this window. - /// - /// {@macro dart.ui.window.functionForwardWarning} - /// - /// 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(''' - A singleton flutter window no longer manages semantics trees. In a multi-view - world, each flutter view must manage its own semantics tree. - - Call updateSemantics() from FlutterView instead. - ''') - void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update); - ->>>>>>> ccc5c13a67 (Deprecate `platform_dispatcher` apis in favor of updateSemantics in FlutterView) /// Sends a message to a platform-specific plugin. /// /// {@macro dart.ui.window.functionForwardWarning} diff --git a/lib/web_ui/lib/platform_dispatcher.dart b/lib/web_ui/lib/platform_dispatcher.dart index 6d508576df1cc..7676ae8a6f93f 100644 --- a/lib/web_ui/lib/platform_dispatcher.dart +++ b/lib/web_ui/lib/platform_dispatcher.dart @@ -83,15 +83,7 @@ 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); + void updateSemantics(SemanticsUpdate update, [FlutterView view]); Locale get locale; diff --git a/lib/web_ui/lib/src/engine/platform_dispatcher.dart b/lib/web_ui/lib/src/engine/platform_dispatcher.dart index 6018f22aec8eb..1218a2dbfbfee 100644 --- a/lib/web_ui/lib/src/engine/platform_dispatcher.dart +++ b/lib/web_ui/lib/src/engine/platform_dispatcher.dart @@ -698,6 +698,7 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher { /// In either case, this function disposes the given update, which means the /// semantics update cannot be used further. @override +<<<<<<< HEAD @Deprecated(''' <<<<<<< HEAD In a multi-view world, the platform dispatcher can no longer provide apis @@ -716,6 +717,9 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher { >>>>>>> ccc5c13a67 (Deprecate `platform_dispatcher` apis in favor of updateSemantics in FlutterView) ''') void updateSemantics(ui.SemanticsUpdate update) { +======= + void updateSemantics(ui.SemanticsUpdate update, [ui.FlutterView? view]) { +>>>>>>> 58037d36e1 (Testing this commit, will explain later) EngineSemanticsOwner.instance.updateSemantics(update); } diff --git a/lib/web_ui/lib/window.dart b/lib/web_ui/lib/window.dart index ee4e0e35ec897..9c9e275b0d3e9 100644 --- a/lib/web_ui/lib/window.dart +++ b/lib/web_ui/lib/window.dart @@ -16,7 +16,7 @@ abstract class FlutterView { WindowPadding get padding => viewConfiguration.padding; List get displayFeatures => viewConfiguration.displayFeatures; void render(Scene scene) => platformDispatcher.render(scene, this); - void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update); + void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update, this); } abstract class FlutterWindow extends FlutterView { @@ -131,6 +131,9 @@ abstract class SingletonFlutterWindow extends FlutterWindow { platformDispatcher.onAccessibilityFeaturesChanged = callback; } + @override + void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update, this); + void sendPlatformMessage( String name, ByteData? data, From f3cc8ef91774f28f044bfebde38555d0878b910a Mon Sep 17 00:00:00 2001 From: a-wallen Date: Wed, 26 Oct 2022 11:33:37 -1000 Subject: [PATCH 3/5] Fix PEBKAC merge error --- lib/ui/window.dart | 10 +++---- .../lib/src/engine/platform_dispatcher.dart | 28 ------------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index c669e7d22bf3d..6450fad95c413 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -267,14 +267,14 @@ abstract class FlutterView { @FfiNative)>('PlatformConfigurationNativeApi::Render') external static void _render(Scene scene); - /// Change the retained semantics data about this platform dispatcher. + /// Change the retained semantics data about this [FlutterView]. /// - /// If [semanticsEnabled] is true, the user has requested that this function - /// be called whenever the semantic content of this platform dispatcher + /// If [PlatformDispatcher.semanticsEnabled] is true, the user has requested that this function + /// be called whenever the semantic content of this [FlutterView] /// changes. /// - /// In either case, this function disposes the given update, which means the - /// semantics update cannot be used further. + /// This function disposes the given update, which means the semantics update + /// cannot be used further. void updateSemantics(SemanticsUpdate update) => _updateSemantics(update); @FfiNative)>('PlatformConfigurationNativeApi::UpdateSemantics') diff --git a/lib/web_ui/lib/src/engine/platform_dispatcher.dart b/lib/web_ui/lib/src/engine/platform_dispatcher.dart index 1218a2dbfbfee..60af3b60a1838 100644 --- a/lib/web_ui/lib/src/engine/platform_dispatcher.dart +++ b/lib/web_ui/lib/src/engine/platform_dispatcher.dart @@ -690,36 +690,8 @@ 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 -<<<<<<< HEAD - @Deprecated(''' -<<<<<<< HEAD - 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`. -======= - 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 flutter view. To update - semantics, use PlatformDispatcher.instance.views to get a flutter view and - call `updateSemantics`. ->>>>>>> ccc5c13a67 (Deprecate `platform_dispatcher` apis in favor of updateSemantics in FlutterView) - ''') - void updateSemantics(ui.SemanticsUpdate update) { -======= void updateSemantics(ui.SemanticsUpdate update, [ui.FlutterView? view]) { ->>>>>>> 58037d36e1 (Testing this commit, will explain later) EngineSemanticsOwner.instance.updateSemantics(update); } From f8982ccd70b6b9c913d59a828b6f962f20eaa876 Mon Sep 17 00:00:00 2001 From: a-wallen Date: Fri, 28 Oct 2022 08:42:28 -1000 Subject: [PATCH 4/5] Remove unecessary override --- lib/web_ui/lib/window.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/web_ui/lib/window.dart b/lib/web_ui/lib/window.dart index 9c9e275b0d3e9..ca4f11811b4d2 100644 --- a/lib/web_ui/lib/window.dart +++ b/lib/web_ui/lib/window.dart @@ -131,9 +131,6 @@ abstract class SingletonFlutterWindow extends FlutterWindow { platformDispatcher.onAccessibilityFeaturesChanged = callback; } - @override - void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update, this); - void sendPlatformMessage( String name, ByteData? data, From b75e2996499db8543ffb4826d56d20d8f2d0ea1c Mon Sep 17 00:00:00 2001 From: a-wallen Date: Fri, 28 Oct 2022 08:44:14 -1000 Subject: [PATCH 5/5] Remove view paramter from updateSemantics --- lib/web_ui/lib/platform_dispatcher.dart | 2 +- lib/web_ui/lib/src/engine/platform_dispatcher.dart | 2 +- lib/web_ui/lib/window.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/web_ui/lib/platform_dispatcher.dart b/lib/web_ui/lib/platform_dispatcher.dart index 7676ae8a6f93f..7c67e7c3d5f4f 100644 --- a/lib/web_ui/lib/platform_dispatcher.dart +++ b/lib/web_ui/lib/platform_dispatcher.dart @@ -83,7 +83,7 @@ abstract class PlatformDispatcher { VoidCallback? get onAccessibilityFeaturesChanged; set onAccessibilityFeaturesChanged(VoidCallback? callback); - void updateSemantics(SemanticsUpdate update, [FlutterView view]); + void updateSemantics(SemanticsUpdate update); Locale get locale; diff --git a/lib/web_ui/lib/src/engine/platform_dispatcher.dart b/lib/web_ui/lib/src/engine/platform_dispatcher.dart index 60af3b60a1838..fee88b2ca2b26 100644 --- a/lib/web_ui/lib/src/engine/platform_dispatcher.dart +++ b/lib/web_ui/lib/src/engine/platform_dispatcher.dart @@ -691,7 +691,7 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher { } @override - void updateSemantics(ui.SemanticsUpdate update, [ui.FlutterView? view]) { + void updateSemantics(ui.SemanticsUpdate update) { EngineSemanticsOwner.instance.updateSemantics(update); } diff --git a/lib/web_ui/lib/window.dart b/lib/web_ui/lib/window.dart index ca4f11811b4d2..ee4e0e35ec897 100644 --- a/lib/web_ui/lib/window.dart +++ b/lib/web_ui/lib/window.dart @@ -16,7 +16,7 @@ abstract class FlutterView { WindowPadding get padding => viewConfiguration.padding; List get displayFeatures => viewConfiguration.displayFeatures; void render(Scene scene) => platformDispatcher.render(scene, this); - void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update, this); + void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update); } abstract class FlutterWindow extends FlutterView {