-
Notifications
You must be signed in to change notification settings - Fork 6k
Merge AccessibilityBridge and AccessibilityBridgeDelegate #36597
Merge AccessibilityBridge and AccessibilityBridgeDelegate #36597
Conversation
@chunhtai This PR is an alternative proposal to from #36573 by merging I haven't implemented everything yet (see PR body for TODOs), however the current state should be a sufficient POC that the "merging" strategy works (the mac unittests pass). Let me know if you think it's worth moving forward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a bit concern about using inheritence vs composition which may add more complexity if embedding starts overriding existing default method. but I think this is probably a better way to approach the dependency cycle problem. Should probably loop in @cbracken who wrote the code to wire up bridge in windows embedding.
Can you illustrate what you mean by
I don't think I'm adding extra inheritance, since the current engine also needs to inherit the delegate node. About overriding existing default method, the |
I meant it used to be composition (the bridge compose bridge delegate to call native API), but it becomes inheritance now. which may be a bit hard to maintain if embedding starts overriding method like AddFlutterSemanticsNodeUpdate or CommitUpdates to inject their own call loop. It is not a strong opinion to not to merge delegate and bridge though. #Edit: you can prevent override by using |
@dkwingsmt can you elaborate a bit (in the description) on the circular reference issue you mention in the comments above? I'm also a bit on the fence in terms of inheritance vs composition. Agreed that we're effectively trading subclassing one class rather than another, but curious to understand the circular reference issue you mention above to understand why this form is an improvement. |
@cbracken Sure. (I've added the following text to the PR description.) The circular dependency can be seen in the previous PR, #36573.
|
…te' into a11y-bridge-merge-with-delegate
…dkwingsmt/engine into a11y-bridge-merge-with-delegate
//------------------------------------------------------------------------------ | ||
/// @brief Update the AccessibilityBridgeDelegate stored in the | ||
/// accessibility bridge to a new one. | ||
void UpdateDelegate(std::unique_ptr<AccessibilityBridgeDelegate> delegate); | ||
void Reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above needs to be updated
auto label is removed for flutter/engine, pr: 36597, due to - The status or check suite Windows Host Engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
auto label is removed for flutter/engine, pr: 36597, due to - The status or check suite Mac Host clang-tidy has failed. Please fix the issues identified (or deflake) before re-applying this label. |
auto label is removed for flutter/engine, pr: 36597, due to - The status or check suite Linux linux_arm_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…elegate (flutter/engine#36597) (#114674) Commit: 55fac571b396375f41282f0e5783d65ce1f24c02
* 0943693 Revert "[tools]validation basic Xcode settings for build ipa (#113412)" (flutter/flutter#114615) * a440c46 Do not assume that pub is the first command run by "flutter create" (flutter/flutter#114621) * 33b81ed fixes for incoming linter (flutter/flutter#113794) * 0186b14 Fix the path where footer is written. (flutter/flutter#114469) * 44ecbbc Roll Flutter Engine from 840a7b346216 to 66b244d9fa0a (25 revisions) (flutter/flutter#114640) * 2ce62b3 Roll Flutter Engine from 66b244d9fa0a to e3c51631a9b5 (2 revisions) (flutter/flutter#114643) * 8a9ddad [tools]validation basic Xcode settings for build ipa (#113412) (flutter/flutter#114634) * 009fa69 Revert "Scribble mixin (#104128)" (flutter/flutter#114647) * 125b9a7 Roll Flutter Engine from e3c51631a9b5 to ed31c3d76df5 (2 revisions) (flutter/flutter#114648) * 9f6090c Revert "Fix text field label animation duration and curve" (flutter/flutter#114646) * 44b6cd2 Roll Flutter Engine from ed31c3d76df5 to fb7cde697062 (2 revisions) (flutter/flutter#114651) * fca260a Roll Flutter Engine from fb7cde697062 to 69a275300a28 (7 revisions) (flutter/flutter#114667) * 7bee6e8 4b970fca0 Roll Dart SDK from c6e0307f3849 to 35b0cc8ac48b (2 revisions) (flutter/engine#37308) (flutter/flutter#114668) * 43606d1 0a2d451b3 Roll Skia from b8209dce9a48 to 7eac7e7547e7 (1 revision) (flutter/engine#37309) (flutter/flutter#114670) * 55fac57 2f90bda40 Merge AccessibilityBridge and AccessibilityBridgeDelegate (flutter/engine#36597) (flutter/flutter#114674) * 4b7106c c5cc559db Roll Fuchsia Linux SDK from -0Xq1c-TncmWBWzqg... to 7e3H7isxOF6vqMDTT... (flutter/engine#37311) (flutter/flutter#114678) * 55e8cd1 449fcc8b8 Roll Skia from 7eac7e7547e7 to c901cb6ae66f (1 revision) (flutter/engine#37313) (flutter/flutter#114683)
* 0943693 Revert "[tools]validation basic Xcode settings for build ipa (#113412)" (flutter/flutter#114615) * a440c46 Do not assume that pub is the first command run by "flutter create" (flutter/flutter#114621) * 33b81ed fixes for incoming linter (flutter/flutter#113794) * 0186b14 Fix the path where footer is written. (flutter/flutter#114469) * 44ecbbc Roll Flutter Engine from 840a7b346216 to 66b244d9fa0a (25 revisions) (flutter/flutter#114640) * 2ce62b3 Roll Flutter Engine from 66b244d9fa0a to e3c51631a9b5 (2 revisions) (flutter/flutter#114643) * 8a9ddad [tools]validation basic Xcode settings for build ipa (#113412) (flutter/flutter#114634) * 009fa69 Revert "Scribble mixin (#104128)" (flutter/flutter#114647) * 125b9a7 Roll Flutter Engine from e3c51631a9b5 to ed31c3d76df5 (2 revisions) (flutter/flutter#114648) * 9f6090c Revert "Fix text field label animation duration and curve" (flutter/flutter#114646) * 44b6cd2 Roll Flutter Engine from ed31c3d76df5 to fb7cde697062 (2 revisions) (flutter/flutter#114651) * fca260a Roll Flutter Engine from fb7cde697062 to 69a275300a28 (7 revisions) (flutter/flutter#114667) * 7bee6e8 4b970fca0 Roll Dart SDK from c6e0307f3849 to 35b0cc8ac48b (2 revisions) (flutter/engine#37308) (flutter/flutter#114668) * 43606d1 0a2d451b3 Roll Skia from b8209dce9a48 to 7eac7e7547e7 (1 revision) (flutter/engine#37309) (flutter/flutter#114670) * 55fac57 2f90bda40 Merge AccessibilityBridge and AccessibilityBridgeDelegate (flutter/engine#36597) (flutter/flutter#114674) * 4b7106c c5cc559db Roll Fuchsia Linux SDK from -0Xq1c-TncmWBWzqg... to 7e3H7isxOF6vqMDTT... (flutter/engine#37311) (flutter/flutter#114678) * 55e8cd1 449fcc8b8 Roll Skia from 7eac7e7547e7 to c901cb6ae66f (1 revision) (flutter/engine#37313) (flutter/flutter#114683)
* 0943693 Revert "[tools]validation basic Xcode settings for build ipa (#113412)" (flutter/flutter#114615) * a440c46 Do not assume that pub is the first command run by "flutter create" (flutter/flutter#114621) * 33b81ed fixes for incoming linter (flutter/flutter#113794) * 0186b14 Fix the path where footer is written. (flutter/flutter#114469) * 44ecbbc Roll Flutter Engine from 840a7b346216 to 66b244d9fa0a (25 revisions) (flutter/flutter#114640) * 2ce62b3 Roll Flutter Engine from 66b244d9fa0a to e3c51631a9b5 (2 revisions) (flutter/flutter#114643) * 8a9ddad [tools]validation basic Xcode settings for build ipa (#113412) (flutter/flutter#114634) * 009fa69 Revert "Scribble mixin (#104128)" (flutter/flutter#114647) * 125b9a7 Roll Flutter Engine from e3c51631a9b5 to ed31c3d76df5 (2 revisions) (flutter/flutter#114648) * 9f6090c Revert "Fix text field label animation duration and curve" (flutter/flutter#114646) * 44b6cd2 Roll Flutter Engine from ed31c3d76df5 to fb7cde697062 (2 revisions) (flutter/flutter#114651) * fca260a Roll Flutter Engine from fb7cde697062 to 69a275300a28 (7 revisions) (flutter/flutter#114667) * 7bee6e8 4b970fca0 Roll Dart SDK from c6e0307f3849 to 35b0cc8ac48b (2 revisions) (flutter/engine#37308) (flutter/flutter#114668) * 43606d1 0a2d451b3 Roll Skia from b8209dce9a48 to 7eac7e7547e7 (1 revision) (flutter/engine#37309) (flutter/flutter#114670) * 55fac57 2f90bda40 Merge AccessibilityBridge and AccessibilityBridgeDelegate (flutter/engine#36597) (flutter/flutter#114674) * 4b7106c c5cc559db Roll Fuchsia Linux SDK from -0Xq1c-TncmWBWzqg... to 7e3H7isxOF6vqMDTT... (flutter/engine#37311) (flutter/flutter#114678) * 55e8cd1 449fcc8b8 Roll Skia from 7eac7e7547e7 to c901cb6ae66f (1 revision) (flutter/engine#37313) (flutter/flutter#114683)
) * Impl * FlutterPlatformNodeDelegateMac * Format * Rename file * Windows: Compile * format * Fix tests * Fix doc * More doc * More comments * Format * Update names * Format * Compile * Change to unique * Revert as shared * Doc fixes * Make windows bridge weak * Fix win compile * Format * move weak
* 0943693 Revert "[tools]validation basic Xcode settings for build ipa (#113412)" (flutter/flutter#114615) * a440c46 Do not assume that pub is the first command run by "flutter create" (flutter/flutter#114621) * 33b81ed fixes for incoming linter (flutter/flutter#113794) * 0186b14 Fix the path where footer is written. (flutter/flutter#114469) * 44ecbbc Roll Flutter Engine from 840a7b346216 to 66b244d9fa0a (25 revisions) (flutter/flutter#114640) * 2ce62b3 Roll Flutter Engine from 66b244d9fa0a to e3c51631a9b5 (2 revisions) (flutter/flutter#114643) * 8a9ddad [tools]validation basic Xcode settings for build ipa (#113412) (flutter/flutter#114634) * 009fa69 Revert "Scribble mixin (#104128)" (flutter/flutter#114647) * 125b9a7 Roll Flutter Engine from e3c51631a9b5 to ed31c3d76df5 (2 revisions) (flutter/flutter#114648) * 9f6090c Revert "Fix text field label animation duration and curve" (flutter/flutter#114646) * 44b6cd2 Roll Flutter Engine from ed31c3d76df5 to fb7cde697062 (2 revisions) (flutter/flutter#114651) * fca260a Roll Flutter Engine from fb7cde697062 to 69a275300a28 (7 revisions) (flutter/flutter#114667) * 7bee6e8 4b970fca0 Roll Dart SDK from c6e0307f3849 to 35b0cc8ac48b (2 revisions) (flutter/engine#37308) (flutter/flutter#114668) * 43606d1 0a2d451b3 Roll Skia from b8209dce9a48 to 7eac7e7547e7 (1 revision) (flutter/engine#37309) (flutter/flutter#114670) * 55fac57 2f90bda40 Merge AccessibilityBridge and AccessibilityBridgeDelegate (flutter/engine#36597) (flutter/flutter#114674) * 4b7106c c5cc559db Roll Fuchsia Linux SDK from -0Xq1c-TncmWBWzqg... to 7e3H7isxOF6vqMDTT... (flutter/engine#37311) (flutter/flutter#114678) * 55e8cd1 449fcc8b8 Roll Skia from 7eac7e7547e7 to c901cb6ae66f (1 revision) (flutter/engine#37313) (flutter/flutter#114683)
* 0943693 Revert "[tools]validation basic Xcode settings for build ipa (#113412)" (flutter/flutter#114615) * a440c46 Do not assume that pub is the first command run by "flutter create" (flutter/flutter#114621) * 33b81ed fixes for incoming linter (flutter/flutter#113794) * 0186b14 Fix the path where footer is written. (flutter/flutter#114469) * 44ecbbc Roll Flutter Engine from 840a7b346216 to 66b244d9fa0a (25 revisions) (flutter/flutter#114640) * 2ce62b3 Roll Flutter Engine from 66b244d9fa0a to e3c51631a9b5 (2 revisions) (flutter/flutter#114643) * 8a9ddad [tools]validation basic Xcode settings for build ipa (#113412) (flutter/flutter#114634) * 009fa69 Revert "Scribble mixin (#104128)" (flutter/flutter#114647) * 125b9a7 Roll Flutter Engine from e3c51631a9b5 to ed31c3d76df5 (2 revisions) (flutter/flutter#114648) * 9f6090c Revert "Fix text field label animation duration and curve" (flutter/flutter#114646) * 44b6cd2 Roll Flutter Engine from ed31c3d76df5 to fb7cde697062 (2 revisions) (flutter/flutter#114651) * fca260a Roll Flutter Engine from fb7cde697062 to 69a275300a28 (7 revisions) (flutter/flutter#114667) * 7bee6e8 4b970fca0 Roll Dart SDK from c6e0307f3849 to 35b0cc8ac48b (2 revisions) (flutter/engine#37308) (flutter/flutter#114668) * 43606d1 0a2d451b3 Roll Skia from b8209dce9a48 to 7eac7e7547e7 (1 revision) (flutter/engine#37309) (flutter/flutter#114670) * 55fac57 2f90bda40 Merge AccessibilityBridge and AccessibilityBridgeDelegate (flutter/engine#36597) (flutter/flutter#114674) * 4b7106c c5cc559db Roll Fuchsia Linux SDK from -0Xq1c-TncmWBWzqg... to 7e3H7isxOF6vqMDTT... (flutter/engine#37311) (flutter/flutter#114678) * 55e8cd1 449fcc8b8 Roll Skia from 7eac7e7547e7 to c901cb6ae66f (1 revision) (flutter/engine#37313) (flutter/flutter#114683)
* 0943693 Revert "[tools]validation basic Xcode settings for build ipa (#113412)" (flutter/flutter#114615) * a440c46 Do not assume that pub is the first command run by "flutter create" (flutter/flutter#114621) * 33b81ed fixes for incoming linter (flutter/flutter#113794) * 0186b14 Fix the path where footer is written. (flutter/flutter#114469) * 44ecbbc Roll Flutter Engine from 840a7b346216 to 66b244d9fa0a (25 revisions) (flutter/flutter#114640) * 2ce62b3 Roll Flutter Engine from 66b244d9fa0a to e3c51631a9b5 (2 revisions) (flutter/flutter#114643) * 8a9ddad [tools]validation basic Xcode settings for build ipa (#113412) (flutter/flutter#114634) * 009fa69 Revert "Scribble mixin (#104128)" (flutter/flutter#114647) * 125b9a7 Roll Flutter Engine from e3c51631a9b5 to ed31c3d76df5 (2 revisions) (flutter/flutter#114648) * 9f6090c Revert "Fix text field label animation duration and curve" (flutter/flutter#114646) * 44b6cd2 Roll Flutter Engine from ed31c3d76df5 to fb7cde697062 (2 revisions) (flutter/flutter#114651) * fca260a Roll Flutter Engine from fb7cde697062 to 69a275300a28 (7 revisions) (flutter/flutter#114667) * 7bee6e8 4b970fca0 Roll Dart SDK from c6e0307f3849 to 35b0cc8ac48b (2 revisions) (flutter/engine#37308) (flutter/flutter#114668) * 43606d1 0a2d451b3 Roll Skia from b8209dce9a48 to 7eac7e7547e7 (1 revision) (flutter/engine#37309) (flutter/flutter#114670) * 55fac57 2f90bda40 Merge AccessibilityBridge and AccessibilityBridgeDelegate (flutter/engine#36597) (flutter/flutter#114674) * 4b7106c c5cc559db Roll Fuchsia Linux SDK from -0Xq1c-TncmWBWzqg... to 7e3H7isxOF6vqMDTT... (flutter/engine#37311) (flutter/flutter#114678) * 55e8cd1 449fcc8b8 Roll Skia from 7eac7e7547e7 to c901cb6ae66f (1 revision) (flutter/engine#37313) (flutter/flutter#114683)
This PR merges
AccessibilityBridgeDelegate
intoAccessibilityBridge
, affectingcommon
,mac
, andwindows
. As a result, accessibility bridges and node delegates no longer call the engine for the bridge or the view, but get them as constructor arguments.AccessibilityBridge
classes still refer to the engine, but only to dispatch events to embedder APIs.Part of the multiwindow project (design doc for macOS): This reduces the usage of the following single-view APIs:
mac/FlutterEngine#accessibilityBridge
mac/FlutterEngine#viewController
windows/FlutterWindowsEngine::accessibilityBridge
windows/FlutterWindowsEngine::viewController
TODO:
Why do we choose this method?
In the current HEAD:
flutter_engine_.accessibilityBridge
.The ultimate goal of the change is get rid of the usage of
FlutterEngine#accessibilityBridge
andFlutterEngine#viewController
. Instead, the delegate will be provided a bridge and a view controller at initialization. In this way, the engine can initialize multiple sets of bridge-and-delegates, each for a window.However, if we still keep the bridge and the delegate separated, the bridge must be created with a delegate, and a delegate must be created with a bridge. To resolve this circular dependency, we might either assign the delegate with the bridge later, or assign the bridge with the delegate later. Neither way is error-prone enough though: we can not guarantee at compile time that both classes have all dependents ready when other methods are called.
But since both the bridge and the delegate correspond to one window, there's no reason to separate them. If we merge the two classes, then their communication becomes intra-class.
Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.