-
Notifications
You must be signed in to change notification settings - Fork 6k
[ios] Link PlatformView back to semantics tree #46471
[ios] Link PlatformView back to semantics tree #46471
Conversation
| @end | ||
|
|
||
| @implementation FlutterScrollableSemanticsObject { | ||
| fml::scoped_nsobject<SemanticsObjectContainer> _container; |
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 unrelated to the PR, but the variable is unused so I removed it
| - (NSArray*)accessibilityElements { | ||
| return @[ _platformView ]; | ||
| } |
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.
We implemented nativeAccessibility, this is not necessary.
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Outdated
Show resolved
Hide resolved
| const float kFloatCompareEpsilon = 0.001; | ||
|
|
||
| @interface FlutterTouchInterceptingView (Test) | ||
| - (id)accessibilityContainer; |
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 make a _Test.h file instead of re-declaring methods directly in test files.
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 entire redeclaration block should be removed in favor of including the test header.
|
|
||
| @protocol FlutterSemanticsProtocol <NSObject> | ||
| // Adding functionalities for any object to assign accessibilityContainer. | ||
| // For example, this allows the PlatformView be able to link back to the accessibility tree. |
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'm confused by what this property is actually for. I see where it's set, but I don't see anything reading it except in tests. Am I missing some non-test behavior that's influenced by this?
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 is read in FlutterTouchInterceptingView: accessibilityContainer, it is a UIAccessibilty property that is read by the UIKit.
I initially added the method to the FlutterTouchInterceptingView so that FlutterTouchInterceptingView can access the container in its accessibiltiyContainer method.
Then I discovered that SemanticsObjectTests is ARC, so we couldn't not include FlutterTouchInterceptingView (which uses MRC features) in the header of SemanticsObjectTests, thus the protocl was added.
This does make the code more confusing. Maybe I should revert back to my initial implementation (no protocol, FlutterTouchInterceptingView has a setFlutterAccessiblityContainer method), then move the related tests to mrc.
|
@stuartmorgan I removed the protocol to reduce confusion, I also refactored the platform view related tests to a separate file + other review comments. PTAL |
073536f to
63a75a3
Compare
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.
..._Test.h seems to be the established convention in this directory.
| const float kFloatCompareEpsilon = 0.001; | ||
|
|
||
| @interface FlutterTouchInterceptingView (Test) | ||
| - (id)accessibilityContainer; |
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 entire redeclaration block should be removed in favor of including the test header.
| // Get embedded view | ||
| - (UIView*)embeddedView; | ||
|
|
||
| // The FlutterTouchInterceptingView assigns `flutterAccessibilityContainer` as its |
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.
Instance methods don't need to say that they are about the class they are on; this can just say "Sets flutterAccessibilityContainer as this view's accessibilityContainer."
| // Check if there's no more strong references to `platformView` after container and platformView | ||
| // are released. | ||
| [container release]; | ||
| XCTAssertEqual(platformView.retainCount, 1u); |
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 fragile to implementation details of the code using the platform view. It would help to at least wrap all the code between the declaration and here in an autorelease pool.
|
@stuartmorgan Updated, PTAL! |
stuartmorgan-g
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 with one last nit.
| // If the `FlutterPlatformViewsController` does not contain any `FlutterPlatformView` object or | ||
| // a `FlutterPlatformView` object associated with the view_id cannot be found, the method | ||
| // returns nil. | ||
| FlutterTouchInterceptingView* GetFlutterTouchInterceptingViewByID(int64_t); |
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.
Nit: I missed that this parameter doesn't have a name; it should be int64_t view_id.
|
auto label is removed for flutter/engine/46471, due to - The status or check suite Linux Web Framework tests has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…136007) flutter/engine@8e6dd23...8e3a05c 2023-10-04 chinmaygarde@google.com Update buildroot to 5d60bd2. (flutter/engine#46564) 2023-10-04 ychris@google.com [ios] Link PlatformView back to semantics tree (flutter/engine#46471) 2023-10-04 skia-flutter-autoroll@skia.org Roll Skia from d061d21eed0d to 073737b7f4ab (2 revisions) (flutter/engine#46563) 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
The PlatformView does not have a semantics container when added to semantics tree, this PR gives it a semantics container to ensure accessibility traversal works. This fixes flutter/flutter#135504, which is a regression of flutter@b8332e3 Before flutter@b8332e3, the traversal works because the PlatformView is added to the accessibilityElements of the FlutterPlatFormViewSemanticsContainer, which implicitly made the FlutterPlatFormViewSemanticsContainer as the PlatformVIew's AccessibilityContainer. Now we use the PlatformVIew as the nativeAccessibility of the FlutterPlatFormViewSemanticsContainer, we need to expilicitly set the container. This needs to be cherry-picked since the commit caused the regression was cherry-picked in flutter@b8332e3 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
…lutter#136007) flutter/engine@8e6dd23...8e3a05c 2023-10-04 chinmaygarde@google.com Update buildroot to 5d60bd2. (flutter/engine#46564) 2023-10-04 ychris@google.com [ios] Link PlatformView back to semantics tree (flutter/engine#46471) 2023-10-04 skia-flutter-autoroll@skia.org Roll Skia from d061d21eed0d to 073737b7f4ab (2 revisions) (flutter/engine#46563) 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
Cherry pick 250daad Cherry pick issue flutter/flutter#136266 Description: The PlatformView does not have a semantics container when added to semantics tree, this PR gives it a semantics container to ensure accessibility traversal works. This fixes flutter/flutter#135504, which is a regression of b8332e3 Before b8332e3, the traversal works because the PlatformView is added to the accessibilityElements of the FlutterPlatFormViewSemanticsContainer, which implicitly made the FlutterPlatFormViewSemanticsContainer as the PlatformVIew's AccessibilityContainer. Now we use the PlatformVIew as the nativeAccessibility of the FlutterPlatFormViewSemanticsContainer, we need to expilicitly set the container. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
The PlatformView does not have a semantics container when added to semantics tree, this PR gives it a semantics container to ensure accessibility traversal works. This fixes flutter/flutter#135504, which is a regression of flutter@b8332e3 Before flutter@b8332e3, the traversal works because the PlatformView is added to the accessibilityElements of the FlutterPlatFormViewSemanticsContainer, which implicitly made the FlutterPlatFormViewSemanticsContainer as the PlatformVIew's AccessibilityContainer. Now we use the PlatformVIew as the nativeAccessibility of the FlutterPlatFormViewSemanticsContainer, we need to expilicitly set the container. This needs to be cherry-picked since the commit caused the regression was cherry-picked in flutter@b8332e3 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Cherry pick 250daad Cherry pick issue flutter/flutter#136552 Description: The PlatformView does not have a semantics container when added to semantics tree, this PR gives it a semantics container to ensure accessibility traversal works. This fixes flutter/flutter#135504, which is a regression of b8332e3 Before b8332e3, the traversal works because the PlatformView is added to the accessibilityElements of the FlutterPlatFormViewSemanticsContainer, which implicitly made the FlutterPlatFormViewSemanticsContainer as the PlatformVIew's AccessibilityContainer. Now we use the PlatformVIew as the nativeAccessibility of the FlutterPlatFormViewSemanticsContainer, we need to expilicitly set the container. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
The PlatformView does not have a semantics container when added to semantics tree, this PR gives it a semantics container to ensure accessibility traversal works. This fixes flutter/flutter#135504, which is a regression of b8332e3 Before b8332e3, the traversal works because the PlatformView is added to the accessibilityElements of the FlutterPlatFormViewSemanticsContainer, which implicitly made the FlutterPlatFormViewSemanticsContainer as the PlatformVIew's AccessibilityContainer. Now we use the PlatformVIew as the nativeAccessibility of the FlutterPlatFormViewSemanticsContainer, we need to expilicitly set the container. This needs to be cherry-picked since the commit caused the regression was cherry-picked in b8332e3 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
The PlatformView does not have a semantics container when added to semantics tree, this PR gives it a semantics container to ensure accessibility traversal works.
This fixes flutter/flutter#135504, which is a regression of b8332e3
Before b8332e3, the traversal works because the PlatformView is added to the accessibilityElements of the FlutterPlatFormViewSemanticsContainer, which implicitly made the FlutterPlatFormViewSemanticsContainer as the PlatformVIew's AccessibilityContainer.
Now we use the PlatformVIew as the nativeAccessibility of the FlutterPlatFormViewSemanticsContainer, we need to expilicitly set the container.
This needs to be cherry-picked since the commit caused the regression was cherry-picked in b8332e3
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.