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

Commit b685eed

Browse files
authored
Revert "null-annotate SemanticsUpdateBuilder.updateNode (#18552)"
This reverts commit cc08940.
1 parent 243bb59 commit b685eed

File tree

2 files changed

+95
-143
lines changed

2 files changed

+95
-143
lines changed

lib/ui/semantics.dart

Lines changed: 67 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -647,21 +647,19 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
647647
/// reading direction of all these strings is given by `textDirection`.
648648
///
649649
/// The fields `textSelectionBase` and `textSelectionExtent` describe the
650-
/// currently selected text within `value`. A value of -1 indicates no
651-
/// current text selection base or extent.
650+
/// currently selected text within `value`.
652651
///
653-
/// The field `maxValueLength` is used to indicate that an editable text
654-
/// field has a limit on the number of characters entered. If it is -1 there
655-
/// is no limit on the number of characters entered. The field
652+
/// The field `maxValueLength` is used to indicate that an editable text field
653+
/// has a limit on the number of characters entered. If it is -1 there is
654+
/// no limit on the number of characters entered. The field
656655
/// `currentValueLength` indicates how much of that limit has already been
657-
/// used up. When `maxValueLength` is >= 0, `currentValueLength` must also be
658-
/// >= 0, otherwise it should be specified to be -1.
656+
/// used up. When `maxValueLength` is set, `currentValueLength` must also be
657+
/// set.
659658
///
660659
/// The field `platformViewId` references the platform view, whose semantics
661660
/// nodes will be added as children to this node. If a platform view is
662-
/// specified, `childrenInHitTestOrder` and `childrenInTraversalOrder` must
663-
/// be empty. A value of -1 indicates that this node is not associated with a
664-
/// platform view.
661+
/// specified, `childrenInHitTestOrder` and `childrenInTraversalOrder` must be
662+
/// empty.
665663
///
666664
/// For scrollable nodes `scrollPosition` describes the current scroll
667665
/// position in logical pixel. `scrollExtentMax` and `scrollExtentMin`
@@ -685,61 +683,39 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
685683
/// z-direction starting at `elevation`. Basically, in the z-direction the
686684
/// node starts at `elevation` above the parent and ends at `elevation` +
687685
/// `thickness` above the parent.
688-
// TODO(cbracken): https://github.com/flutter/flutter/issues/57720
689686
void updateNode({
690-
/*required*/ int/*!*/ id,
691-
/*required*/ int/*!*/ flags,
692-
/*required*/ int/*!*/ actions,
693-
/*required*/ int/*!*/ maxValueLength,
694-
/*required*/ int/*!*/ currentValueLength,
695-
/*required*/ int/*!*/ textSelectionBase,
696-
/*required*/ int/*!*/ textSelectionExtent,
697-
/*required*/ int/*!*/ platformViewId,
698-
/*required*/ int/*!*/ scrollChildren,
699-
/*required*/ int/*!*/ scrollIndex,
700-
/*required*/ double/*!*/ scrollPosition,
701-
/*required*/ double/*!*/ scrollExtentMax,
702-
/*required*/ double/*!*/ scrollExtentMin,
703-
/*required*/ double/*!*/ elevation,
704-
/*required*/ double/*!*/ thickness,
705-
/*required*/ Rect/*!*/ rect,
706-
/*required*/ String/*!*/ label,
707-
/*required*/ String/*!*/ hint,
708-
/*required*/ String/*!*/ value,
709-
/*required*/ String/*!*/ increasedValue,
710-
/*required*/ String/*!*/ decreasedValue,
711-
TextDirection/*?*/ textDirection,
712-
/*required*/ Float64List/*!*/ transform,
713-
/*required*/ Int32List/*!*/ childrenInTraversalOrder,
714-
/*required*/ Int32List/*!*/ childrenInHitTestOrder,
715-
/*required*/ Int32List/*!*/ additionalActions,
687+
int id,
688+
int flags,
689+
int actions,
690+
int maxValueLength,
691+
int currentValueLength,
692+
int textSelectionBase,
693+
int textSelectionExtent,
694+
int platformViewId,
695+
int scrollChildren,
696+
int scrollIndex,
697+
double scrollPosition,
698+
double scrollExtentMax,
699+
double scrollExtentMin,
700+
double elevation,
701+
double thickness,
702+
Rect rect,
703+
String label,
704+
String hint,
705+
String value,
706+
String increasedValue,
707+
String decreasedValue,
708+
TextDirection textDirection,
709+
Float64List transform,
710+
Int32List childrenInTraversalOrder,
711+
Int32List childrenInHitTestOrder,
712+
Int32List additionalActions,
716713
}) {
717-
assert(id != null);
718-
assert(flags != null);
719-
assert(actions != null);
720-
assert(maxValueLength != null);
721-
assert(currentValueLength != null);
722-
assert(textSelectionBase != null);
723-
assert(textSelectionExtent != null);
724-
assert(platformViewId != null);
725-
assert(scrollChildren != null);
726-
assert(scrollIndex != null);
727-
assert(scrollPosition != null);
728-
assert(scrollExtentMax != null);
729-
assert(scrollExtentMin != null);
730-
assert(elevation != null);
731-
assert(thickness != null);
732-
assert(rect != null);
733-
assert(label != null);
734-
assert(hint != null);
735-
assert(value != null);
736-
assert(increasedValue != null);
737-
assert(decreasedValue != null);
738-
assert(transform != null);
739-
assert(childrenInTraversalOrder != null);
740-
assert(childrenInHitTestOrder != null);
741-
assert(additionalActions != null);
742714
assert(_matrix4IsValid(transform));
715+
assert(
716+
scrollChildren == 0 || scrollChildren == null || (scrollChildren > 0 && childrenInHitTestOrder != null),
717+
'If a node has scrollChildren, it must have childrenInHitTestOrder',
718+
);
743719
_updateNode(
744720
id,
745721
flags,
@@ -773,35 +749,35 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
773749
);
774750
}
775751
void _updateNode(
776-
int/*!*/ id,
777-
int/*!*/ flags,
778-
int/*!*/ actions,
779-
int/*!*/ maxValueLength,
780-
int/*!*/ currentValueLength,
781-
int/*!*/ textSelectionBase,
782-
int/*!*/ textSelectionExtent,
783-
int/*!*/ platformViewId,
784-
int/*!*/ scrollChildren,
785-
int/*!*/ scrollIndex,
786-
double/*!*/ scrollPosition,
787-
double/*!*/ scrollExtentMax,
788-
double/*!*/ scrollExtentMin,
789-
double/*!*/ left,
790-
double/*!*/ top,
791-
double/*!*/ right,
792-
double/*!*/ bottom,
793-
double/*!*/ elevation,
794-
double/*!*/ thickness,
795-
String/*!*/ label,
796-
String/*!*/ hint,
797-
String/*!*/ value,
798-
String/*!*/ increasedValue,
799-
String/*!*/ decreasedValue,
800-
int/*!*/ textDirection,
801-
Float64List/*!*/ transform,
802-
Int32List/*!*/ childrenInTraversalOrder,
803-
Int32List/*!*/ childrenInHitTestOrder,
804-
Int32List/*!*/ additionalActions,
752+
int id,
753+
int flags,
754+
int actions,
755+
int maxValueLength,
756+
int currentValueLength,
757+
int textSelectionBase,
758+
int textSelectionExtent,
759+
int platformViewId,
760+
int scrollChildren,
761+
int scrollIndex,
762+
double scrollPosition,
763+
double scrollExtentMax,
764+
double scrollExtentMin,
765+
double left,
766+
double top,
767+
double right,
768+
double bottom,
769+
double elevation,
770+
double thickness,
771+
String label,
772+
String hint,
773+
String value,
774+
String increasedValue,
775+
String decreasedValue,
776+
int textDirection,
777+
Float64List transform,
778+
Int32List childrenInTraversalOrder,
779+
Int32List childrenInHitTestOrder,
780+
Int32List additionalActions,
805781
) native 'SemanticsUpdateBuilder_updateNode';
806782

