Unverified Commit 8c02a224 authored by Bartek Pacia's avatar Bartek Pacia Committed by GitHub

Use `SemanticsUpdateBuilder` again, remove all references to temporary...

Use `SemanticsUpdateBuilder` again, remove all references to temporary `SemanticsUpdateBuilderNew` (#139942)

This PR removes all usages of the temporary `SemanticsUpdateBuilderNew` API in favor of `SemanticsUpdateBuilder`. These two APIs are the same as of now.

This is mainly targeted at https://github.com/flutter/flutter/issues/17988

Steps:
part 1: [engine] add `SemanticsUpdateBuilderNew` https://github.com/flutter/engine/pull/47961
part 2: [flutter] use `SemanticsUpdateBuilderNew` https://github.com/flutter/flutter/pull/138331
part 3: [engine] update `SemanticsUpdateBuilder` to be the same as `SemanticsUpdateBuilderNew` https://github.com/flutter/engine/pull/48882
**part 4: [flutter] use (now updated) `SemanticsUpdateBuilder` again** <-- we are here
part 5: [engine] remove `SemanticsBuilderNew`
parent 3958b3d5
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
// ignore: deprecated_member_use // ignore: deprecated_member_use
import 'dart:ui' as ui show AccessibilityFeatures, SemanticsActionEvent, SemanticsUpdateBuilderNew; import 'dart:ui' as ui show AccessibilityFeatures, SemanticsActionEvent, SemanticsUpdateBuilder;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
...@@ -11,7 +11,7 @@ import 'package:flutter/services.dart'; ...@@ -11,7 +11,7 @@ import 'package:flutter/services.dart';
import 'debug.dart'; import 'debug.dart';
// ignore: deprecated_member_use // ignore: deprecated_member_use
export 'dart:ui' show AccessibilityFeatures, SemanticsActionEvent, SemanticsUpdateBuilderNew; export 'dart:ui' show AccessibilityFeatures, SemanticsActionEvent, SemanticsUpdateBuilder;
/// The glue between the semantics layer and the Flutter engine. /// The glue between the semantics layer and the Flutter engine.
mixin SemanticsBinding on BindingBase { mixin SemanticsBinding on BindingBase {
...@@ -162,10 +162,8 @@ mixin SemanticsBinding on BindingBase { ...@@ -162,10 +162,8 @@ mixin SemanticsBinding on BindingBase {
/// ///
/// This method is used by the [SemanticsOwner] to create builder for all its /// This method is used by the [SemanticsOwner] to create builder for all its
/// semantics updates. /// semantics updates.
// ignore: deprecated_member_use ui.SemanticsUpdateBuilder createSemanticsUpdateBuilder() {
ui.SemanticsUpdateBuilderNew createSemanticsUpdateBuilder() { return ui.SemanticsUpdateBuilder();
// ignore: deprecated_member_use
return ui.SemanticsUpdateBuilderNew();
} }
/// The platform is requesting that animations be disabled or simplified. /// The platform is requesting that animations be disabled or simplified.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:math' as math; import 'dart:math' as math;
// ignore: deprecated_member_use // ignore: deprecated_member_use
import 'dart:ui' show Offset, Rect, SemanticsAction, SemanticsFlag, SemanticsUpdate, SemanticsUpdateBuilderNew, StringAttribute, TextDirection; import 'dart:ui' show Offset, Rect, SemanticsAction, SemanticsFlag, SemanticsUpdate, SemanticsUpdateBuilder, StringAttribute, TextDirection;
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
...@@ -2750,8 +2750,7 @@ class SemanticsNode with DiagnosticableTreeMixin { ...@@ -2750,8 +2750,7 @@ class SemanticsNode with DiagnosticableTreeMixin {
static final Int32List _kEmptyCustomSemanticsActionsList = Int32List(0); static final Int32List _kEmptyCustomSemanticsActionsList = Int32List(0);
static final Float64List _kIdentityTransform = _initIdentityTransform(); static final Float64List _kIdentityTransform = _initIdentityTransform();
// ignore: deprecated_member_use void _addToUpdate(SemanticsUpdateBuilder builder, Set<int> customSemanticsActionIdsUpdate) {
void _addToUpdate(SemanticsUpdateBuilderNew builder, Set<int> customSemanticsActionIdsUpdate) {
assert(_dirty); assert(_dirty);
final SemanticsData data = getSemanticsData(); final SemanticsData data = getSemanticsData();
final Int32List childrenInTraversalOrder; final Int32List childrenInTraversalOrder;
...@@ -3444,8 +3443,7 @@ class SemanticsOwner extends ChangeNotifier { ...@@ -3444,8 +3443,7 @@ class SemanticsOwner extends ChangeNotifier {
} }
} }
visitedNodes.sort((SemanticsNode a, SemanticsNode b) => a.depth - b.depth); visitedNodes.sort((SemanticsNode a, SemanticsNode b) => a.depth - b.depth);
// ignore: deprecated_member_use final SemanticsUpdateBuilder builder = SemanticsBinding.instance.createSemanticsUpdateBuilder();
final SemanticsUpdateBuilderNew builder = SemanticsBinding.instance.createSemanticsUpdateBuilder();
for (final SemanticsNode node in visitedNodes) { for (final SemanticsNode node in visitedNodes) {
assert(node.parent?._dirty != true); // could be null (no parent) or false (not dirty) assert(node.parent?._dirty != true); // could be null (no parent) or false (not dirty)
// The _serialize() method marks the node as not dirty, and // The _serialize() method marks the node as not dirty, and
......
...@@ -171,16 +171,13 @@ void main() { ...@@ -171,16 +171,13 @@ void main() {
class SemanticsUpdateTestBinding extends AutomatedTestWidgetsFlutterBinding { class SemanticsUpdateTestBinding extends AutomatedTestWidgetsFlutterBinding {
@override @override
// ignore: deprecated_member_use ui.SemanticsUpdateBuilder createSemanticsUpdateBuilder() {
ui.SemanticsUpdateBuilderNew createSemanticsUpdateBuilder() {
return SemanticsUpdateBuilderSpy(); return SemanticsUpdateBuilderSpy();
} }
} }
// ignore: deprecated_member_use class SemanticsUpdateBuilderSpy extends Fake implements ui.SemanticsUpdateBuilder {
class SemanticsUpdateBuilderSpy extends Fake implements ui.SemanticsUpdateBuilderNew { final SemanticsUpdateBuilder _builder = ui.SemanticsUpdateBuilder();
// ignore: deprecated_member_use
final SemanticsUpdateBuilderNew _builder = ui.SemanticsUpdateBuilderNew();
static Map<int, SemanticsNodeUpdateObservation> observations = <int, SemanticsNodeUpdateObservation>{}; static Map<int, SemanticsNodeUpdateObservation> observations = <int, SemanticsNodeUpdateObservation>{};
......
...@@ -259,8 +259,7 @@ void main() { ...@@ -259,8 +259,7 @@ void main() {
}); });
testWidgets('updateSemantics is passed through to backing FlutterView', (WidgetTester tester) async { testWidgets('updateSemantics is passed through to backing FlutterView', (WidgetTester tester) async {
// ignore: deprecated_member_use final SemanticsUpdate expectedUpdate = SemanticsUpdateBuilder().build();
final SemanticsUpdate expectedUpdate = SemanticsUpdateBuilderNew().build();
final _FakeFlutterView backingView = _FakeFlutterView(); final _FakeFlutterView backingView = _FakeFlutterView();
final TestFlutterView view = TestFlutterView( final TestFlutterView view = TestFlutterView(
view: backingView, view: backingView,
......
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