-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the web engine publish view forward focus and unfocus events #50177
Conversation
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
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.
Some small changes and comments. Thanks for this!
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/test/engine/view_embedder/flutter_view_manager_test.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/view_embedder/flutter_view_manager.dart
Outdated
Show resolved
Hide resolved
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.
This is looking pretty great to me!
QQ is there any way that I can use this to build my old element embedding demos to see if this yields the focus better, or are flutter framework parts still missing for this to fully work?
lib/web_ui/lib/src/engine/platform_dispatcher/view_focus_binding.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/platform_dispatcher/view_focus_binding.dart
Outdated
Show resolved
Hide resolved
lib/web_ui/lib/src/engine/platform_dispatcher/view_focus_binding.dart
Outdated
Show resolved
Hide resolved
return; | ||
} | ||
|
||
late final ui.ViewFocusEvent event; |
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.
No need to mark a local variable as late final
if it's going to be initialized and returned immediately!
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.
It can't be just final
as it access other fields/methods in the instance.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
lib/web_ui/lib/src/engine/platform_dispatcher/view_focus_binding.dart
Outdated
Show resolved
Hide resolved
Thank you David 🤝. I do appreciate your feedback and thoughtful reviews, thank you!
No, you can't test any of these things yet end to end. FYI @gspencergoog will be driving the framework changes. |
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.
If @mdebbar is happy, I'm happy. LGTM!
extension on DomElement? { | ||
int? get viewId => int.tryParse(viewIdAttribute ?? ''); | ||
String? get viewIdAttribute => closestView?.getAttribute(GlobalHtmlAttributes.flutterViewIdAttributeName); | ||
DomElement? get closestView => this?.closest(DomManager.flutterViewTagName); | ||
} |
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.
Is this extension available outside of this file? If so, please remove, it's hyper-specific to what you're trying to do. If it's only available here, carry on! Fancy!
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.
Great question. AFAICT no, unnamed extensions can only be used within the library where they're declared.
https://dart.dev/language/extension-methods#unnamed-extensions
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
LGTM with some minor suggestions that are not blockers.
return; | ||
} | ||
|
||
late final ui.ViewFocusEvent event; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
extension on DomElement? { | ||
int? get viewId => int.tryParse(viewIdAttribute ?? ''); | ||
String? get viewIdAttribute => closestView?.getAttribute(GlobalHtmlAttributes.flutterViewIdAttributeName); | ||
DomElement? get closestView => this?.closest(DomManager.flutterViewTagName); | ||
} |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
extension on DomElement? { | ||
int? get viewId => int.tryParse(viewIdAttribute ?? ''); | ||
String? get viewIdAttribute => closestView?.getAttribute(GlobalHtmlAttributes.flutterViewIdAttributeName); | ||
DomElement? get closestView => this?.closest(DomManager.flutterViewTagName); | ||
} |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Ohhhhhhh awesome feedback @mdebbar . I wasn't aware of this and similar differences between the engine and a regular dart program. Where can I read more about this rewriting process? Decided it is best to keep everything within the class then. The extensions were removed. |
There's no documentation about this AFAIK. But here's where we do the rewriting:
|
auto label is removed for flutter/engine/50177, due to - The status or check suite Linux Fuchsia FEMU has failed. Please fix the issues identified (or deflake) before re-applying this label. |
auto label is removed for flutter/engine/50177, due to - The status or check suite Linux mac_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label. |
auto label is removed for flutter/engine/50177, due to - The status or check suite Linux Fuchsia FEMU has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…143264) flutter/engine@1b8f23b...e08b6c8 2024-02-10 [email protected] Clean up additional NDK helper related code (flutter/engine#50518) 2024-02-09 [email protected] Make the web engine publish view forward focus and unfocus events (flutter/engine#50177) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Make the flutter web engine publish view focus events.
Relevant Issues are:
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.