-
Notifications
You must be signed in to change notification settings - Fork 6k
Sync accessibility flags in embedder.h #32332
Conversation
dnfield
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.
This is missing OnOffSwitchLabelsIndex now.
Can you add a test for this? I think a decent test for this would be something that iterates over the values in flutter::AccessibliityFeatureFlag and this one and makes sure there are the same number of values and that they're equal.
Ideally we'd also have a test that actually uses this feature from the embedder API and makes sure that it's plumbed through to the right spots, but that's quite a bit more effort :)
Oh, I was working on the Flutter 2.10 engine codebase and I didn't notice the addition. I'll fix it.
Unfortunately I couldn't find any non-hacky way to iterate over an |
|
Hmm. I guess there are weird ways using template metaprogramming but that's ok. Maybe we could just add something like |
|
(with some kind of comment to keep that value last of course) |
This doesn't seem to be possible because engine/shell/platform/embedder/embedder.h Line 24 in 2d29e2f
and if we set explicit values to By the way I just noticed that there are other enum types ( |
|
You are of course right. Updating the other enum types is fine. @chinmaygarde or @cbracken may have some good idea for some way we could analyze this statically. But I'm starting to suspect it'll be beyond the scope of this PR. |
cbracken
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.
@swift-kim thanks for the fix.
I agree with @dnfield that keeping these enums in sync is an issue we've hit repeatedly that we really do need some form of a static test for. Despite the comments above the enums in the code, keeping these in sync has been a repeated issue. I've filed flutter/flutter#101217 to track this.
I also agree however that that problem is significantly more complex than this patch and probably out of scope here.
|
I've got a work-in-progress patch that adds a test for this. If you'd like to add one more, turns out we're also missing the IsMultiline semantics flag. This would go just after |
|
@cbracken I also noticed it but thought it had been excluded intentionally because the comments said: engine/lib/ui/semantics/semantics_node.h Lines 84 to 85 in 2d29e2f
engine/shell/platform/android/io/flutter/view/AccessibilityBridge.java Lines 2048 to 2049 in 2d29e2f
But I'll add it anyway. Thanks for the catch! |
|
Looks like that field was addded for Flutter web. While it's apparently not used for non-web platforms, I'm surprised it's commented out in the internal enum + the Android enum. Looks like it was added in #9850. Perhaps @mdebbar and @yjbanov can provide some context. If we know it'll be unused on non-web platforms, perhaps we should avoid exposing it here and I can adapt the test with an exceptions list. The specific question is whether this is an enum value that we should explicitly avoid exposing in our enums. There are several other enum values that are used on some platforms but not others, but that we add to all enums for consistency. If there's no reason for treating IsMultiline differently, we should probably make it available everywhere. |
|
Adding |
Uncomments the Java Flag.IS_MULTILINE and C++ SemanticsFlag.kIsMultiline enum values. While these values aren't used in the Android or iOS embeddings, in practice we maintain the same set of enum values across all embeddings so as to match the public API defined in dart:ui, found in lib/ui/semantics/semantics.dart. This also helps with automated checking that all enums across all languages are consistent. This will be added to the embedder API in #32332. Issue: flutter/flutter#101217
|
LGTM. #32408 will add a test for this. |
The following enum types in `embedder.h` must match with the corresponding Dart/C++ classes in `dart:ui` but some values are missing. - `FlutterAccessibilityFeature` - `FlutterSemanticsAction` - `FlutterSemanticsFlag` The comments say https://github.com/flutter/engine/blob/2d29e2f3b5e4c951809eb7578ff5f114f91efbeb/shell/platform/embedder/embedder.h#L83 https://github.com/flutter/engine/blob/2d29e2f3b5e4c951809eb7578ff5f114f91efbeb/lib/ui/window.dart#L784-L785
The following enum types in
embedder.hmust match with the corresponding Dart/C++ classes indart:uibut some values are missing.FlutterAccessibilityFeatureFlutterSemanticsActionFlutterSemanticsFlagThe comments say
engine/shell/platform/embedder/embedder.h
Line 83 in 2d29e2f
engine/lib/ui/window.dart
Lines 784 to 785 in 2d29e2f
No linked issue because the fix is trivial enough.