Semantic hit test order for Slivers (#11792)

* Semantic hit test order for Slivers

* ++

* fix double space

* refactoring

* fix test

* comment fix

* tests

* remove accidental debugDumpSemanticsTree

* review comments

* fix button
This commit is contained in:
Michael Goderbauer
2017-08-28 15:49:16 -07:00
committed by GitHub
parent 10e65a16f8
commit 8ecf19d8a0
12 changed files with 276 additions and 52 deletions

View File

@@ -145,9 +145,14 @@ class FlutterDevice {
await view.uiIsolate.flutterDebugDumpLayerTree();
}
Future<Null> debugDumpSemanticsTree() async {
Future<Null> debugDumpSemanticsTreeInTraversalOrder() async {
for (FlutterView view in views)
await view.uiIsolate.flutterDebugDumpSemanticsTree();
await view.uiIsolate.flutterDebugDumpSemanticsTreeInTraversalOrder();
}
Future<Null> debugDumpSemanticsTreeInInverseHitTestOrder() async {
for (FlutterView view in views)
await view.uiIsolate.flutterDebugDumpSemanticsTreeInInverseHitTestOrder();
}
Future<Null> toggleDebugPaintSizeEnabled() async {
@@ -431,10 +436,16 @@ abstract class ResidentRunner {
await device.debugDumpLayerTree();
}
Future<Null> _debugDumpSemanticsTree() async {
Future<Null> _debugDumpSemanticsTreeInTraversalOrder() async {
await refreshViews();
for (FlutterDevice device in flutterDevices)
await device.debugDumpSemanticsTree();
await device.debugDumpSemanticsTreeInTraversalOrder();
}
Future<Null> _debugDumpSemanticsTreeInInverseHitTestOrder() async {
await refreshViews();
for (FlutterDevice device in flutterDevices)
await device.debugDumpSemanticsTreeInInverseHitTestOrder();
}
Future<Null> _debugToggleDebugPaintSizeEnabled() async {
@@ -607,7 +618,12 @@ abstract class ResidentRunner {
}
} else if (character == 'S') {
if (supportsServiceProtocol) {
await _debugDumpSemanticsTree();
await _debugDumpSemanticsTreeInTraversalOrder();
return true;
}
} else if (character == 'P') {
if (supportsServiceProtocol) {
await _debugDumpSemanticsTreeInInverseHitTestOrder();
return true;
}
} else if (character == 'p') {
@@ -743,12 +759,12 @@ abstract class ResidentRunner {
printStatus('You can dump the widget hierarchy of the app (debugDumpApp) by pressing "w".');
printStatus('To dump the rendering tree of the app (debugDumpRenderTree), press "t".');
if (isRunningDebug) {
printStatus('For layers (debugDumpLayerTree), use "L"; accessibility (debugDumpSemantics), "S".');
printStatus('For layers (debugDumpLayerTree), use "L"; accessibility (debugDumpSemantics), "S" (traversal order) or "P" (inverse hit test order).');
printStatus('To toggle the widget inspector (WidgetsApp.showWidgetInspectorOverride), press "i".');
printStatus('To toggle the display of construction lines (debugPaintSizeEnabled), press "p".');
printStatus('To simulate different operating systems, (defaultTargetPlatform), press "o".');
} else {
printStatus('To dump the accessibility tree (debugDumpSemantics), press "S".');
printStatus('To dump the accessibility tree (debugDumpSemantics), press "S" (for traversal order) or "P" (for inverse hit test order).');
}
printStatus('To display the performance overlay (WidgetsApp.showPerformanceOverlay), press "P".');
}

View File

@@ -1069,8 +1069,12 @@ class Isolate extends ServiceObjectOwner {
return invokeFlutterExtensionRpcRaw('ext.flutter.debugDumpLayerTree', timeout: kLongRequestTimeout);
}
Future<Map<String, dynamic>> flutterDebugDumpSemanticsTree() {
return invokeFlutterExtensionRpcRaw('ext.flutter.debugDumpSemanticsTree', timeout: kLongRequestTimeout);
Future<Map<String, dynamic>> flutterDebugDumpSemanticsTreeInTraversalOrder() {
return invokeFlutterExtensionRpcRaw('ext.flutter.debugDumpSemanticsTreeInTraversalOrder', timeout: kLongRequestTimeout);
}
Future<Map<String, dynamic>> flutterDebugDumpSemanticsTreeInInverseHitTestOrder() {
return invokeFlutterExtensionRpcRaw('ext.flutter.debugDumpSemanticsTreeInInverseHitTestOrder', timeout: kLongRequestTimeout);
}
Future<Map<String, dynamic>> _flutterToggle(String name) async {