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

[web] Remove non-ShadowDom mode #39915

Merged
merged 10 commits into from Apr 19, 2023
Merged

Conversation

mdebbar
Copy link
Contributor

@mdebbar mdebbar commented Feb 27, 2023

If we still want to do this, here's a quick PR :)

Fixes flutter/flutter#116204

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Feb 27, 2023
Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

This cleanup is great. Thanks for adding the throw "this won't work without ShadowDOM" in the embedder, it makes a lot of sense.

Also, millions of thanks for creating the global_styles.dart file. 😭

I think some of the tests can be simplified and moved to a global_styles_test.dart file and tested there in more isolation, but the rest looks good, especially if all the tests continue to pass :P

(This is going to cause some conflicts with @htoor3's incoming PR though!)

embedder.glassPaneElement.remove();
});

test('throws when shadowDom is not available', () {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this test!

expect(hasFakeRule, isFalse);
});

test('Attaches outrageous text styles to flt-scene-host', () {
Copy link
Member

Choose a reason for hiding this comment

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

I'd move these tests to a separate global_styles_test.dart where we assert the things that must be contained in the sheet, then in the embedder_test leave only the ones that assert that a sheet was added at the right spot (hasCssRule shouldn't live in embedder_test.dart, but in global_stles_test.dart, IMO)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@ditman
Copy link
Member

ditman commented Mar 1, 2023

Safari is being fun and failing here:

00:04 �[32m+182�[0m�[33m ~11�[0m�[31m -1�[0m: test/embedder_test.dart: Shadow root and styles Attaches outrageous text styles to flt-scene-host �[1m�[31m[E]�[0m�[0m                                                                               
  Expected: true
    Actual: <false>
  Should pass default css font.
  
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_helper.dart 1142:37                             wrapException
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_helper.dart 1173:25                             throwExpression

@mdebbar
Copy link
Contributor Author

mdebbar commented Mar 1, 2023

I think some of the tests can be simplified and moved to a global_styles_test.dart file and tested there in more isolation, but the rest looks good, especially if all the tests continue to pass :P

Great idea! It'll help us fix the Safari failure too (I'll explain below).

(This is going to cause some conflicts with @htoor3's incoming PR though!)

Yep. I plan to wait for @htoor3 to land his PR first.

Safari is being fun and failing here:

Ugh. This is because we set the default css font to font: normal normal 14px sans-serif. But browsers take that string and process it however they like. Chrome, for example, removes the normal normal part because it's the default (normal normal 14px sans-serif == 14px sans-serif). I'm guessing Safari doesn't do that 🤷‍♂️

Your idea of moving some tests to global_styles_test.dart will solve this issue because I can go back to passing a simpler default css font (14px monospace) like you were doing here:

final HostNode hostNode = ShadowDomHostNode(rootNode, '14px monospace');

to avoid the normal normal thingy.

@ditman
Copy link
Member

ditman commented Mar 2, 2023

Chrome, for example, removes the normal normal part because it's the default (normal normal 14px sans-serif == 14px sans-serif). I'm guessing Safari doesn't do that

What I remember from Safari (not sure if from this change or one from @htoor3) was that they'd unroll the shorthand CSS property into every separate property, so if you did: font: 14px monospace, in safari you'd need to check: font-size: 14px and font-family: monospace, rather than what you had set. 🙈‼️

@mdebbar mdebbar requested a review from ditman April 18, 2023 14:35
@mdebbar
Copy link
Contributor Author

mdebbar commented Apr 18, 2023

@ditman @htoor3 this is ready for another review after rebasing on top of the @htoor3's restructuring PR.

Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

This LGTM! Thank you very much for the cleanup @mdebbar!

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 19, 2023
@auto-submit auto-submit bot merged commit d626f16 into flutter:main Apr 19, 2023
38 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 19, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 19, 2023
…125150)

flutter/engine@609f9d5...d626f16

2023-04-19 mdebbar@google.com [web] Remove non-ShadowDom mode (flutter/engine#39915)
2023-04-19 30870216+gaaclarke@users.noreply.github.com [impeller] added moltenvk notice (flutter/engine#41317)
2023-04-19 skia-flutter-autoroll@skia.org Roll Skia from 8af1dd9659f0 to ad90b6bd4760 (3 revisions) (flutter/engine#41337)
2023-04-19 skia-flutter-autoroll@skia.org Roll Dart SDK from 27e71f19c144 to fe8bb0565a30 (2 revisions) (flutter/engine#41336)
2023-04-19 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from yD5a3QBJHUFM4nVou... to suSuT9F8zuP-pBg-E... (flutter/engine#41334)
2023-04-19 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Cy5LG4U2InaFLkJGz... to Tun7i4VLz6ncx8JJJ... (flutter/engine#41331)
2023-04-19 skia-flutter-autoroll@skia.org Roll Skia from 85d9e67653b1 to 8af1dd9659f0 (1 revision) (flutter/engine#41333)
2023-04-19 skia-flutter-autoroll@skia.org Roll Skia from 5a718d9e9c06 to 85d9e67653b1 (4 revisions) (flutter/engine#41330)
2023-04-19 skia-flutter-autoroll@skia.org Roll Dart SDK from 1f224df52bee to 27e71f19c144 (3 revisions) (flutter/engine#41329)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from Cy5LG4U2InaF to Tun7i4VLz6nc
  fuchsia/sdk/core/mac-amd64 from yD5a3QBJHUFM to suSuT9F8zuP-

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 chinmaygarde@google.com,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
@mdebbar mdebbar deleted the remove_non_shadow branch June 22, 2023 21:38
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
3 participants