Commit 41a91a7a authored by Adam Barth's avatar Adam Barth Committed by GitHub

Use "SemanticsFoo" consistently instead of "SemanticFoo" (#6233)

This change might make our grammar less perfect, but it will increase our
sanity.
parent 60814764
...@@ -204,7 +204,7 @@ BoxConstraints _getAdditionalConstraints(String label) { ...@@ -204,7 +204,7 @@ BoxConstraints _getAdditionalConstraints(String label) {
); );
} }
class _RenderSlider extends RenderConstrainedBox implements SemanticActionHandler { class _RenderSlider extends RenderConstrainedBox implements SemanticsActionHandler {
_RenderSlider({ _RenderSlider({
double value, double value,
int divisions, int divisions,
...@@ -445,7 +445,7 @@ class _RenderSlider extends RenderConstrainedBox implements SemanticActionHandle ...@@ -445,7 +445,7 @@ class _RenderSlider extends RenderConstrainedBox implements SemanticActionHandle
bool get isSemanticBoundary => isInteractive; bool get isSemanticBoundary => isInteractive;
@override @override
SemanticAnnotator get semanticAnnotator => _annotate; SemanticsAnnotator get semanticsAnnotator => _annotate;
void _annotate(SemanticsNode semantics) { void _annotate(SemanticsNode semantics) {
if (isInteractive) if (isInteractive)
...@@ -453,13 +453,13 @@ class _RenderSlider extends RenderConstrainedBox implements SemanticActionHandle ...@@ -453,13 +453,13 @@ class _RenderSlider extends RenderConstrainedBox implements SemanticActionHandle
} }
@override @override
void performAction(SemanticAction action) { void performAction(SemanticsAction action) {
switch (action) { switch (action) {
case SemanticAction.increase: case SemanticsAction.increase:
if (isInteractive) if (isInteractive)
onChanged((value + _kAdjustmentUnit).clamp(0.0, 1.0)); onChanged((value + _kAdjustmentUnit).clamp(0.0, 1.0));
break; break;
case SemanticAction.decrease: case SemanticsAction.decrease:
if (isInteractive) if (isInteractive)
onChanged((value - _kAdjustmentUnit).clamp(0.0, 1.0)); onChanged((value - _kAdjustmentUnit).clamp(0.0, 1.0));
break; break;
......
...@@ -18,7 +18,7 @@ final Tween<double> _kRadialReactionRadiusTween = new Tween<double>(begin: 0.0, ...@@ -18,7 +18,7 @@ final Tween<double> _kRadialReactionRadiusTween = new Tween<double>(begin: 0.0,
/// This class handles storing the current value, dispatching ValueChanged on a /// This class handles storing the current value, dispatching ValueChanged on a
/// tap gesture and driving a changed animation. Subclasses are responsible for /// tap gesture and driving a changed animation. Subclasses are responsible for
/// painting. /// painting.
abstract class RenderToggleable extends RenderConstrainedBox implements SemanticActionHandler { abstract class RenderToggleable extends RenderConstrainedBox implements SemanticsActionHandler {
/// Creates a toggleable render object. /// Creates a toggleable render object.
/// ///
/// The [value], [activeColor], and [inactiveColor] arguments must not be /// The [value], [activeColor], and [inactiveColor] arguments must not be
...@@ -286,19 +286,19 @@ abstract class RenderToggleable extends RenderConstrainedBox implements Semantic ...@@ -286,19 +286,19 @@ abstract class RenderToggleable extends RenderConstrainedBox implements Semantic
bool get isSemanticBoundary => isInteractive; bool get isSemanticBoundary => isInteractive;
@override @override
SemanticAnnotator get semanticAnnotator => _annotate; SemanticsAnnotator get semanticsAnnotator => _annotate;
void _annotate(SemanticsNode semantics) { void _annotate(SemanticsNode semantics) {
semantics semantics
..hasCheckedState = true ..hasCheckedState = true
..isChecked = _value; ..isChecked = _value;
if (isInteractive) if (isInteractive)
semantics.addAction(SemanticAction.tap); semantics.addAction(SemanticsAction.tap);
} }
@override @override
void performAction(SemanticAction action) { void performAction(SemanticsAction action) {
if (action == SemanticAction.tap) if (action == SemanticsAction.tap)
_handleTap(); _handleTap();
} }
......
...@@ -46,11 +46,11 @@ semantics. ...@@ -46,11 +46,11 @@ semantics.
Semantic annotators are functions that, given a `SemanticsNode`, set Semantic annotators are functions that, given a `SemanticsNode`, set
some flags or strings on the object. They are obtained from some flags or strings on the object. They are obtained from
`getSemanticAnnotators()`. For example, here is how `RenderParagraph` `getSemanticsAnnotators()`. For example, here is how `RenderParagraph`
annotates the `SemanticsNode` with its text: annotates the `SemanticsNode` with its text:
```dart ```dart
Iterable<SemanticAnnotator> getSemanticAnnotators() sync* { Iterable<SemanticsAnnotator> getSemanticsAnnotators() sync* {
yield (SemanticsNode node) { yield (SemanticsNode node) {
node.label = text.toPlainText(); node.label = text.toPlainText();
}; };
......
...@@ -187,7 +187,7 @@ abstract class RendererBinding extends BindingBase implements SchedulerBinding, ...@@ -187,7 +187,7 @@ abstract class RendererBinding extends BindingBase implements SchedulerBinding,
/// sent to the GPU. /// sent to the GPU.
/// ///
/// 6. The semantics phase: All the dirty [RenderObject]s in the system have /// 6. The semantics phase: All the dirty [RenderObject]s in the system have
/// their semantics updated (see [RenderObject.semanticAnnotator]). This /// their semantics updated (see [RenderObject.SemanticsAnnotator]). This
/// generates the [SemanticsNode] tree. See /// generates the [SemanticsNode] tree. See
/// [RenderObject.markNeedsSemanticsUpdate] for further details on marking an /// [RenderObject.markNeedsSemanticsUpdate] for further details on marking an
/// object dirty for semantics. /// object dirty for semantics.
...@@ -295,7 +295,7 @@ class SemanticsServer extends mojom.SemanticsServer { ...@@ -295,7 +295,7 @@ class SemanticsServer extends mojom.SemanticsServer {
@override @override
void performAction(int id, mojom.SemanticAction encodedAction) { void performAction(int id, mojom.SemanticAction encodedAction) {
_semanticsOwner.performAction(id, SemanticAction.values[encodedAction.mojoEnumValue]); _semanticsOwner.performAction(id, SemanticsAction.values[encodedAction.mojoEnumValue]);
} }
} }
......
...@@ -527,7 +527,7 @@ abstract class _SemanticsFragment { ...@@ -527,7 +527,7 @@ abstract class _SemanticsFragment {
_children = children ?? const <_SemanticsFragment>[]; _children = children ?? const <_SemanticsFragment>[];
} }
final SemanticAnnotator annotator; final SemanticsAnnotator annotator;
List<RenderObject> _ancestorChain; List<RenderObject> _ancestorChain;
void addAncestor(RenderObject ancestor) { void addAncestor(RenderObject ancestor) {
...@@ -574,7 +574,7 @@ class _CleanSemanticsFragment extends _SemanticsFragment { ...@@ -574,7 +574,7 @@ class _CleanSemanticsFragment extends _SemanticsFragment {
abstract class _InterestingSemanticsFragment extends _SemanticsFragment { abstract class _InterestingSemanticsFragment extends _SemanticsFragment {
_InterestingSemanticsFragment({ _InterestingSemanticsFragment({
RenderObject renderObjectOwner, RenderObject renderObjectOwner,
SemanticAnnotator annotator, SemanticsAnnotator annotator,
Iterable<_SemanticsFragment> children Iterable<_SemanticsFragment> children
}) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children); }) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children);
...@@ -608,7 +608,7 @@ abstract class _InterestingSemanticsFragment extends _SemanticsFragment { ...@@ -608,7 +608,7 @@ abstract class _InterestingSemanticsFragment extends _SemanticsFragment {
class _RootSemanticsFragment extends _InterestingSemanticsFragment { class _RootSemanticsFragment extends _InterestingSemanticsFragment {
_RootSemanticsFragment({ _RootSemanticsFragment({
RenderObject renderObjectOwner, RenderObject renderObjectOwner,
SemanticAnnotator annotator, SemanticsAnnotator annotator,
Iterable<_SemanticsFragment> children Iterable<_SemanticsFragment> children
}) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children); }) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children);
...@@ -619,7 +619,7 @@ class _RootSemanticsFragment extends _InterestingSemanticsFragment { ...@@ -619,7 +619,7 @@ class _RootSemanticsFragment extends _InterestingSemanticsFragment {
assert(currentSemantics == null); assert(currentSemantics == null);
assert(parentSemantics == null); assert(parentSemantics == null);
renderObjectOwner._semantics ??= new SemanticsNode.root( renderObjectOwner._semantics ??= new SemanticsNode.root(
handler: renderObjectOwner is SemanticActionHandler ? renderObjectOwner as dynamic : null, handler: renderObjectOwner is SemanticsActionHandler ? renderObjectOwner as dynamic : null,
owner: renderObjectOwner.owner.semanticsOwner owner: renderObjectOwner.owner.semanticsOwner
); );
SemanticsNode node = renderObjectOwner._semantics; SemanticsNode node = renderObjectOwner._semantics;
...@@ -638,14 +638,14 @@ class _RootSemanticsFragment extends _InterestingSemanticsFragment { ...@@ -638,14 +638,14 @@ class _RootSemanticsFragment extends _InterestingSemanticsFragment {
class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment { class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment {
_ConcreteSemanticsFragment({ _ConcreteSemanticsFragment({
RenderObject renderObjectOwner, RenderObject renderObjectOwner,
SemanticAnnotator annotator, SemanticsAnnotator annotator,
Iterable<_SemanticsFragment> children Iterable<_SemanticsFragment> children
}) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children); }) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children);
@override @override
SemanticsNode establishSemanticsNode(_SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics) { SemanticsNode establishSemanticsNode(_SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics) {
renderObjectOwner._semantics ??= new SemanticsNode( renderObjectOwner._semantics ??= new SemanticsNode(
handler: renderObjectOwner is SemanticActionHandler ? renderObjectOwner as dynamic : null handler: renderObjectOwner is SemanticsActionHandler ? renderObjectOwner as dynamic : null
); );
SemanticsNode node = renderObjectOwner._semantics; SemanticsNode node = renderObjectOwner._semantics;
if (geometry != null) { if (geometry != null) {
...@@ -666,7 +666,7 @@ class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment { ...@@ -666,7 +666,7 @@ class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment {
class _ImplicitSemanticsFragment extends _InterestingSemanticsFragment { class _ImplicitSemanticsFragment extends _InterestingSemanticsFragment {
_ImplicitSemanticsFragment({ _ImplicitSemanticsFragment({
RenderObject renderObjectOwner, RenderObject renderObjectOwner,
SemanticAnnotator annotator, SemanticsAnnotator annotator,
Iterable<_SemanticsFragment> children Iterable<_SemanticsFragment> children
}) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children); }) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children);
...@@ -681,7 +681,7 @@ class _ImplicitSemanticsFragment extends _InterestingSemanticsFragment { ...@@ -681,7 +681,7 @@ class _ImplicitSemanticsFragment extends _InterestingSemanticsFragment {
_haveConcreteNode = currentSemantics == null && annotator != null; _haveConcreteNode = currentSemantics == null && annotator != null;
if (haveConcreteNode) { if (haveConcreteNode) {
renderObjectOwner._semantics ??= new SemanticsNode( renderObjectOwner._semantics ??= new SemanticsNode(
handler: renderObjectOwner is SemanticActionHandler ? renderObjectOwner as dynamic : null handler: renderObjectOwner is SemanticsActionHandler ? renderObjectOwner as dynamic : null
); );
node = renderObjectOwner._semantics; node = renderObjectOwner._semantics;
} else { } else {
...@@ -2117,7 +2117,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -2117,7 +2117,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
}); });
_needsSemanticsUpdate = false; _needsSemanticsUpdate = false;
_needsSemanticsGeometryUpdate = false; _needsSemanticsGeometryUpdate = false;
SemanticAnnotator annotator = semanticAnnotator; SemanticsAnnotator annotator = semanticsAnnotator;
if (parent is! RenderObject) if (parent is! RenderObject)
return new _RootSemanticsFragment(renderObjectOwner: this, annotator: annotator, children: children); return new _RootSemanticsFragment(renderObjectOwner: this, annotator: annotator, children: children);
if (isSemanticBoundary) if (isSemanticBoundary)
...@@ -2167,7 +2167,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -2167,7 +2167,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
/// [hasSemantics] isn't true, then the associated call to /// [hasSemantics] isn't true, then the associated call to
/// [markNeedsSemanticsUpdate] must not have `onlyChanges` set, as it is /// [markNeedsSemanticsUpdate] must not have `onlyChanges` set, as it is
/// possible that the node should be entirely removed. /// possible that the node should be entirely removed.
SemanticAnnotator get semanticAnnotator => null; SemanticsAnnotator get semanticsAnnotator => null;
// EVENTS // EVENTS
......
...@@ -246,7 +246,7 @@ class RenderParagraph extends RenderBox { ...@@ -246,7 +246,7 @@ class RenderParagraph extends RenderBox {
} }
@override @override
SemanticAnnotator get semanticAnnotator => _annotate; SemanticsAnnotator get semanticsAnnotator => _annotate;
void _annotate(SemanticsNode node) { void _annotate(SemanticsNode node) {
node.label = text.toPlainText(); node.label = text.toPlainText();
......
...@@ -2321,7 +2321,7 @@ class RenderMetaData extends RenderProxyBoxWithHitTestBehavior { ...@@ -2321,7 +2321,7 @@ class RenderMetaData extends RenderProxyBoxWithHitTestBehavior {
/// Listens for the specified gestures from the semantics server (e.g. /// Listens for the specified gestures from the semantics server (e.g.
/// an accessibility tool). /// an accessibility tool).
class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticActionHandler { class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticsActionHandler {
/// Creates a render object that listens for specific semantic gestures. /// Creates a render object that listens for specific semantic gestures.
/// ///
/// The [scrollFactor] argument must not be null. /// The [scrollFactor] argument must not be null.
...@@ -2406,13 +2406,13 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc ...@@ -2406,13 +2406,13 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
} }
@override @override
SemanticAnnotator get semanticAnnotator => isSemanticBoundary ? _annotate : null; SemanticsAnnotator get semanticsAnnotator => isSemanticBoundary ? _annotate : null;
void _annotate(SemanticsNode node) { void _annotate(SemanticsNode node) {
if (onTap != null) if (onTap != null)
node.addAction(SemanticAction.tap); node.addAction(SemanticsAction.tap);
if (onLongPress != null) if (onLongPress != null)
node.addAction(SemanticAction.longPress); node.addAction(SemanticsAction.longPress);
if (onHorizontalDragUpdate != null) if (onHorizontalDragUpdate != null)
node.addHorizontalScrollingActions(); node.addHorizontalScrollingActions();
if (onVerticalDragUpdate != null) if (onVerticalDragUpdate != null)
...@@ -2420,17 +2420,17 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc ...@@ -2420,17 +2420,17 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
} }
@override @override
void performAction(SemanticAction action) { void performAction(SemanticsAction action) {
switch (action) { switch (action) {
case SemanticAction.tap: case SemanticsAction.tap:
if (onTap != null) if (onTap != null)
onTap(); onTap();
break; break;
case SemanticAction.longPress: case SemanticsAction.longPress:
if (onLongPress != null) if (onLongPress != null)
onLongPress(); onLongPress();
break; break;
case SemanticAction.scrollLeft: case SemanticsAction.scrollLeft:
if (onHorizontalDragUpdate != null) { if (onHorizontalDragUpdate != null) {
final double primaryDelta = size.width * -scrollFactor; final double primaryDelta = size.width * -scrollFactor;
onHorizontalDragUpdate(new DragUpdateDetails( onHorizontalDragUpdate(new DragUpdateDetails(
...@@ -2438,7 +2438,7 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc ...@@ -2438,7 +2438,7 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
)); ));
} }
break; break;
case SemanticAction.scrollRight: case SemanticsAction.scrollRight:
if (onHorizontalDragUpdate != null) { if (onHorizontalDragUpdate != null) {
final double primaryDelta = size.width * scrollFactor; final double primaryDelta = size.width * scrollFactor;
onHorizontalDragUpdate(new DragUpdateDetails( onHorizontalDragUpdate(new DragUpdateDetails(
...@@ -2446,7 +2446,7 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc ...@@ -2446,7 +2446,7 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
)); ));
} }
break; break;
case SemanticAction.scrollUp: case SemanticsAction.scrollUp:
if (onVerticalDragUpdate != null) { if (onVerticalDragUpdate != null) {
final double primaryDelta = size.height * -scrollFactor; final double primaryDelta = size.height * -scrollFactor;
onVerticalDragUpdate(new DragUpdateDetails( onVerticalDragUpdate(new DragUpdateDetails(
...@@ -2454,7 +2454,7 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc ...@@ -2454,7 +2454,7 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
)); ));
} }
break; break;
case SemanticAction.scrollDown: case SemanticsAction.scrollDown:
if (onVerticalDragUpdate != null) { if (onVerticalDragUpdate != null) {
final double primaryDelta = size.height * scrollFactor; final double primaryDelta = size.height * scrollFactor;
onVerticalDragUpdate(new DragUpdateDetails( onVerticalDragUpdate(new DragUpdateDetails(
...@@ -2462,8 +2462,8 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc ...@@ -2462,8 +2462,8 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
)); ));
} }
break; break;
case SemanticAction.increase: case SemanticsAction.increase:
case SemanticAction.decrease: case SemanticsAction.decrease:
assert(false); assert(false);
break; break;
} }
...@@ -2471,11 +2471,11 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc ...@@ -2471,11 +2471,11 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
} }
/// Add annotations to the [SemanticsNode] for this subtree. /// Add annotations to the [SemanticsNode] for this subtree.
class RenderSemanticAnnotations extends RenderProxyBox { class RenderSemanticsAnnotations extends RenderProxyBox {
/// Creates a render object that attaches a semantic annotation. /// Creates a render object that attaches a semantic annotation.
/// ///
/// The [container] argument must not be null. /// The [container] argument must not be null.
RenderSemanticAnnotations({ RenderSemanticsAnnotations({
RenderBox child, RenderBox child,
bool container: false, bool container: false,
bool checked, bool checked,
...@@ -2534,7 +2534,7 @@ class RenderSemanticAnnotations extends RenderProxyBox { ...@@ -2534,7 +2534,7 @@ class RenderSemanticAnnotations extends RenderProxyBox {
bool get isSemanticBoundary => container; bool get isSemanticBoundary => container;
@override @override
SemanticAnnotator get semanticAnnotator => checked != null || label != null ? _annotate : null; SemanticsAnnotator get semanticsAnnotator => checked != null || label != null ? _annotate : null;
void _annotate(SemanticsNode node) { void _annotate(SemanticsNode node) {
if (checked != null) { if (checked != null) {
...@@ -2559,7 +2559,7 @@ class RenderMergeSemantics extends RenderProxyBox { ...@@ -2559,7 +2559,7 @@ class RenderMergeSemantics extends RenderProxyBox {
RenderMergeSemantics({ RenderBox child }) : super(child); RenderMergeSemantics({ RenderBox child }) : super(child);
@override @override
SemanticAnnotator get semanticAnnotator => _annotate; SemanticsAnnotator get semanticsAnnotator => _annotate;
void _annotate(SemanticsNode node) { void _annotate(SemanticsNode node) {
node.mergeAllDescendantsIntoThisNode = true; node.mergeAllDescendantsIntoThisNode = true;
......
...@@ -2719,14 +2719,14 @@ class Semantics extends SingleChildRenderObjectWidget { ...@@ -2719,14 +2719,14 @@ class Semantics extends SingleChildRenderObjectWidget {
final String label; final String label;
@override @override
RenderSemanticAnnotations createRenderObject(BuildContext context) => new RenderSemanticAnnotations( RenderSemanticsAnnotations createRenderObject(BuildContext context) => new RenderSemanticsAnnotations(
container: container, container: container,
checked: checked, checked: checked,
label: label label: label
); );
@override @override
void updateRenderObject(BuildContext context, RenderSemanticAnnotations renderObject) { void updateRenderObject(BuildContext context, RenderSemanticsAnnotations renderObject) {
renderObject renderObject
..container = container ..container = container
..checked = checked ..checked = checked
......
...@@ -268,7 +268,7 @@ abstract class WidgetsBinding extends BindingBase implements GestureBinding, Ren ...@@ -268,7 +268,7 @@ abstract class WidgetsBinding extends BindingBase implements GestureBinding, Ren
/// sent to the GPU. /// sent to the GPU.
/// ///
/// 7. The semantics phase: All the dirty [RenderObject]s in the system have /// 7. The semantics phase: All the dirty [RenderObject]s in the system have
/// their semantics updated (see [RenderObject.semanticAnnotator]). This /// their semantics updated (see [RenderObject.SemanticsAnnotator]). This
/// generates the [SemanticsNode] tree. See /// generates the [SemanticsNode] tree. See
/// [RenderObject.markNeedsSemanticsUpdate] for further details on marking an /// [RenderObject.markNeedsSemanticsUpdate] for further details on marking an
/// object dirty for semantics. /// object dirty for semantics.
......
...@@ -78,14 +78,14 @@ class _SemanticsDebuggerState extends State<SemanticsDebugger> { ...@@ -78,14 +78,14 @@ class _SemanticsDebuggerState extends State<SemanticsDebugger> {
void _handleTap() { void _handleTap() {
assert(_lastPointerDownLocation != null); assert(_lastPointerDownLocation != null);
_client._performAction(_lastPointerDownLocation, SemanticAction.tap); _client._performAction(_lastPointerDownLocation, SemanticsAction.tap);
setState(() { setState(() {
_lastPointerDownLocation = null; _lastPointerDownLocation = null;
}); });
} }
void _handleLongPress() { void _handleLongPress() {
assert(_lastPointerDownLocation != null); assert(_lastPointerDownLocation != null);
_client._performAction(_lastPointerDownLocation, SemanticAction.longPress); _client._performAction(_lastPointerDownLocation, SemanticsAction.longPress);
setState(() { setState(() {
_lastPointerDownLocation = null; _lastPointerDownLocation = null;
}); });
...@@ -127,7 +127,7 @@ class _SemanticsDebuggerEntry { ...@@ -127,7 +127,7 @@ class _SemanticsDebuggerEntry {
_SemanticsDebuggerEntry(this.id); _SemanticsDebuggerEntry(this.id);
final int id; final int id;
final Set<SemanticAction> actions = new Set<SemanticAction>(); final Set<SemanticsAction> actions = new Set<SemanticsAction>();
bool hasCheckedState = false; bool hasCheckedState = false;
bool isChecked = false; bool isChecked = false;
String label; String label;
...@@ -139,7 +139,7 @@ class _SemanticsDebuggerEntry { ...@@ -139,7 +139,7 @@ class _SemanticsDebuggerEntry {
String toString() { String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.write('_SemanticsDebuggerEntry($id; $rect; "$label"'); buffer.write('_SemanticsDebuggerEntry($id; $rect; "$label"');
for (SemanticAction action in actions) for (SemanticsAction action in actions)
buffer.write('; $action'); buffer.write('; $action');
buffer buffer
..write('${hasCheckedState ? isChecked ? "; checked" : "; unchecked" : ""}') ..write('${hasCheckedState ? isChecked ? "; checked" : "; unchecked" : ""}')
...@@ -166,7 +166,7 @@ class _SemanticsDebuggerEntry { ...@@ -166,7 +166,7 @@ class _SemanticsDebuggerEntry {
if (node.actions != null) { if (node.actions != null) {
actions.clear(); actions.clear();
for (int encodedAction in node.actions) for (int encodedAction in node.actions)
actions.add(SemanticAction.values[encodedAction]); actions.add(SemanticsAction.values[encodedAction]);
} }
if (node.strings != null) { if (node.strings != null) {
assert(node.strings.label != null); assert(node.strings.label != null);
...@@ -210,15 +210,15 @@ class _SemanticsDebuggerEntry { ...@@ -210,15 +210,15 @@ class _SemanticsDebuggerEntry {
); );
bool get _isScrollable { bool get _isScrollable {
return actions.contains(SemanticAction.scrollLeft) return actions.contains(SemanticsAction.scrollLeft)
|| actions.contains(SemanticAction.scrollRight) || actions.contains(SemanticsAction.scrollRight)
|| actions.contains(SemanticAction.scrollUp) || actions.contains(SemanticsAction.scrollUp)
|| actions.contains(SemanticAction.scrollDown); || actions.contains(SemanticsAction.scrollDown);
} }
bool get _isAdjustable { bool get _isAdjustable {
return actions.contains(SemanticAction.increase) return actions.contains(SemanticsAction.increase)
|| actions.contains(SemanticAction.decrease); || actions.contains(SemanticsAction.decrease);
} }
TextPainter textPainter; TextPainter textPainter;
...@@ -229,14 +229,14 @@ class _SemanticsDebuggerEntry { ...@@ -229,14 +229,14 @@ class _SemanticsDebuggerEntry {
annotations.add(isChecked ? 'checked' : 'unchecked'); annotations.add(isChecked ? 'checked' : 'unchecked');
wantsTap = true; wantsTap = true;
} }
if (actions.contains(SemanticAction.tap)) { if (actions.contains(SemanticsAction.tap)) {
if (!wantsTap) if (!wantsTap)
annotations.add('button'); annotations.add('button');
} else { } else {
if (wantsTap) if (wantsTap)
annotations.add('disabled'); annotations.add('disabled');
} }
if (actions.contains(SemanticAction.longPress)) if (actions.contains(SemanticsAction.longPress))
annotations.add('long-pressable'); annotations.add('long-pressable');
if (_isScrollable) if (_isScrollable)
annotations.add('scrollable'); annotations.add('scrollable');
...@@ -384,7 +384,7 @@ class _SemanticsClient extends ChangeNotifier { ...@@ -384,7 +384,7 @@ class _SemanticsClient extends ChangeNotifier {
return rootNode?.hitTest(position, filter); return rootNode?.hitTest(position, filter);
} }
void _performAction(Point position, SemanticAction action) { void _performAction(Point position, SemanticsAction action) {
_SemanticsDebuggerEntry entry = _hitTest(position, (_SemanticsDebuggerEntry entry) => entry.actions.contains(action)); _SemanticsDebuggerEntry entry = _hitTest(position, (_SemanticsDebuggerEntry entry) => entry.actions.contains(action));
_semanticsOwner.performAction(entry?.id ?? 0, action); _semanticsOwner.performAction(entry?.id ?? 0, action);
} }
...@@ -396,17 +396,17 @@ class _SemanticsClient extends ChangeNotifier { ...@@ -396,17 +396,17 @@ class _SemanticsClient extends ChangeNotifier {
return; return;
if (vx.abs() > vy.abs()) { if (vx.abs() > vy.abs()) {
if (vx.sign < 0) { if (vx.sign < 0) {
_performAction(position, SemanticAction.decrease); _performAction(position, SemanticsAction.decrease);
_performAction(position, SemanticAction.scrollLeft); _performAction(position, SemanticsAction.scrollLeft);
} else { } else {
_performAction(position, SemanticAction.increase); _performAction(position, SemanticsAction.increase);
_performAction(position, SemanticAction.scrollRight); _performAction(position, SemanticsAction.scrollRight);
} }
} else { } else {
if (vy.sign < 0) if (vy.sign < 0)
_performAction(position, SemanticAction.scrollUp); _performAction(position, SemanticsAction.scrollUp);
else else
_performAction(position, SemanticAction.scrollDown); _performAction(position, SemanticsAction.scrollDown);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment