diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index b98d36fe2b895838c7c919700d81ff575e475687..55fb0367c5ebade4048fc9eeab0dfb3669f47472 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -601,6 +601,11 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// The fields 'textSelectionBase' and 'textSelectionExtent' describe the /// currently selected text within `value`. /// + /// The field `platformViewId` references the platform view, whose semantics + /// nodes will be added as children to this node. If a platform view is + /// specified, `childrenInHitTestOrder` and `childrenInTraversalOrder` must be + /// empty. + /// /// For scrollable nodes `scrollPosition` describes the current scroll /// position in logical pixel. `scrollExtentMax` and `scrollExtentMin` /// describe the maximum and minimum in-rage values that `scrollPosition` can @@ -629,6 +634,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, @@ -656,6 +662,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { actions, textSelectionBase, textSelectionExtent, + platformViewId, scrollChildren, scrollIndex, scrollPosition, @@ -685,6 +692,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index f6918e54475bae2c7abadf6f26a69bfac1dcc392..16a87a32d9c076a5a17998c067d1c2006f973ae3 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -86,6 +86,7 @@ struct SemanticsNode { int32_t actions = 0; int32_t textSelectionBase = -1; int32_t textSelectionExtent = -1; + int32_t platformViewId = -1; int32_t scrollChildren = 0; int32_t scrollIndex = 0; double scrollPosition = std::nan(""); diff --git a/lib/ui/semantics/semantics_update_builder.cc b/lib/ui/semantics/semantics_update_builder.cc index 575ba6e3227d0b9eb725ada82c54ef962f699571..75cfdcf40c95ab09f6b8259f7a0af4c25b98a8f9 100644 --- a/lib/ui/semantics/semantics_update_builder.cc +++ b/lib/ui/semantics/semantics_update_builder.cc @@ -41,6 +41,7 @@ void SemanticsUpdateBuilder::updateNode( int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, @@ -68,6 +69,7 @@ void SemanticsUpdateBuilder::updateNode( node.actions = actions; node.textSelectionBase = textSelectionBase; node.textSelectionExtent = textSelectionExtent; + node.platformViewId = platformViewId; node.scrollChildren = scrollChildren; node.scrollIndex = scrollIndex; node.scrollPosition = scrollPosition; diff --git a/lib/ui/semantics/semantics_update_builder.h b/lib/ui/semantics/semantics_update_builder.h index ac8424d9f0fbd8dca6875dbdff97b361a6fb0fe9..fa6201c3d84c1edd40d96d0f06ff99149404c985 100644 --- a/lib/ui/semantics/semantics_update_builder.h +++ b/lib/ui/semantics/semantics_update_builder.h @@ -29,6 +29,7 @@ class SemanticsUpdateBuilder int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 7d4e5060aa130e64b9c189ba80f2e1541f69d291..3c262fa9fe63db583895bcd46dffceee07620fba 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -1614,6 +1614,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { private int actions; private int textSelectionBase; private int textSelectionExtent; + private int platformViewId; private int scrollChildren; private int scrollIndex; private float scrollPosition; @@ -1748,6 +1749,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { actions = buffer.getInt(); textSelectionBase = buffer.getInt(); textSelectionExtent = buffer.getInt(); + platformViewId = buffer.getInt(); scrollChildren = buffer.getInt(); scrollIndex = buffer.getInt(); scrollPosition = buffer.getFloat(); diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index a66e306c1ef822adff1bd421e5a4641c2de78b51..f31c084565e0a4527d87ebe8372b2d8e77bac462 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -208,7 +208,7 @@ void PlatformViewAndroid::DispatchSemanticsAction(JNIEnv* env, void PlatformViewAndroid::UpdateSemantics( blink::SemanticsNodeUpdates update, blink::CustomAccessibilityActionUpdates actions) { - constexpr size_t kBytesPerNode = 38 * sizeof(int32_t); + constexpr size_t kBytesPerNode = 39 * sizeof(int32_t); constexpr size_t kBytesPerChild = sizeof(int32_t); constexpr size_t kBytesPerAction = 4 * sizeof(int32_t); @@ -244,6 +244,7 @@ void PlatformViewAndroid::UpdateSemantics( buffer_int32[position++] = node.actions; buffer_int32[position++] = node.textSelectionBase; buffer_int32[position++] = node.textSelectionExtent; + buffer_int32[position++] = node.platformViewId; buffer_int32[position++] = node.scrollChildren; buffer_int32[position++] = node.scrollIndex; buffer_float32[position++] = (float)node.scrollPosition;