Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@harryterkelsen
Copy link
Contributor

Reworks embedded view manager to be simpler, more well documented, and fix bugs.

Fixes flutter/flutter#105485

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@harryterkelsen harryterkelsen requested a review from yjbanov June 15, 2022 18:42
@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Jun 15, 2022
@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 6.
View them at https://flutter-engine-gold.skia.org/cl/github/34081

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 7.
View them at https://flutter-engine-gold.skia.org/cl/github/34081

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #34081 at sha 8a1987c

/// The set of platform views using the backup surface.
final Set<int> _viewsUsingBackupSurface = <int>{};
/// Whether or not we have seen a visible platform view in this frame yet.
bool _seenFirstVisibleView = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a little strange to see frame-specific state stored on the HtmlViewEmbedder singleton. Maybe a "context object" (a la PrerollContext or BuildContext) that's transient and short-lived would work better?

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.

@yjbanov yjbanov requested a review from ditman June 16, 2022 23:18
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.

Many comments, most for my own education, but nothing blocking.

The only thing that concerns me a little is that the view diffing logic used to account for "do not return viewsToRemove that are in viewsToAdd" (the views that needed to move), but it doesn't anymore; it is now a comment in the submitFrame method.

I think this should be handled either by the diffing (or maybe, more semantically by the ViewListDiffResult class), so when the diff needs to be used by the submitFrame function (or the other theoretical places where that Diff might be needed), the behavior is already built-in, rather than in a comment that can be deleted or ignored (and not tested).

(Also: Diffing of view lists is growing/becoming smarter, maybe it's starting to need to be split from the main file, and tested separately?)

Also also: do we have a test-case that covers the issue in #105485, so it doesn't regress?

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.

 _|          _|_|_|  _|_|_|_|_|  _|      _|  
 _|        _|            _|      _|_|  _|_|  
 _|        _|  _|_|      _|      _|  _|  _|  
 _|        _|    _|      _|      _|      _|  
 _|_|_|_|    _|_|_|      _|      _|      _|  

Iterable<DomElement> getElementsByTagName(String tag) =>
createDomListWrapper<DomElement>(js_util
.callMethod<_DomList>(this, 'getElementsByTagName', <Object>[tag]));
external DomElement? get activeElement;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder why this was marked as nullable before? (Looks like a carry-over from dart:html Node.isConnected, so I guess it's to accomodate older browsers where this property was not even defined, like IE)

@harryterkelsen harryterkelsen merged commit ef6a927 into flutter:main Jun 22, 2022
zanderso added a commit that referenced this pull request Jun 22, 2022
zanderso added a commit that referenced this pull request Jun 22, 2022
@ditman
Copy link
Member

ditman commented Jun 22, 2022

(This has gotten reverted due to a lint failure)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

platform-web Code specifically for the web engine will affect goldens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web][ck] (Invisible) HtmlElementViews optimized out too eagerly.

4 participants