[go: nahoru, domu]

Skip to content
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

ui_web library #40608

Merged
merged 17 commits into from
Mar 30, 2023
Merged

ui_web library #40608

merged 17 commits into from
Mar 30, 2023

Conversation

eyebrowsoffire
Copy link
Contributor

This introduces a public ui_web library that contains web-specific flutter APIs. The first thing to incorporate into this is UrlStrategy, which will allow us to replace a lot of the magic JS interop handshaking between framework and engine into a formalized API.

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Mar 24, 2023
Copy link
Contributor
@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I don't have strong opinions on the library name, so I'll save you the bikeshedding from my end :)

@@ -4,18 +4,18 @@

import 'package:meta/meta.dart';
import 'package:ui/ui.dart' as ui;
import '../../../ui_web/src/ui_web.dart' as ui_web;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How hard would it be to make this similar to the package:ui/ui.dart above? (i.e. package:ui_web/ui_web.dart or something like that). I guess it's just a matter of rewriting it in the sdk_rewriter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just gets erased by the rewriter, and in the top-level library file it says import 'dart:ui_web' as ui_web; so for the original source files we can import it any way we like as long as it is imported under the name ui_web. I can try to find a cleaner way to do this import.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second look, I think package:ui/src/ui_web.dart should work already?

@@ -183,15 +183,15 @@ class MultiEntriesBrowserHistory extends BrowserHistory {
}

@override
void onPopState(covariant DomPopStateEvent event) {
void onPopState(covariant DomPopStateEvent state) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep it the name event or make it Object? state?

I have a feeling you were trying to change DomPopStateEvent event ==> Object? state but forgot to finish the change, or reverted it partially.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... you're right, I kind of did a half-measure here. I think I can clean this up a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what I ended up doing here is to basically unwrap the JS event in JSUrlStrategy before it actually gets to the darty UrlStrategy object, and so the pop state listener just takes the state itself. I think this is a bit better. For stuff on the framework side that uses actual JS interop to do the pop listener thing, they can just unwrap it there as well. The path through JSUrlStrategy remains unchanged, so I think this is non-breaking for the framework (but I'll find out as soon as I start testing against the framework side).

lib/web_ui/lib/ui_web/src/ui_web.dart Outdated Show resolved Hide resolved
web_sdk/BUILD.gn Show resolved Hide resolved
web_sdk/BUILD.gn Show resolved Hide resolved
Copy link
Contributor
@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

// found in the LICENSE file.

/// This library defines the web-specific additions that go along with dart:ui
library ui_web;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
library ui_web;
library;

We now support name-less libraries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely don't want a nameless library though. This is a library that the framework (and maybe eventually users) will use by name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name will map to the file name, though. tis fine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also: #40669

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sdk_rewriter will not be able to rewrite this file properly without this statement.

@kevmoo
Copy link
Contributor
kevmoo commented Mar 27, 2023 via email

@eyebrowsoffire
Copy link
Contributor Author

I'm going to wait until after the branch cut to merge this.

@eyebrowsoffire eyebrowsoffire marked this pull request as ready for review March 29, 2023 16:24
@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 30, 2023
@auto-submit auto-submit bot merged commit a6deb36 into main Mar 30, 2023
@auto-submit auto-submit bot deleted the web_ui_library branch March 30, 2023 23:14
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 31, 2023
zanderso pushed a commit to flutter/flutter that referenced this pull request Mar 31, 2023
…123833)

flutter/engine@571c5de...c0e7cd5

2023-03-31 bdero@google.com [Impeller] iOS/macOS: Only wait for command
scheduling prior to present (flutter/engine#40781)
2023-03-31 skia-flutter-autoroll@skia.org Roll Skia from 9b2e538f1367 to
f6c1eefd4600 (4 revisions) (flutter/engine#40807)
2023-03-30 dnfield@google.com Revert "[Impeller] move everything needed
by the code gen template to core (#40801)" (flutter/engine#40811)
2023-03-30 dnfield@google.com [Impeller] Delete dead code from
reflector.cc (flutter/engine#40805)
2023-03-30 dnfield@google.com [Impeller] move everything needed by the
code gen template to core (flutter/engine#40801)
2023-03-30 jacksongardner@google.com `ui_web` library
(flutter/engine#40608)

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 rmistry@google.com,zra@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
exaby73 pushed a commit to NevercodeHQ/flutter that referenced this pull request Apr 17, 2023
…lutter#123833)

flutter/engine@571c5de...c0e7cd5

2023-03-31 bdero@google.com [Impeller] iOS/macOS: Only wait for command
scheduling prior to present (flutter/engine#40781)
2023-03-31 skia-flutter-autoroll@skia.org Roll Skia from 9b2e538f1367 to
f6c1eefd4600 (4 revisions) (flutter/engine#40807)
2023-03-30 dnfield@google.com Revert "[Impeller] move everything needed
by the code gen template to core (flutter#40801)" (flutter/engine#40811)
2023-03-30 dnfield@google.com [Impeller] Delete dead code from
reflector.cc (flutter/engine#40805)
2023-03-30 dnfield@google.com [Impeller] move everything needed by the
code gen template to core (flutter/engine#40801)
2023-03-30 jacksongardner@google.com `ui_web` library
(flutter/engine#40608)

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 rmistry@google.com,zra@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 5, 2023
This is based off (and dependent on) these changes in the web engine that expose web-specific APIs: flutter/engine#40608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine
Projects
None yet
4 participants