807783
/// Update the custom semantics action associated with the given `id`.

lib/web_ui/lib/src/ui/semantics.dart

Lines changed: 28 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -667,59 +667,35 @@ class SemanticsUpdateBuilder {
667667
/// The `transform` is a matrix that maps this node's coordinate system into
668668
/// its parent's coordinate system.
669669
void updateNode({
670-
/*required*/ int/*!*/ id,
671-
/*required*/ int/*!*/ flags,
672-
/*required*/ int/*!*/ actions,
673-
/*required*/ int/*!*/ maxValueLength,
674-
/*required*/ int/*!*/ currentValueLength,
675-
/*required*/ int/*!*/ textSelectionBase,
676-
/*required*/ int/*!*/ textSelectionExtent,
677-
/*required*/ int/*!*/ platformViewId,
678-
/*required*/ int/*!*/ scrollChildren,
679-
/*required*/ int/*!*/ scrollIndex,
680-
/*required*/ double/*!*/ scrollPosition,
681-
/*required*/ double/*!*/ scrollExtentMax,
682-
/*required*/ double/*!*/ scrollExtentMin,
683-
/*required*/ double/*!*/ elevation,
684-
/*required*/ double/*!*/ thickness,
685-
/*required*/ Rect/*!*/ rect,
686-
/*required*/ String/*!*/ label,
687-
/*required*/ String/*!*/ hint,
688-
/*required*/ String/*!*/ value,
689-
/*required*/ String/*!*/ increasedValue,
690-
/*required*/ String/*!*/ decreasedValue,
691-
TextDirection/*?*/ textDirection,
692-
/*required*/ Float64List/*!*/ transform,
693-
/*required*/ Int32List/*!*/ childrenInTraversalOrder,
694-
/*required*/ Int32List/*!*/ childrenInHitTestOrder,
695-
/*required*/ Int32List/*!*/ additionalActions,
670+
int id,
671+
int flags,
672+
int actions,
673+
int maxValueLength,
674+
int currentValueLength,
675+
int textSelectionBase,
676+
int textSelectionExtent,
677+
int platformViewId,
678+
int scrollChildren,
679+
int scrollIndex,
680+
double scrollPosition,
681+
double scrollExtentMax,
682+
double scrollExtentMin,
683+
double elevation,
684+
double thickness,
685+
Rect rect,
686+
String label,
687+
String hint,
688+
String value,
689+
String increasedValue,
690+
String decreasedValue,
691+
TextDirection textDirection,
692+
Float64List transform,
693+
Int32List childrenInTraversalOrder,
694+
Int32List childrenInHitTestOrder,
695+
Int32List additionalActions,
696696
}) {
697-
assert(id != null);
698-
assert(flags != null);
699-
assert(actions != null);
700-
assert(maxValueLength != null);
701-
assert(currentValueLength != null);
702-
assert(textSelectionBase != null);
703-
assert(textSelectionExtent != null);
704-
assert(platformViewId != null);
705-
assert(scrollChildren != null);
706-
assert(scrollIndex != null);
707-
assert(scrollPosition != null);
708-
assert(scrollExtentMax != null);
709-
assert(scrollExtentMin != null);
710-
assert(elevation != null);
711-
assert(thickness != null);
712-
assert(rect != null);
713-
assert(label != null);
714-
assert(hint != null);
715-
assert(value != null);
716-
assert(increasedValue != null);
717-
assert(decreasedValue != null);
718-
assert(transform != null);
719-
assert(childrenInTraversalOrder != null);
720-
assert(childrenInHitTestOrder != null);
721-
assert(additionalActions != null);
722-
assert(transform.length == 16, 'transform argument must have 16 entries.');
697+
if (transform.length != 16)
698+
throw ArgumentError('transform argument must have 16 entries.');
723699
_nodeUpdates.add(engine.SemanticsNodeUpdate(
724700
id: id,
725701
flags: flags,

0 commit comments

Comments
 (0)