[a11y] Make sure RenderFractionalTranslation updates its semantics after the translation field is set (#48985)
This commit is contained in:
committed by
Flutter GitHub Bot
parent
fcf341e4f3
commit
b67d5ec6e9
@@ -8,12 +8,8 @@ import 'package:meta/meta.dart';
|
||||
|
||||
import '../android/android_sdk.dart';
|
||||
import '../android/android_workflow.dart';
|
||||
import '../base/common.dart';
|
||||
import '../base/file_system.dart';
|
||||
import '../base/io.dart';
|
||||
import '../base/process.dart';
|
||||
import '../base/utils.dart';
|
||||
import '../convert.dart';
|
||||
import '../device.dart';
|
||||
import '../emulator.dart';
|
||||
import '../globals.dart' as globals;
|
||||
@@ -54,59 +50,18 @@ class AndroidEmulator extends Emulator {
|
||||
|
||||
@override
|
||||
Future<void> launch() async {
|
||||
final Process process = await processUtils.start(
|
||||
<String>[getEmulatorPath(androidSdk), '-avd', id],
|
||||
final Future<void> launchResult = processUtils.run(
|
||||
<String>[getEmulatorPath(), '-avd', id],
|
||||
throwOnError: true,
|
||||
);
|
||||
|
||||
// Record output from the emulator process.
|
||||
final List<String> stdoutList = <String>[];
|
||||
final List<String> stderrList = <String>[];
|
||||
final StreamSubscription<String> stdoutSubscription = process.stdout
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen(stdoutList.add);
|
||||
final StreamSubscription<String> stderrSubscription = process.stderr
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen(stderrList.add);
|
||||
final Future<void> stdioFuture = waitGroup<void>(<Future<void>>[
|
||||
stdoutSubscription.asFuture<void>(),
|
||||
stderrSubscription.asFuture<void>(),
|
||||
// The emulator continues running on a successful launch, so if it hasn't
|
||||
// quit within 3 seconds we assume that's a success and just return. This
|
||||
// means that on a slow machine, a failure that takes more than three
|
||||
// seconds won't be recognized as such... :-/
|
||||
return Future.any<void>(<Future<void>>[
|
||||
launchResult,
|
||||
Future<void>.delayed(const Duration(seconds: 3)),
|
||||
]);
|
||||
|
||||
// The emulator continues running on success, so we don't wait for the
|
||||
// process to complete before continuing. However, if the process fails
|
||||
// after the startup phase (3 seconds), then we only echo its output if
|
||||
// its error code is non-zero and its stderr is non-empty.
|
||||
bool earlyFailure = true;
|
||||
unawaited(process.exitCode.then((int status) async {
|
||||
if (status == 0) {
|
||||
globals.printTrace('The Android emulator exited successfully');
|
||||
return;
|
||||
}
|
||||
// Make sure the process' stdout and stderr are drained.
|
||||
await stdioFuture;
|
||||
unawaited(stdoutSubscription.cancel());
|
||||
unawaited(stderrSubscription.cancel());
|
||||
if (stdoutList.isNotEmpty) {
|
||||
globals.printTrace('Android emulator stdout:');
|
||||
stdoutList.forEach(globals.printTrace);
|
||||
}
|
||||
if (!earlyFailure && stderrList.isEmpty) {
|
||||
globals.printStatus('The Android emulator exited with code $status');
|
||||
return;
|
||||
}
|
||||
final String when = earlyFailure ? 'during startup' : 'after startup';
|
||||
globals.printError('The Android emulator exited with code $status $when');
|
||||
globals.printError('Android emulator stderr:');
|
||||
stderrList.forEach(globals.printError);
|
||||
globals.printError('Address these issues and try again.');
|
||||
}));
|
||||
|
||||
// Wait a few seconds for the emulator to start.
|
||||
await Future<void>.delayed(const Duration(seconds: 3));
|
||||
earlyFailure = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,14 +22,11 @@ import '../base/os.dart';
|
||||
import '../base/terminal.dart';
|
||||
import '../base/utils.dart';
|
||||
import '../build_info.dart';
|
||||
import '../compile.dart';
|
||||
import '../convert.dart';
|
||||
import '../devfs.dart';
|
||||
import '../device.dart';
|
||||
import '../features.dart';
|
||||
import '../globals.dart' as globals;
|
||||
import '../platform_plugins.dart';
|
||||
import '../plugins.dart';
|
||||
import '../project.dart';
|
||||
import '../reporting/reporting.dart';
|
||||
import '../resident_runner.dart';
|
||||
@@ -101,10 +98,6 @@ abstract class ResidentWebRunner extends ResidentRunner {
|
||||
final List<String> dartDefines;
|
||||
DateTime firstBuildTime;
|
||||
|
||||
// Used with the new compiler to generate a bootstrap file containing plugins
|
||||
// and platform initialization.
|
||||
Directory _generatedEntrypointDirectory;
|
||||
|
||||
// Only the debug builds of the web support the service protocol.
|
||||
@override
|
||||
bool get supportsServiceProtocol => isRunningDebug && deviceIsDebuggable;
|
||||
@@ -158,7 +151,6 @@ abstract class ResidentWebRunner extends ResidentRunner {
|
||||
await _stdOutSub?.cancel();
|
||||
await _webFs?.stop();
|
||||
await device.device.stopApp(null);
|
||||
_generatedEntrypointDirectory?.deleteSync(recursive: true);
|
||||
if (ChromeLauncher.hasChromeInstance) {
|
||||
final Chrome chrome = await ChromeLauncher.connectedInstance;
|
||||
await chrome.close();
|
||||
@@ -486,46 +478,6 @@ class _ExperimentalResidentWebRunner extends ResidentWebRunner {
|
||||
return OperationResult.ok;
|
||||
}
|
||||
|
||||
// Flutter web projects need to include a generated main entrypoint to call the
|
||||
// appropriate bootstrap method and inject plugins.
|
||||
// Keep this in sync with build_system/targets/web.dart.
|
||||
Future<String> _generateEntrypoint(String main, String packagesPath) async {
|
||||
File result = _generatedEntrypointDirectory?.childFile('web_entrypoint.dart');
|
||||
if (_generatedEntrypointDirectory == null) {
|
||||
_generatedEntrypointDirectory ??= globals.fs.systemTempDirectory.createTempSync('flutter_tools.')
|
||||
..createSync();
|
||||
result = _generatedEntrypointDirectory.childFile('web_entrypoint.dart');
|
||||
|
||||
final bool hasWebPlugins = findPlugins(flutterProject)
|
||||
.any((Plugin p) => p.platforms.containsKey(WebPlugin.kConfigKey));
|
||||
await injectPlugins(flutterProject, checkProjects: true);
|
||||
|
||||
final PackageUriMapper packageUriMapper = PackageUriMapper(main, packagesPath, null, null);
|
||||
final String generatedPath = globals.fs.currentDirectory
|
||||
.childDirectory('lib')
|
||||
.childFile('generated_plugin_registrant.dart')
|
||||
.absolute.path;
|
||||
final Uri generatedImport = packageUriMapper.map(generatedPath);
|
||||
|
||||
final String entrypoint = <String>[
|
||||
'import "${packageUriMapper.map(main)}" as entrypoint;',
|
||||
'import "dart:ui" as ui;',
|
||||
if (hasWebPlugins)
|
||||
'import "package:flutter_web_plugins/flutter_web_plugins.dart";',
|
||||
if (hasWebPlugins)
|
||||
'import "$generatedImport";',
|
||||
'Future<void> main() async {',
|
||||
if (hasWebPlugins)
|
||||
' registerPlugins(webPluginRegistry);'
|
||||
' await ui.webOnlyInitializePlatform();',
|
||||
' entrypoint.main();',
|
||||
'}',
|
||||
].join('\n');
|
||||
result.writeAsStringSync(entrypoint);
|
||||
}
|
||||
return result.path;
|
||||
}
|
||||
|
||||
Future<UpdateFSReport> _updateDevFS({bool fullRestart = false}) async {
|
||||
final bool isFirstUpload = !assetBundle.wasBuiltOnce();
|
||||
final bool rebuildBundle = assetBundle.needsBuild();
|
||||
@@ -547,7 +499,7 @@ class _ExperimentalResidentWebRunner extends ResidentWebRunner {
|
||||
timeout: timeoutConfiguration.fastOperation,
|
||||
);
|
||||
final UpdateFSReport report = await device.devFS.update(
|
||||
mainPath: await _generateEntrypoint(mainPath, packagesFilePath),
|
||||
mainPath: mainPath,
|
||||
target: target,
|
||||
bundle: assetBundle,
|
||||
firstBuildTime: firstBuildTime,
|
||||
|
||||
@@ -32,7 +32,6 @@ const String kDart2jsOptimization = 'Dart2jsOptimization';
|
||||
const String kCspMode = 'cspMode';
|
||||
|
||||
/// Generates an entry point for a web target.
|
||||
// Keep this in sync with build_runner/resident_web_runner.dart
|
||||
class WebEntrypointTarget extends Target {
|
||||
const WebEntrypointTarget();
|
||||
|
||||
|
||||
@@ -69,7 +69,16 @@ class EmulatorsCommand extends FlutterCommand {
|
||||
"More than one emulator matches '$id':",
|
||||
);
|
||||
} else {
|
||||
await emulators.first.launch();
|
||||
try {
|
||||
await emulators.first.launch();
|
||||
}
|
||||
catch (e) {
|
||||
if (e is String) {
|
||||
globals.printError(e);
|
||||
} else {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ window.\$hotReloadHook = function(modules) {
|
||||
// once we've reloaded every module, trigger the hot reload.
|
||||
if (reloadCount == modules.length) {
|
||||
require(["$entrypoint", "dart_sdk"], function(app, dart_sdk) {
|
||||
// See L81 below for an explanation.
|
||||
window.\$mainEntrypoint = app[Object.keys(app)[0]].main;
|
||||
window.\$mainEntrypoint = app.main.main;
|
||||
window.\$hotReload(resolve);
|
||||
});
|
||||
}
|
||||
@@ -79,23 +78,22 @@ define("main_module", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) {
|
||||
let voidToNull = () => (voidToNull = dart_sdk.dart.constFn(dart_sdk.dart.fnType(dart_sdk.core.Null, [dart_sdk.dart.void])))();
|
||||
|
||||
// Attach the main entrypoint and hot reload functionality to the window.
|
||||
// The app module will have a single property which contains the actual application
|
||||
// code. The property name is based off of the entrypoint that is generated, for example
|
||||
// the file `foo/bar/baz.dart` will generate a property named approximately
|
||||
// `foo__bar__baz`. Rather than attempt to guess, we assume the first property of
|
||||
// this object is the module.
|
||||
window.\$mainEntrypoint = app[Object.keys(app)[0]].main;
|
||||
window.\$mainEntrypoint = app.main.main;
|
||||
if (window.\$hotReload == null) {
|
||||
window.\$hotReload = function(cb) {
|
||||
dart_sdk.developer.invokeExtension("ext.flutter.disassemble", "{}").then((_) => {
|
||||
dart_sdk.dart.hotRestart();
|
||||
window.\$mainEntrypoint();
|
||||
window.requestAnimationFrame(cb);
|
||||
dart_sdk.ui.webOnlyInitializePlatform().then(dart_sdk.core.Null, dart_sdk.dart.fn(_ => {
|
||||
window.\$mainEntrypoint();
|
||||
window.requestAnimationFrame(cb);
|
||||
}, voidToNull()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.\$mainEntrypoint();
|
||||
dart_sdk.ui.webOnlyInitializePlatform().then(dart_sdk.core.Null, dart_sdk.dart.fn(_ => {
|
||||
app.main.main();
|
||||
}, voidToNull()));
|
||||
});
|
||||
|
||||
// Require JS configuration.
|
||||
|
||||
Reference in New Issue
Block a user