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

Commit f8e3a04

Browse files
authored
Delete SemanticsUpdateBuilderNew and all references and usages (#49139)
This PR completest the migration by removing `SemanticsUpdateBuilderNew` from the engine. This is mainly targeted at flutter/flutter#17988 Steps: part 1: [engine] add `SemanticsUpdateBuilderNew` #47961 part 2: [flutter] use `SemanticsUpdateBuilderNew` flutter/flutter#138331 part 3: [engine] update `SemanticsUpdateBuilder` to be the same as `SemanticsUpdateBuilderNew` #48882 part 4: [flutter] use (now updated) `SemanticsUpdateBuilder` again flutter/flutter#139942 **part 5: [engine] remove `SemanticsBuilderNew`** <-- we are here
1 parent 45624a7 commit f8e3a04

File tree

2 files changed

+0
-430
lines changed

2 files changed

+0
-430
lines changed

lib/ui/semantics.dart

Lines changed: 0 additions & 336 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,342 +1029,6 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1 implem
10291029
external void _build(_NativeSemanticsUpdate outSemanticsUpdate);
10301030
}
10311031

1032-
/// An object that creates [SemanticsUpdate] objects.
1033-
///
1034-
/// Once created, the [SemanticsUpdate] objects can be passed to
1035-
/// [PlatformDispatcher.updateSemantics] to update the semantics conveyed to the
1036-
/// user.
1037-
@Deprecated('Temporary API. Will be removed once migration is complete.')
1038-
abstract class SemanticsUpdateBuilderNew {
1039-
/// Creates an empty [SemanticsUpdateBuilderNew] object.
1040-
@Deprecated('Temporary API. Will be removed once migration is complete.')
1041-
factory SemanticsUpdateBuilderNew() = _NativeSemanticsUpdateBuilderNew;
1042-
1043-
/// Update the information associated with the node with the given `id`.
1044-
///
1045-
/// The semantics nodes form a tree, with the root of the tree always having
1046-
/// an id of zero. The `childrenInTraversalOrder` and `childrenInHitTestOrder`
1047-
/// are the ids of the nodes that are immediate children of this node. The
1048-
/// former enumerates children in traversal order, and the latter enumerates
1049-
/// the same children in the hit test order. The two lists must have the same
1050-
/// length and contain the same ids. They may only differ in the order the
1051-
/// ids are listed in. For more information about different child orders, see
1052-
/// [DebugSemanticsDumpOrder].
1053-
///
1054-
/// The system retains the nodes that are currently reachable from the root.
1055-
/// A given update need not contain information for nodes that do not change
1056-
/// in the update. If a node is not reachable from the root after an update,
1057-
/// the node will be discarded from the tree.
1058-
///
1059-
/// The `flags` are a bit field of [SemanticsFlag]s that apply to this node.
1060-
///
1061-
/// The `actions` are a bit field of [SemanticsAction]s that can be undertaken
1062-
/// by this node. If the user wishes to undertake one of these actions on this
1063-
/// node, the [PlatformDispatcher.onSemanticsActionEvent] will be called with
1064-
/// a [SemanticsActionEvent] specifying the action to be performed. Because
1065-
/// the semantics tree is maintained asynchronously, the
1066-
/// [PlatformDispatcher.onSemanticsActionEvent] callback might be called with
1067-
/// an action that is no longer possible.
1068-
///
1069-
/// The `identifier` is a string that describes the node for UI automation
1070-
/// tools that work by querying the accessibility hierarchy, such as Android
1071-
/// UI Automator, iOS XCUITest, or Appium. It's not exposed to users.
1072-
///
1073-
/// The `label` is a string that describes this node. The `value` property
1074-
/// describes the current value of the node as a string. The `increasedValue`
1075-
/// string will become the `value` string after a [SemanticsAction.increase]
1076-
/// action is performed. The `decreasedValue` string will become the `value`
1077-
/// string after a [SemanticsAction.decrease] action is performed. The `hint`
1078-
/// string describes what result an action performed on this node has. The
1079-
/// reading direction of all these strings is given by `textDirection`.
1080-
///
1081-
/// The `labelAttributes`, `valueAttributes`, `hintAttributes`,
1082-
/// `increasedValueAttributes`, and `decreasedValueAttributes` are the lists of
1083-
/// [StringAttribute] carried by the `label`, `value`, `hint`, `increasedValue`,
1084-
/// and `decreasedValue` respectively. Their contents must not be changed during
1085-
/// the semantics update.
1086-
///
1087-
/// The `tooltip` is a string that describe additional information when user
1088-
/// hover or long press on the backing widget of this semantics node.
1089-
///
1090-
/// The fields `textSelectionBase` and `textSelectionExtent` describe the
1091-
/// currently selected text within `value`. A value of -1 indicates no
1092-
/// current text selection base or extent.
1093-
///
1094-
/// The field `maxValueLength` is used to indicate that an editable text
1095-
/// field has a limit on the number of characters entered. If it is -1 there
1096-
/// is no limit on the number of characters entered. The field
1097-
/// `currentValueLength` indicates how much of that limit has already been
1098-
/// used up. When `maxValueLength` is >= 0, `currentValueLength` must also be
1099-
/// >= 0, otherwise it should be specified to be -1.
1100-
///
1101-
/// The field `platformViewId` references the platform view, whose semantics
1102-
/// nodes will be added as children to this node. If a platform view is
1103-
/// specified, `childrenInHitTestOrder` and `childrenInTraversalOrder` must
1104-
/// be empty. A value of -1 indicates that this node is not associated with a
1105-
/// platform view.
1106-
///
1107-
/// For scrollable nodes `scrollPosition` describes the current scroll
1108-
/// position in logical pixel. `scrollExtentMax` and `scrollExtentMin`
1109-
/// describe the maximum and minimum in-rage values that `scrollPosition` can
1110-
/// be. Both or either may be infinity to indicate unbound scrolling. The
1111-
/// value for `scrollPosition` can (temporarily) be outside this range, for
1112-
/// example during an overscroll. `scrollChildren` is the count of the
1113-
/// total number of child nodes that contribute semantics and `scrollIndex`
1114-
/// is the index of the first visible child node that contributes semantics.
1115-
///
1116-
/// The `rect` is the region occupied by this node in its own coordinate
1117-
/// system.
1118-
///
1119-
/// The `transform` is a matrix that maps this node's coordinate system into
1120-
/// its parent's coordinate system.
1121-
///
1122-
/// The `elevation` describes the distance in z-direction between this node
1123-
/// and the `elevation` of the parent.
1124-
///
1125-
/// The `thickness` describes how much space this node occupies in the
1126-
/// z-direction starting at `elevation`. Basically, in the z-direction the
1127-
/// node starts at `elevation` above the parent and ends at `elevation` +
1128-
/// `thickness` above the parent.
1129-
void updateNode({
1130-
required int id,
1131-
required int flags,
1132-
required int actions,
1133-
required int maxValueLength,
1134-
required int currentValueLength,
1135-
required int textSelectionBase,
1136-
required int textSelectionExtent,
1137-
required int platformViewId,
1138-
required int scrollChildren,
1139-
required int scrollIndex,
1140-
required double scrollPosition,
1141-
required double scrollExtentMax,
1142-
required double scrollExtentMin,
1143-
required double elevation,
1144-
required double thickness,
1145-
required Rect rect,
1146-
required String identifier,
1147-
required String label,
1148-
required List<StringAttribute> labelAttributes,
1149-
required String value,
1150-
required List<StringAttribute> valueAttributes,
1151-
required String increasedValue,
1152-
required List<StringAttribute> increasedValueAttributes,
1153-
required String decreasedValue,
1154-
required List<StringAttribute> decreasedValueAttributes,
1155-
required String hint,
1156-
required List<StringAttribute> hintAttributes,
1157-
String? tooltip,
1158-
TextDirection? textDirection,
1159-
required Float64List transform,
1160-
required Int32List childrenInTraversalOrder,
1161-
required Int32List childrenInHitTestOrder,
1162-
required Int32List additionalActions,
1163-
});
1164-
1165-
/// Update the custom semantics action associated with the given `id`.
1166-
///
1167-
/// The name of the action exposed to the user is the `label`. For overridden
1168-
/// standard actions this value is ignored.
1169-
///
1170-
/// The `hint` should describe what happens when an action occurs, not the
1171-
/// manner in which a tap is accomplished. For example, use "delete" instead
1172-
/// of "double tap to delete".
1173-
///
1174-
/// The text direction of the `hint` and `label` is the same as the global
1175-
/// window.
1176-
///
1177-
/// For overridden standard actions, `overrideId` corresponds with a
1178-
/// [SemanticsAction.index] value. For custom actions this argument should not be
1179-
/// provided.
1180-
void updateCustomAction({required int id, String? label, String? hint, int overrideId = -1});
1181-
1182-
/// Creates a [SemanticsUpdate] object that encapsulates the updates recorded
1183-
/// by this object.
1184-
///
1185-
/// The returned object can be passed to [PlatformDispatcher.updateSemantics]
1186-
/// to actually update the semantics retained by the system.
1187-
///
1188-
/// This object is unusable after calling build.
1189-
SemanticsUpdate build();
1190-
}
1191-
1192-
base class _NativeSemanticsUpdateBuilderNew extends NativeFieldWrapperClass1 implements SemanticsUpdateBuilderNew {
1193-
_NativeSemanticsUpdateBuilderNew() { _constructor(); }
1194-
1195-
@Native<Void Function(Handle)>(symbol: 'SemanticsUpdateBuilder::Create')
1196-
external void _constructor();
1197-
1198-
@override
1199-
void updateNode({
1200-
required int id,
1201-
required int flags,
1202-
required int actions,
1203-
required int maxValueLength,
1204-
required int currentValueLength,
1205-
required int textSelectionBase,
1206-
required int textSelectionExtent,
1207-
required int platformViewId,
1208-
required int scrollChildren,
1209-
required int scrollIndex,
1210-
required double scrollPosition,
1211-
required double scrollExtentMax,
1212-
required double scrollExtentMin,
1213-
required double elevation,
1214-
required double thickness,
1215-
required Rect rect,
1216-
required String identifier,
1217-
required String label,
1218-
required List<StringAttribute> labelAttributes,
1219-
required String value,
1220-
required List<StringAttribute> valueAttributes,
1221-
required String increasedValue,
1222-
required List<StringAttribute> increasedValueAttributes,
1223-
required String decreasedValue,
1224-
required List<StringAttribute> decreasedValueAttributes,
1225-
required String hint,
1226-
required List<StringAttribute> hintAttributes,
1227-
String? tooltip,
1228-
TextDirection? textDirection,
1229-
required Float64List transform,
1230-
required Int32List childrenInTraversalOrder,
1231-
required Int32List childrenInHitTestOrder,
1232-
required Int32List additionalActions,
1233-
}) {
1234-
assert(_matrix4IsValid(transform));
1235-
_updateNode(
1236-
id,
1237-
flags,
1238-
actions,
1239-
maxValueLength,
1240-
currentValueLength,
1241-
textSelectionBase,
1242-
textSelectionExtent,
1243-
platformViewId,
1244-
scrollChildren,
1245-
scrollIndex,
1246-
scrollPosition,
1247-
scrollExtentMax,
1248-
scrollExtentMin,
1249-
rect.left,
1250-
rect.top,
1251-
rect.right,
1252-
rect.bottom,
1253-
elevation,
1254-
thickness,
1255-
identifier,
1256-
label,
1257-
labelAttributes,
1258-
value,
1259-
valueAttributes,
1260-
increasedValue,
1261-
increasedValueAttributes,
1262-
decreasedValue,
1263-
decreasedValueAttributes,
1264-
hint,
1265-
hintAttributes,
1266-
tooltip ?? '',
1267-
textDirection != null ? textDirection.index + 1 : 0,
1268-
transform,
1269-
childrenInTraversalOrder,
1270-
childrenInHitTestOrder,
1271-
additionalActions,
1272-
);
1273-
}
1274-
@Native<
1275-
Void Function(
1276-
Pointer<Void>,
1277-
Int32,
1278-
Int32,
1279-
Int32,
1280-
Int32,
1281-
Int32,
1282-
Int32,
1283-
Int32,
1284-
Int32,
1285-
Int32,
1286-
Int32,
1287-
Double,
1288-
Double,
1289-
Double,
1290-
Double,
1291-
Double,
1292-
Double,
1293-
Double,
1294-
Double,
1295-
Double,
1296-
Handle,
1297-
Handle,
1298-
Handle,
1299-
Handle,
1300-
Handle,
1301-
Handle,
1302-
Handle,
1303-
Handle,
1304-
Handle,
1305-
Handle,
1306-
Handle,
1307-
Handle,
1308-
Int32,
1309-
Handle,
1310-
Handle,
1311-
Handle,
1312-
Handle)>(symbol: 'SemanticsUpdateBuilder::updateNode')
1313-
external void _updateNode(
1314-
int id,
1315-
int flags,
1316-
int actions,
1317-
int maxValueLength,
1318-
int currentValueLength,
1319-
int textSelectionBase,
1320-
int textSelectionExtent,
1321-
int platformViewId,
1322-
int scrollChildren,
1323-
int scrollIndex,
1324-
double scrollPosition,
1325-
double scrollExtentMax,
1326-
double scrollExtentMin,
1327-
double left,
1328-
double top,
1329-
double right,
1330-
double bottom,
1331-
double elevation,
1332-
double thickness,
1333-
String identifier,
1334-
String label,
1335-
List<StringAttribute> labelAttributes,
1336-
String value,
1337-
List<StringAttribute> valueAttributes,
1338-
String increasedValue,
1339-
List<StringAttribute> increasedValueAttributes,
1340-
String decreasedValue,
1341-
List<StringAttribute> decreasedValueAttributes,
1342-
String hint,
1343-
List<StringAttribute> hintAttributes,
1344-
String tooltip,
1345-
int textDirection,
1346-
Float64List transform,
1347-
Int32List childrenInTraversalOrder,
1348-
Int32List childrenInHitTestOrder,
1349-
Int32List additionalActions);
1350-
1351-
@override
1352-
void updateCustomAction({required int id, String? label, String? hint, int overrideId = -1}) {
1353-
_updateCustomAction(id, label ?? '', hint ?? '', overrideId);
1354-
}
1355-
@Native<Void Function(Pointer<Void>, Int32, Handle, Handle, Int32)>(symbol: 'SemanticsUpdateBuilder::updateCustomAction')
1356-
external void _updateCustomAction(int id, String label, String hint, int overrideId);
1357-
1358-
@override
1359-
SemanticsUpdate build() {
1360-
final _NativeSemanticsUpdate semanticsUpdate = _NativeSemanticsUpdate._();
1361-
_build(semanticsUpdate);
1362-
return semanticsUpdate;
1363-
}
1364-
@Native<Void Function(Pointer<Void>, Handle)>(symbol: 'SemanticsUpdateBuilder::build')
1365-
external void _build(_NativeSemanticsUpdate outSemanticsUpdate);
1366-
}
1367-
13681032
/// An opaque object representing a batch of semantics updates.
13691033
///
13701034
/// To create a SemanticsUpdate object, use a [SemanticsUpdateBuilder].

0 commit comments

Comments
 (0)