-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] New platform view API to get view by ID #41784
Conversation
d6edc89 to
dee9ab6
Compare
|
(Modified the description a little bit, since we're going to use this API to implement the new |
ditman
left a comment
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, let's go!
| /// Throws an [AssertionError] if [viewId] hasn't been rendered before. | ||
| DomElement getViewById(int viewId) { | ||
| assert(knowsViewId(viewId), 'No view has been rendered for viewId: $viewId'); | ||
| return _contents[viewId]!.firstElementChild!; |
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.
Please, document that we return the firstElementChild because we cache the created view wrapped with the <flt-slot-content> tag (right?)
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.
_contents[viewId] is the wrapper (i.e. the slot element). The first child of the slot is the element created by the factory.
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.
| return wrapper; |
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.
Oh I think this is exactly what you are saying. Sorry I misread your comment.
Sounds good, I'll document why I'm returning firstElementChild.
| {bool isVisible = true}) { | ||
| assert(factoryFunction is PlatformViewFactory || | ||
| factoryFunction is ParameterizedPlatformViewFactory); | ||
| assert( |
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 think you should revert these changes so this PR doesn't conflict with #42255
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.
Good catch! I'll just move this change to the other PR.
dee9ab6 to
e7b6f07
Compare
…128149) flutter/engine@f3f6a02...8769e9c 2023-06-02 [email protected] Use json for json blocks in docs. (flutter/engine#42521) 2023-06-02 [email protected] [web] New platform view API to get view by ID (flutter/engine#41784) 2023-06-02 [email protected] Generate a unique temporary directory name in the iOS scenario test script (flutter/engine#42520) 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://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
In order to make
HtmlElementViewmore useful, we need to expose an API for getting the created platform view element.This would allowHtmlElementViewto set attributes and styles on the element.This would allow us to add a new callback to the
HtmlElementViewthat would return the result of calling the registered platformViewFactory to the user, after it's been created and added to the DOM, so the user can do with it as they please.Part of flutter/flutter#127030