mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Code cleanup (flutter/engine#27734)
This commit is contained in:
parent
1f60d544d8
commit
fd982f2fc5
@ -41,13 +41,9 @@ linter:
|
||||
throw_in_finally: false
|
||||
type_init_formals: false
|
||||
unnecessary_getters_setters: false
|
||||
unnecessary_null_aware_assignments: false
|
||||
unnecessary_null_in_if_null_operators: false
|
||||
unrelated_type_equality_checks: false
|
||||
use_rethrow_when_possible: false
|
||||
valid_regexps: false
|
||||
use_function_type_syntax_for_parameters: false
|
||||
prefer_final_in_for_each: false
|
||||
avoid_single_cascade_in_expression_statements: false
|
||||
flutter_style_todos: false
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ abstract class Browser {
|
||||
// If we don't manually close the stream the test runner can hang.
|
||||
// For example this happens with Chrome Headless.
|
||||
// See SDK issue: https://github.com/dart-lang/sdk/issues/31264
|
||||
for (StreamSubscription<void> stream in _ioSubscriptions) {
|
||||
for (final StreamSubscription<void> stream in _ioSubscriptions) {
|
||||
unawaited(stream.cancel());
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ class Environment {
|
||||
final io.Directory webUiRootDir = io.Directory(
|
||||
pathlib.join(engineSrcDir.path, 'flutter', 'lib', 'web_ui'));
|
||||
|
||||
for (io.Directory expectedDirectory in <io.Directory>[
|
||||
for (final io.Directory expectedDirectory in <io.Directory>[
|
||||
engineSrcDir,
|
||||
outDir,
|
||||
hostDebugUnoptDir,
|
||||
|
||||
@ -273,7 +273,7 @@ class FirefoxInstaller {
|
||||
// Parses volume from mount result.
|
||||
// Output is of form: {devicename} /Volumes/{name}.
|
||||
String? _volumeFromMountResult(List<String> lines) {
|
||||
for (String line in lines) {
|
||||
for (final String line in lines) {
|
||||
final int pos = line.indexOf('/Volumes');
|
||||
if (pos != -1) {
|
||||
return line.substring(pos);
|
||||
|
||||
@ -31,7 +31,7 @@ class LicensesCommand extends Command<bool> {
|
||||
final List<String> allDartPaths =
|
||||
allSourceFiles.map((io.File f) => f.path).toList();
|
||||
|
||||
for (String expectedDirectory in const <String>[
|
||||
for (final String expectedDirectory in const <String>[
|
||||
'lib',
|
||||
'test',
|
||||
'dev',
|
||||
|
||||
@ -615,7 +615,7 @@ class BrowserManager {
|
||||
// Start this canceled because we don't want it to start ticking until we
|
||||
// get some response from the iframe.
|
||||
_timer = RestartableTimer(Duration(seconds: 3), () {
|
||||
for (RunnerSuiteController controller in _controllers) {
|
||||
for (final RunnerSuiteController controller in _controllers) {
|
||||
controller.setDebugging(true);
|
||||
}
|
||||
})
|
||||
@ -629,7 +629,7 @@ class BrowserManager {
|
||||
if (!_closed) {
|
||||
_timer.reset();
|
||||
}
|
||||
for (RunnerSuiteController controller in _controllers) {
|
||||
for (final RunnerSuiteController controller in _controllers) {
|
||||
controller.setDebugging(false);
|
||||
}
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ class TestCommand extends Command<bool> with ArgUtils<bool> {
|
||||
'finish.',
|
||||
);
|
||||
|
||||
for (BrowserArgParser browserArgParser in _browserArgParsers) {
|
||||
for (final BrowserArgParser browserArgParser in _browserArgParsers) {
|
||||
browserArgParser.populateOptions(argParser);
|
||||
}
|
||||
GeneralTestsArgumentParser.instance.populateOptions(argParser);
|
||||
@ -174,7 +174,7 @@ class TestCommand extends Command<bool> with ArgUtils<bool> {
|
||||
|
||||
@override
|
||||
Future<bool> run() async {
|
||||
for (BrowserArgParser browserArgParser in _browserArgParsers) {
|
||||
for (final BrowserArgParser browserArgParser in _browserArgParsers) {
|
||||
browserArgParser.parseOptions(argResults!);
|
||||
}
|
||||
GeneralTestsArgumentParser.instance.parseOptions(argResults!);
|
||||
@ -225,7 +225,7 @@ class TestCommand extends Command<bool> with ArgUtils<bool> {
|
||||
final StringBuffer message = StringBuffer(
|
||||
'The following test shards failed:\n',
|
||||
);
|
||||
for (String failedShard in failedShards) {
|
||||
for (final String failedShard in failedShards) {
|
||||
message.writeln(' - $failedShard');
|
||||
}
|
||||
return message.toString();
|
||||
@ -292,7 +292,7 @@ class TestCommand extends Command<bool> with ArgUtils<bool> {
|
||||
final List<FilePath> canvasKitTargets = <FilePath>[];
|
||||
final String canvasKitTestDirectory =
|
||||
path.join(environment.webUiTestDir.path, 'canvaskit');
|
||||
for (FilePath target in allTargets) {
|
||||
for (final FilePath target in allTargets) {
|
||||
if (path.isWithin(canvasKitTestDirectory, target.absolute)) {
|
||||
canvasKitTargets.add(target);
|
||||
} else {
|
||||
@ -432,7 +432,7 @@ class TestCommand extends Command<bool> with ArgUtils<bool> {
|
||||
final List<FilePath> screenshotTestFiles = <FilePath>[];
|
||||
final List<FilePath> unitTestFiles = <FilePath>[];
|
||||
|
||||
for (io.File testFile
|
||||
for (final io.File testFile
|
||||
in testDir.listSync(recursive: true).whereType<io.File>()) {
|
||||
final FilePath testFilePath = FilePath.fromCwd(testFile.path);
|
||||
if (!testFilePath.absolute.endsWith('_test.dart')) {
|
||||
@ -476,7 +476,7 @@ class TestCommand extends Command<bool> with ArgUtils<bool> {
|
||||
|
||||
if (isUnitTestsScreenshotsAvailable) {
|
||||
// Run screenshot tests one at a time.
|
||||
for (FilePath testFilePath in screenshotTestFiles) {
|
||||
for (final FilePath testFilePath in screenshotTestFiles) {
|
||||
await _runTestBatch(
|
||||
<FilePath>[testFilePath],
|
||||
concurrency: 1,
|
||||
@ -716,7 +716,7 @@ void _copyTestFontsIntoWebUi() {
|
||||
'fonts',
|
||||
);
|
||||
|
||||
for (String fontFile in _kTestFonts) {
|
||||
for (final String fontFile in _kTestFonts) {
|
||||
final io.File sourceTtf = io.File(path.join(fontsPath, fontFile));
|
||||
final String destinationTtfPath =
|
||||
path.join(environment.webUiRootDir.path, 'lib', 'assets', fontFile);
|
||||
|
||||
@ -376,13 +376,13 @@ final List<AsyncCallback> cleanupCallbacks = <AsyncCallback>[];
|
||||
Future<void> cleanup() async {
|
||||
// Cleanup remaining processes if any.
|
||||
if (processesToCleanUp.isNotEmpty) {
|
||||
for (io.Process process in processesToCleanUp) {
|
||||
for (final io.Process process in processesToCleanUp) {
|
||||
process.kill();
|
||||
}
|
||||
}
|
||||
// Delete temporary directories.
|
||||
if (temporaryDirectories.isNotEmpty) {
|
||||
for (io.Directory directory in temporaryDirectories) {
|
||||
for (final io.Directory directory in temporaryDirectories) {
|
||||
if (!directory.existsSync()) {
|
||||
directory.deleteSync(recursive: true);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class Pipeline {
|
||||
Future<void> run() async {
|
||||
_status = PipelineStatus.started;
|
||||
try {
|
||||
for (PipelineStep step in steps) {
|
||||
for (final PipelineStep step in steps) {
|
||||
if (status != PipelineStatus.started) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ void initializeEngine() {
|
||||
// This extension does not need to clean-up Dart statics. Those are cleaned
|
||||
// up by the compiler.
|
||||
developer.registerExtension('ext.flutter.disassemble', (_, __) {
|
||||
for (ui.VoidCallback listener in _hotRestartListeners) {
|
||||
for (final ui.VoidCallback listener in _hotRestartListeners) {
|
||||
listener();
|
||||
}
|
||||
return Future<developer.ServiceExtensionResponse>.value(
|
||||
|
||||
@ -330,7 +330,7 @@ class CanvasPool extends _SaveStackTracking {
|
||||
|
||||
void endOfPaint() {
|
||||
if (_reusablePool != null) {
|
||||
for (html.CanvasElement e in _reusablePool!) {
|
||||
for (final html.CanvasElement e in _reusablePool!) {
|
||||
if (browserEngine == BrowserEngine.webkit) {
|
||||
e.width = e.height = 0;
|
||||
}
|
||||
@ -825,7 +825,7 @@ class CanvasPool extends _SaveStackTracking {
|
||||
|
||||
void _clearActiveCanvasList() {
|
||||
if (_activeCanvasList != null) {
|
||||
for (html.CanvasElement c in _activeCanvasList!) {
|
||||
for (final html.CanvasElement c in _activeCanvasList!) {
|
||||
if (browserEngine == BrowserEngine.webkit) {
|
||||
c.width = c.height = 0;
|
||||
}
|
||||
|
||||
@ -218,12 +218,12 @@ class HtmlViewEmbedder {
|
||||
_svgPathDefs!.querySelector('#sk_path_defs')!;
|
||||
final List<html.Element> nodesToRemove = <html.Element>[];
|
||||
final Set<String> oldDefs = _svgClipDefs[viewId]!;
|
||||
for (html.Element child in clipDefs.children) {
|
||||
for (final html.Element child in clipDefs.children) {
|
||||
if (oldDefs.contains(child.id)) {
|
||||
nodesToRemove.add(child);
|
||||
}
|
||||
}
|
||||
for (html.Element node in nodesToRemove) {
|
||||
for (final html.Element node in nodesToRemove) {
|
||||
node.remove();
|
||||
}
|
||||
_svgClipDefs[viewId]!.clear();
|
||||
|
||||
@ -49,14 +49,14 @@ class FontFallbackData {
|
||||
final Map<NotoFont, List<CodeunitRange>> ranges =
|
||||
<NotoFont, List<CodeunitRange>>{};
|
||||
|
||||
for (NotoFont font in _notoFonts) {
|
||||
for (final NotoFont font in _notoFonts) {
|
||||
// TODO(yjbanov): instead of mutating the font tree during reset, it's
|
||||
// better to construct an immutable tree of resolved fonts
|
||||
// pointing back to the original NotoFont objects. Then
|
||||
// resetting the tree would be a matter of reconstructing
|
||||
// the new resolved tree.
|
||||
font.reset();
|
||||
for (CodeunitRange range in font.approximateUnicodeRanges) {
|
||||
for (final CodeunitRange range in font.approximateUnicodeRanges) {
|
||||
ranges.putIfAbsent(font, () => <CodeunitRange>[]).add(range);
|
||||
}
|
||||
}
|
||||
@ -119,7 +119,7 @@ class FontFallbackData {
|
||||
final List<int> codeUnits = runesToCheck.toList();
|
||||
|
||||
final List<SkFont> fonts = <SkFont>[];
|
||||
for (String font in fontFamilies) {
|
||||
for (final String font in fontFamilies) {
|
||||
final List<SkFont>? typefacesForFamily =
|
||||
skiaFontCollection.familyToFontMap[font];
|
||||
if (typefacesForFamily != null) {
|
||||
@ -129,7 +129,7 @@ class FontFallbackData {
|
||||
final List<bool> codeUnitsSupported =
|
||||
List<bool>.filled(codeUnits.length, false);
|
||||
final String testString = String.fromCharCodes(codeUnits);
|
||||
for (SkFont font in fonts) {
|
||||
for (final SkFont font in fonts) {
|
||||
final Uint8List glyphs = font.getGlyphIDs(testString);
|
||||
assert(glyphs.length == codeUnitsSupported.length);
|
||||
for (int i = 0; i < glyphs.length; i++) {
|
||||
@ -172,7 +172,7 @@ class FontFallbackData {
|
||||
List<bool>.filled(codeUnits.length, false);
|
||||
final String testString = String.fromCharCodes(codeUnits);
|
||||
|
||||
for (String font in globalFontFallbacks) {
|
||||
for (final String font in globalFontFallbacks) {
|
||||
final List<SkFont>? fontsForFamily =
|
||||
skiaFontCollection.familyToFontMap[font];
|
||||
if (fontsForFamily == null) {
|
||||
@ -180,7 +180,7 @@ class FontFallbackData {
|
||||
'cannot retrieve the typeface for it.');
|
||||
continue;
|
||||
}
|
||||
for (SkFont font in fontsForFamily) {
|
||||
for (final SkFont font in fontsForFamily) {
|
||||
final Uint8List glyphs = font.getGlyphIDs(testString);
|
||||
assert(glyphs.length == codeUnitsSupported.length);
|
||||
for (int i = 0; i < glyphs.length; i++) {
|
||||
@ -196,7 +196,7 @@ class FontFallbackData {
|
||||
// Once we've checked every typeface for this family, check to see if
|
||||
// every code unit has been covered in order to avoid unnecessary checks.
|
||||
bool keepGoing = false;
|
||||
for (bool supported in codeUnitsSupported) {
|
||||
for (final bool supported in codeUnitsSupported) {
|
||||
if (!supported) {
|
||||
keepGoing = true;
|
||||
break;
|
||||
@ -253,7 +253,7 @@ Future<void> findFontsForMissingCodeunits(List<int> codeUnits) async {
|
||||
Set<NotoFont> fonts = <NotoFont>{};
|
||||
final Set<int> coveredCodeUnits = <int>{};
|
||||
final Set<int> missingCodeUnits = <int>{};
|
||||
for (int codeUnit in codeUnits) {
|
||||
for (final int codeUnit in codeUnits) {
|
||||
final List<NotoFont> fontsForUnit = data.notoTree.intersections(codeUnit);
|
||||
fonts.addAll(fontsForUnit);
|
||||
if (fontsForUnit.isNotEmpty) {
|
||||
@ -263,7 +263,7 @@ Future<void> findFontsForMissingCodeunits(List<int> codeUnits) async {
|
||||
}
|
||||
}
|
||||
|
||||
for (NotoFont font in fonts) {
|
||||
for (final NotoFont font in fonts) {
|
||||
await font.ensureResolved();
|
||||
}
|
||||
|
||||
@ -273,8 +273,8 @@ Future<void> findFontsForMissingCodeunits(List<int> codeUnits) async {
|
||||
fonts = findMinimumFontsForCodeUnits(unmatchedCodeUnits, fonts);
|
||||
|
||||
final Set<_ResolvedNotoSubset> resolvedFonts = <_ResolvedNotoSubset>{};
|
||||
for (int codeUnit in coveredCodeUnits) {
|
||||
for (NotoFont font in fonts) {
|
||||
for (final int codeUnit in coveredCodeUnits) {
|
||||
for (final NotoFont font in fonts) {
|
||||
if (font.resolvedFont == null) {
|
||||
// We failed to resolve the font earlier.
|
||||
continue;
|
||||
@ -283,7 +283,7 @@ Future<void> findFontsForMissingCodeunits(List<int> codeUnits) async {
|
||||
}
|
||||
}
|
||||
|
||||
for (_ResolvedNotoSubset resolvedFont in resolvedFonts) {
|
||||
for (final _ResolvedNotoSubset resolvedFont in resolvedFonts) {
|
||||
notoDownloadQueue.add(resolvedFont);
|
||||
}
|
||||
|
||||
@ -401,8 +401,8 @@ _ResolvedNotoFont? _makeResolvedNotoFontFromCss(String css, String name) {
|
||||
|
||||
final Map<_ResolvedNotoSubset, List<CodeunitRange>> rangesMap =
|
||||
<_ResolvedNotoSubset, List<CodeunitRange>>{};
|
||||
for (_ResolvedNotoSubset subset in subsets) {
|
||||
for (CodeunitRange range in subset.ranges) {
|
||||
for (final _ResolvedNotoSubset subset in subsets) {
|
||||
for (final CodeunitRange range in subset.ranges) {
|
||||
rangesMap.putIfAbsent(subset, () => <CodeunitRange>[]).add(range);
|
||||
}
|
||||
}
|
||||
@ -493,9 +493,9 @@ Set<NotoFont> findMinimumFontsForCodeUnits(
|
||||
while (codeUnits.isNotEmpty) {
|
||||
int maxCodeUnitsCovered = 0;
|
||||
bestFonts.clear();
|
||||
for (NotoFont font in fonts) {
|
||||
for (final NotoFont font in fonts) {
|
||||
int codeUnitsCovered = 0;
|
||||
for (int codeUnit in codeUnits) {
|
||||
for (final int codeUnit in codeUnits) {
|
||||
if (font.resolvedFont?.tree.containsDeep(codeUnit) == true) {
|
||||
codeUnitsCovered++;
|
||||
}
|
||||
@ -891,7 +891,7 @@ class FallbackFontDownloadQueue {
|
||||
Future<void> startDownloads() async {
|
||||
final Map<String, Future<void>> downloads = <String, Future<void>>{};
|
||||
final Map<String, Uint8List> downloadedData = <String, Uint8List>{};
|
||||
for (_ResolvedNotoSubset subset in pendingSubsets.values) {
|
||||
for (final _ResolvedNotoSubset subset in pendingSubsets.values) {
|
||||
downloads[subset.url] = Future<void>(() async {
|
||||
ByteBuffer buffer;
|
||||
try {
|
||||
@ -915,7 +915,7 @@ class FallbackFontDownloadQueue {
|
||||
// visual differences between app reloads.
|
||||
final List<String> downloadOrder =
|
||||
(downloadedData.keys.toList()..sort()).reversed.toList();
|
||||
for (String url in downloadOrder) {
|
||||
for (final String url in downloadOrder) {
|
||||
final _ResolvedNotoSubset subset = pendingSubsets.remove(url)!;
|
||||
final Uint8List bytes = downloadedData[url]!;
|
||||
FontFallbackData.instance.registerFallbackFont(subset.family, bytes);
|
||||
|
||||
@ -43,14 +43,14 @@ class SkiaFontCollection {
|
||||
fontProvider = canvasKit.TypefaceFontProvider.Make();
|
||||
familyToFontMap.clear();
|
||||
|
||||
for (RegisteredFont font in _registeredFonts) {
|
||||
for (final RegisteredFont font in _registeredFonts) {
|
||||
fontProvider!.registerFont(font.bytes, font.family);
|
||||
familyToFontMap
|
||||
.putIfAbsent(font.family, () => <SkFont>[])
|
||||
.add(SkFont(font.typeface));
|
||||
}
|
||||
|
||||
for (RegisteredFont font
|
||||
for (final RegisteredFont font
|
||||
in FontFallbackData.instance.registeredFallbackFonts) {
|
||||
fontProvider!.registerFont(font.bytes, font.family);
|
||||
familyToFontMap
|
||||
@ -66,7 +66,7 @@ class SkiaFontCollection {
|
||||
return;
|
||||
}
|
||||
final List<RegisteredFont?> loadedFonts = await Future.wait(_unloadedFonts);
|
||||
for (RegisteredFont? font in loadedFonts) {
|
||||
for (final RegisteredFont? font in loadedFonts) {
|
||||
if (font != null) {
|
||||
_registeredFonts.add(font);
|
||||
}
|
||||
@ -117,7 +117,7 @@ class SkiaFontCollection {
|
||||
|
||||
bool registeredRoboto = false;
|
||||
|
||||
for (Map<String, dynamic> fontFamily
|
||||
for (final Map<String, dynamic> fontFamily
|
||||
in fontManifest.cast<Map<String, dynamic>>()) {
|
||||
final String family = fontFamily['family']!;
|
||||
final List<dynamic> fontAssets = fontFamily['fonts'];
|
||||
@ -126,7 +126,7 @@ class SkiaFontCollection {
|
||||
registeredRoboto = true;
|
||||
}
|
||||
|
||||
for (dynamic fontAssetItem in fontAssets) {
|
||||
for (final dynamic fontAssetItem in fontAssets) {
|
||||
final Map<String, dynamic> fontAsset = fontAssetItem;
|
||||
final String asset = fontAsset['asset'];
|
||||
_unloadedFonts
|
||||
|
||||
@ -22,7 +22,7 @@ class IntervalTree<T> {
|
||||
// Get a list of all the ranges ordered by start index.
|
||||
final List<IntervalTreeNode<T>> intervals = <IntervalTreeNode<T>>[];
|
||||
rangesMap.forEach((T key, List<CodeunitRange> rangeList) {
|
||||
for (CodeunitRange range in rangeList) {
|
||||
for (final CodeunitRange range in rangeList) {
|
||||
intervals.add(IntervalTreeNode<T>(key, range.start, range.end));
|
||||
}
|
||||
});
|
||||
|
||||
@ -59,7 +59,7 @@ class PrerollContext {
|
||||
|
||||
ui.Rect get cullRect {
|
||||
ui.Rect cullRect = ui.Rect.largest;
|
||||
for (Mutator m in mutatorsStack) {
|
||||
for (final Mutator m in mutatorsStack) {
|
||||
ui.Rect clipRect;
|
||||
switch (m.type) {
|
||||
case MutatorType.clipRect:
|
||||
@ -131,7 +131,7 @@ abstract class ContainerLayer extends Layer {
|
||||
/// [Rect] is empty.
|
||||
ui.Rect prerollChildren(PrerollContext context, Matrix4 childMatrix) {
|
||||
ui.Rect childPaintBounds = ui.Rect.zero;
|
||||
for (Layer layer in _layers) {
|
||||
for (final Layer layer in _layers) {
|
||||
layer.preroll(context, childMatrix);
|
||||
if (childPaintBounds.isEmpty) {
|
||||
childPaintBounds = layer.paintBounds;
|
||||
@ -146,7 +146,7 @@ abstract class ContainerLayer extends Layer {
|
||||
void paintChildren(PaintContext context) {
|
||||
assert(needsPainting);
|
||||
|
||||
for (Layer layer in _layers) {
|
||||
for (final Layer layer in _layers) {
|
||||
if (layer.needsPainting) {
|
||||
layer.paint(context);
|
||||
}
|
||||
|
||||
@ -427,7 +427,7 @@ class CkTextStyle implements ui.TextStyle {
|
||||
|
||||
if (shadows != null) {
|
||||
final List<SkTextShadow> ckShadows = <SkTextShadow>[];
|
||||
for (ui.Shadow shadow in shadows) {
|
||||
for (final ui.Shadow shadow in shadows) {
|
||||
final SkTextShadow ckShadow = SkTextShadow();
|
||||
ckShadow.color = makeFreshSkColor(shadow.color);
|
||||
ckShadow.offset = toSkPoint(shadow.offset);
|
||||
@ -439,7 +439,7 @@ class CkTextStyle implements ui.TextStyle {
|
||||
|
||||
if (fontFeatures != null) {
|
||||
final List<SkFontFeature> skFontFeatures = <SkFontFeature>[];
|
||||
for (ui.FontFeature fontFeature in fontFeatures) {
|
||||
for (final ui.FontFeature fontFeature in fontFeatures) {
|
||||
final SkFontFeature skFontFeature = SkFontFeature();
|
||||
skFontFeature.name = fontFeature.feature;
|
||||
skFontFeature.value = fontFeature.value;
|
||||
@ -574,7 +574,7 @@ class CkParagraph extends SkiaObject<SkParagraph> implements ui.Paragraph {
|
||||
bool didRebuildSkiaObject = false;
|
||||
if (paragraph == null) {
|
||||
final CkParagraphBuilder builder = CkParagraphBuilder(_paragraphStyle);
|
||||
for (_ParagraphCommand command in _paragraphCommands) {
|
||||
for (final _ParagraphCommand command in _paragraphCommands) {
|
||||
switch (command.type) {
|
||||
case _ParagraphCommandType.addText:
|
||||
builder.addText(command.text!);
|
||||
|
||||
@ -140,7 +140,7 @@ class DomRenderer {
|
||||
|
||||
void _clearOnHotRestart() {
|
||||
if (_staleHotRestartState!.isNotEmpty) {
|
||||
for (html.Element? element in _staleHotRestartState!) {
|
||||
for (final html.Element? element in _staleHotRestartState!) {
|
||||
element?.remove();
|
||||
}
|
||||
_staleHotRestartState!.clear();
|
||||
@ -328,7 +328,7 @@ class DomRenderer {
|
||||
// engine are complete.
|
||||
bodyElement.spellcheck = false;
|
||||
|
||||
for (html.Element viewportMeta
|
||||
for (final html.Element viewportMeta
|
||||
in html.document.head!.querySelectorAll('meta[name="viewport"]')) {
|
||||
if (assertionsEnabled) {
|
||||
// Filter out the meta tag that we ourselves placed on the page. This is
|
||||
@ -613,7 +613,7 @@ class DomRenderer {
|
||||
/// The element corresponding to the only child of the root surface.
|
||||
html.Element? get _rootApplicationElement {
|
||||
final html.Element lastElement = rootElement.children.last;
|
||||
for (html.Element child in lastElement.children) {
|
||||
for (final html.Element child in lastElement.children) {
|
||||
if (child.tagName == 'FLT-SCENE') {
|
||||
return child;
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ class CrossFrameCache<T> {
|
||||
void commitFrame() {
|
||||
// Evict unused items from prior frame.
|
||||
if (_reusablePool != null) {
|
||||
for (List<_CrossFrameCacheItem<T>> items in _reusablePool!.values) {
|
||||
for (_CrossFrameCacheItem<T> item in items) {
|
||||
for (final List<_CrossFrameCacheItem<T>> items in _reusablePool!.values) {
|
||||
for (final _CrossFrameCacheItem<T> item in items) {
|
||||
item.evict();
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ class BitmapCanvas extends EngineCanvas {
|
||||
element,
|
||||
ui.Offset.zero,
|
||||
transformWithOffset(_canvasPool.currentTransform, offset));
|
||||
for (html.Element clipElement in clipElements) {
|
||||
for (final html.Element clipElement in clipElements) {
|
||||
rootElement.append(clipElement);
|
||||
_children.add(clipElement);
|
||||
}
|
||||
@ -674,7 +674,7 @@ class BitmapCanvas extends EngineCanvas {
|
||||
imgElement.style..removeProperty('width')..removeProperty('height');
|
||||
final List<html.Element> clipElements = _clipContent(
|
||||
_canvasPool.clipStack!, imgElement, p, _canvasPool.currentTransform);
|
||||
for (html.Element clipElement in clipElements) {
|
||||
for (final html.Element clipElement in clipElements) {
|
||||
rootElement.append(clipElement);
|
||||
_children.add(clipElement);
|
||||
}
|
||||
@ -958,7 +958,7 @@ class BitmapCanvas extends EngineCanvas {
|
||||
paragraphElement as html.HtmlElement,
|
||||
offset,
|
||||
_canvasPool.currentTransform);
|
||||
for (html.Element clipElement in clipElements) {
|
||||
for (final html.Element clipElement in clipElements) {
|
||||
rootElement.append(clipElement);
|
||||
_children.add(clipElement);
|
||||
}
|
||||
@ -1057,7 +1057,7 @@ class BitmapCanvas extends EngineCanvas {
|
||||
_elementCache?.commitFrame();
|
||||
// Wrap all elements in translate3d (workaround for webkit paint order bug).
|
||||
if (_contains3dTransform && browserEngine == BrowserEngine.webkit) {
|
||||
for (html.Element element in rootElement.children) {
|
||||
for (final html.Element element in rootElement.children) {
|
||||
final html.DivElement paintOrderElement = html.DivElement()
|
||||
..style.transform = 'translate3d(0,0,0)';
|
||||
paintOrderElement.append(element);
|
||||
|
||||
@ -612,7 +612,7 @@ class SurfacePath implements ui.Path {
|
||||
final double scaleY = rect.height / 2;
|
||||
final double centerX = rect.center.dx;
|
||||
final double centerY = rect.center.dy;
|
||||
for (Conic conic in conics) {
|
||||
for (final Conic conic in conics) {
|
||||
double x = conic.p0x;
|
||||
double y = ccw ? -conic.p0y : conic.p0y;
|
||||
conic.p0x = (cosStart * x - sinStart * y) * scaleX + centerX;
|
||||
|
||||
@ -631,7 +631,7 @@ class PersistedPicture extends PersistedLeafSurface {
|
||||
@override
|
||||
void debugPrintChildren(StringBuffer buffer, int indent) {
|
||||
super.debugPrintChildren(buffer, indent);
|
||||
if (rootElement != null && rootElement!.firstChild! != null) {
|
||||
if (rootElement != null && rootElement!.firstChild != null) {
|
||||
final html.Element firstChild = rootElement!.firstChild! as html.Element;
|
||||
final String canvasTag = firstChild.tagName.toLowerCase();
|
||||
final int canvasHash = firstChild.hashCode;
|
||||
|
||||
@ -59,13 +59,13 @@ class NormalizedGradient {
|
||||
bias[targetIndex++] = c.alpha / 255.0;
|
||||
thresholds[thresholdIndex++] = 0.0;
|
||||
}
|
||||
for (ui.Color c in colors) {
|
||||
for (final ui.Color c in colors) {
|
||||
bias[targetIndex++] = c.red / 255.0;
|
||||
bias[targetIndex++] = c.green / 255.0;
|
||||
bias[targetIndex++] = c.blue / 255.0;
|
||||
bias[targetIndex++] = c.alpha / 255.0;
|
||||
}
|
||||
for (double stop in stops) {
|
||||
for (final double stop in stops) {
|
||||
thresholds[thresholdIndex++] = stop;
|
||||
}
|
||||
if (addLast) {
|
||||
|
||||
@ -220,10 +220,10 @@ class ShaderBuilder {
|
||||
if (isWebGl2 && _fragmentColorDeclaration != null) {
|
||||
_writeVariableDeclaration(_buffer, _fragmentColorDeclaration!);
|
||||
}
|
||||
for (ShaderDeclaration decl in declarations) {
|
||||
for (final ShaderDeclaration decl in declarations) {
|
||||
_writeVariableDeclaration(_buffer, decl);
|
||||
}
|
||||
for (ShaderMethod method in _methods) {
|
||||
for (final ShaderMethod method in _methods) {
|
||||
method.write(_buffer);
|
||||
}
|
||||
return _buffer.toString();
|
||||
@ -293,7 +293,7 @@ class ShaderMethod {
|
||||
|
||||
void write(StringBuffer buffer) {
|
||||
buffer.writeln('$returnType $name() {');
|
||||
for (String statement in _statements) {
|
||||
for (final String statement in _statements) {
|
||||
buffer.writeln(statement);
|
||||
}
|
||||
buffer.writeln('}');
|
||||
|
||||
@ -56,7 +56,7 @@ void commitScene(PersistedScene scene) {
|
||||
});
|
||||
}
|
||||
|
||||
for (PaintRequest request in paintQueue) {
|
||||
for (final PaintRequest request in paintQueue) {
|
||||
request.paintCallback();
|
||||
}
|
||||
} finally {
|
||||
|
||||
@ -144,7 +144,7 @@ void debugRepaintSurfaceStatsOverlay(PersistedScene scene) {
|
||||
_surfaceStatsTimeline[i];
|
||||
final DebugSurfaceStats totals = DebugSurfaceStats(null);
|
||||
int pixelCount = 0;
|
||||
for (DebugSurfaceStats oneSurfaceStats in statsMap.values) {
|
||||
for (final DebugSurfaceStats oneSurfaceStats in statsMap.values) {
|
||||
totals.aggregate(oneSurfaceStats);
|
||||
if (oneSurfaceStats.surface is PersistedPicture) {
|
||||
final PersistedPicture picture = oneSurfaceStats.surface! as PersistedPicture;
|
||||
|
||||
@ -115,7 +115,7 @@ Iterable<String> defaultStackFilter(Iterable<String> frames) {
|
||||
final RegExp packageParser = RegExp(r'^([^:]+):(.+)$');
|
||||
final List<String> result = <String>[];
|
||||
final List<String> skipped = <String>[];
|
||||
for (String line in frames) {
|
||||
for (final String line in frames) {
|
||||
final Match? match = stackParser.firstMatch(line);
|
||||
if (match != null) {
|
||||
assert(match.groupCount == 2);
|
||||
|
||||
@ -191,7 +191,7 @@ class PlatformViewManager {
|
||||
/// Returns the set of know view ids, so they can be cleaned up.
|
||||
Set<int> debugClear() {
|
||||
final Set<int> result = _contents.keys.toSet();
|
||||
for (int viewId in result) {
|
||||
for (final int viewId in result) {
|
||||
clearPlatformView(viewId);
|
||||
}
|
||||
_factories.clear();
|
||||
|
||||
@ -682,7 +682,7 @@ class _TouchAdapter extends _BaseAdapter {
|
||||
_addTouchEventListener('touchstart', (html.TouchEvent event) {
|
||||
final Duration timeStamp = _BaseAdapter._eventTimeStampToDuration(event.timeStamp!);
|
||||
final List<ui.PointerData> pointerData = <ui.PointerData>[];
|
||||
for (html.Touch touch in event.changedTouches!) {
|
||||
for (final html.Touch touch in event.changedTouches!) {
|
||||
final bool nowPressed = _isTouchPressed(touch.identifier!);
|
||||
if (!nowPressed) {
|
||||
_pressTouch(touch.identifier!);
|
||||
@ -702,7 +702,7 @@ class _TouchAdapter extends _BaseAdapter {
|
||||
event.preventDefault(); // Prevents standard overscroll on iOS/Webkit.
|
||||
final Duration timeStamp = _BaseAdapter._eventTimeStampToDuration(event.timeStamp!);
|
||||
final List<ui.PointerData> pointerData = <ui.PointerData>[];
|
||||
for (html.Touch touch in event.changedTouches!) {
|
||||
for (final html.Touch touch in event.changedTouches!) {
|
||||
final bool nowPressed = _isTouchPressed(touch.identifier!);
|
||||
if (nowPressed) {
|
||||
_convertEventToPointerData(
|
||||
@ -723,7 +723,7 @@ class _TouchAdapter extends _BaseAdapter {
|
||||
event.preventDefault();
|
||||
final Duration timeStamp = _BaseAdapter._eventTimeStampToDuration(event.timeStamp!);
|
||||
final List<ui.PointerData> pointerData = <ui.PointerData>[];
|
||||
for (html.Touch touch in event.changedTouches!) {
|
||||
for (final html.Touch touch in event.changedTouches!) {
|
||||
final bool nowPressed = _isTouchPressed(touch.identifier!);
|
||||
if (nowPressed) {
|
||||
_unpressTouch(touch.identifier!);
|
||||
@ -742,7 +742,7 @@ class _TouchAdapter extends _BaseAdapter {
|
||||
_addTouchEventListener('touchcancel', (html.TouchEvent event) {
|
||||
final Duration timeStamp = _BaseAdapter._eventTimeStampToDuration(event.timeStamp!);
|
||||
final List<ui.PointerData> pointerData = <ui.PointerData>[];
|
||||
for (html.Touch touch in event.changedTouches!) {
|
||||
for (final html.Touch touch in event.changedTouches!) {
|
||||
final bool nowPressed = _isTouchPressed(touch.identifier!);
|
||||
if (nowPressed) {
|
||||
_unpressTouch(touch.identifier!);
|
||||
|
||||
@ -298,7 +298,7 @@ class Instrumentation {
|
||||
..sort((MapEntry<String, int> a, MapEntry<String, int> b) {
|
||||
return a.key.compareTo(b.key);
|
||||
});
|
||||
for (MapEntry<String, int> entry in entries) {
|
||||
for (final MapEntry<String, int> entry in entries) {
|
||||
message.writeln(' ${entry.key}: ${entry.value}');
|
||||
}
|
||||
print(message);
|
||||
|
||||
@ -1070,7 +1070,7 @@ class SemanticsObject {
|
||||
if (_previousChildrenInTraversalOrder == null ||
|
||||
_previousChildrenInTraversalOrder!.isEmpty) {
|
||||
_previousChildrenInTraversalOrder = _childrenInTraversalOrder;
|
||||
for (int id in _previousChildrenInTraversalOrder!) {
|
||||
for (final int id in _previousChildrenInTraversalOrder!) {
|
||||
final SemanticsObject child = owner.getOrCreateObject(id);
|
||||
containerElement!.append(child.element);
|
||||
owner._attachObject(parent: this, child: child);
|
||||
@ -1290,7 +1290,7 @@ class EngineSemanticsOwner {
|
||||
/// the one-time callbacks scheduled via the [addOneTimePostUpdateCallback]
|
||||
/// method.
|
||||
void _finalizeTree() {
|
||||
for (SemanticsObject? object in _detachments) {
|
||||
for (final SemanticsObject? object in _detachments) {
|
||||
final SemanticsObject? parent = _attachments[object!.id];
|
||||
if (parent == null) {
|
||||
// Was not reparented and is removed permanently from the tree.
|
||||
@ -1306,7 +1306,7 @@ class EngineSemanticsOwner {
|
||||
_attachments = <int?, SemanticsObject>{};
|
||||
|
||||
if (_oneTimePostUpdateCallbacks.isNotEmpty) {
|
||||
for (ui.VoidCallback callback in _oneTimePostUpdateCallbacks) {
|
||||
for (final ui.VoidCallback callback in _oneTimePostUpdateCallbacks) {
|
||||
callback();
|
||||
}
|
||||
_oneTimePostUpdateCallbacks = <ui.VoidCallback>[];
|
||||
@ -1575,7 +1575,7 @@ class EngineSemanticsOwner {
|
||||
}
|
||||
|
||||
final SemanticsUpdate update = uiUpdate as SemanticsUpdate;
|
||||
for (SemanticsNodeUpdate nodeUpdate in update._nodeUpdates!) {
|
||||
for (final SemanticsNodeUpdate nodeUpdate in update._nodeUpdates!) {
|
||||
final SemanticsObject object = getOrCreateObject(nodeUpdate.id);
|
||||
object.updateWith(nodeUpdate);
|
||||
}
|
||||
@ -1596,7 +1596,7 @@ class EngineSemanticsOwner {
|
||||
// Ensure child ID list is consistent with the parent-child
|
||||
// relationship of the semantics tree.
|
||||
if (object!._childrenInTraversalOrder != null) {
|
||||
for (int childId in object._childrenInTraversalOrder!) {
|
||||
for (final int childId in object._childrenInTraversalOrder!) {
|
||||
final SemanticsObject? child = _semanticsTree[childId];
|
||||
if (child == null) {
|
||||
throw AssertionError('Child #$childId is missing in the tree.');
|
||||
@ -1616,7 +1616,7 @@ class EngineSemanticsOwner {
|
||||
});
|
||||
|
||||
// Validate that all updates were applied
|
||||
for (SemanticsNodeUpdate update in update._nodeUpdates!) {
|
||||
for (final SemanticsNodeUpdate update in update._nodeUpdates!) {
|
||||
// Node was added to the tree.
|
||||
assert(_semanticsTree.containsKey(update.id));
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ abstract class _TypedDataBuffer<E> extends ListBase<E> {
|
||||
// position [index] using flip-by-double-reverse.
|
||||
int writeIndex = _length;
|
||||
int skipCount = start;
|
||||
for (E value in values) {
|
||||
for (final E value in values) {
|
||||
if (skipCount > 0) {
|
||||
skipCount--;
|
||||
continue;
|
||||
@ -199,7 +199,7 @@ abstract class _TypedDataBuffer<E> extends ListBase<E> {
|
||||
|
||||
// Otherwise, just add values one at a time.
|
||||
int i = 0;
|
||||
for (E value in values) {
|
||||
for (final E value in values) {
|
||||
if (i >= start) {
|
||||
add(value);
|
||||
}
|
||||
|
||||
@ -58,16 +58,16 @@ class FontCollection {
|
||||
_assetFontManager = _PolyfillFontManager();
|
||||
}
|
||||
|
||||
for (Map<String, dynamic> fontFamily
|
||||
for (final Map<String, dynamic> fontFamily
|
||||
in fontManifest.cast<Map<String, dynamic>>()) {
|
||||
final String? family = fontFamily['family'];
|
||||
final List<dynamic> fontAssets = fontFamily['fonts'];
|
||||
|
||||
for (dynamic fontAssetItem in fontAssets) {
|
||||
for (final dynamic fontAssetItem in fontAssets) {
|
||||
final Map<String, dynamic> fontAsset = fontAssetItem;
|
||||
final String asset = fontAsset['asset'];
|
||||
final Map<String, String> descriptors = <String, String>{};
|
||||
for (String descriptor in fontAsset.keys) {
|
||||
for (final String descriptor in fontAsset.keys) {
|
||||
if (descriptor != 'asset') {
|
||||
descriptors[descriptor] = '${fontAsset[descriptor]}';
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ class TextLayoutService {
|
||||
// We could do a binary search here but it's not worth it because the number
|
||||
// of line is typically low, and each iteration is a cheap comparison of
|
||||
// doubles.
|
||||
for (EngineLineMetrics line in lines) {
|
||||
for (final EngineLineMetrics line in lines) {
|
||||
if (y <= line.height) {
|
||||
return line;
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ class DomParagraph implements EngineParagraph {
|
||||
double get longestLine {
|
||||
if (_hasLineMetrics) {
|
||||
double maxWidth = 0.0;
|
||||
for (ui.LineMetrics metrics in _measurementResult!.lines!) {
|
||||
for (final ui.LineMetrics metrics in _measurementResult!.lines!) {
|
||||
if (maxWidth < metrics.width) {
|
||||
maxWidth = metrics.width;
|
||||
}
|
||||
|
||||
@ -810,7 +810,7 @@ class ParagraphRuler {
|
||||
return;
|
||||
}
|
||||
final List<html.Node> childNodes = <html.Node>[];
|
||||
for (html.Node node in nodes) {
|
||||
for (final html.Node node in nodes) {
|
||||
if (node.nodeType == html.Node.TEXT_NODE) {
|
||||
textNodes.add(node);
|
||||
}
|
||||
@ -902,7 +902,7 @@ class ParagraphRuler {
|
||||
: style.maxLines! * lineHeight;
|
||||
|
||||
html.Rectangle<num>? previousRect;
|
||||
for (html.Rectangle<num> rect in clientRects) {
|
||||
for (final html.Rectangle<num> rect in clientRects) {
|
||||
// If [rect] is an empty box on the same line as the previous box, don't
|
||||
// include it in the result.
|
||||
if (rect.top == previousRect?.top && rect.left == rect.right) {
|
||||
|
||||
@ -189,7 +189,8 @@ class EngineAutofillForm {
|
||||
AutofillInfo.fromFrameworkMessage(focusedElementAutofill);
|
||||
|
||||
if (fields != null) {
|
||||
for (Map<String, dynamic> field in fields.cast<Map<String, dynamic>>()) {
|
||||
for (final Map<String, dynamic> field in
|
||||
fields.cast<Map<String, dynamic>>()) {
|
||||
final Map<String, dynamic> autofillInfo = field['autofill'];
|
||||
final AutofillInfo autofill = AutofillInfo.fromFrameworkMessage(
|
||||
autofillInfo,
|
||||
@ -1571,7 +1572,7 @@ void saveForms() {
|
||||
///
|
||||
/// Called when the form is finalized.
|
||||
void cleanForms() {
|
||||
for (html.FormElement form in formsOnTheDom.values) {
|
||||
for (final html.FormElement form in formsOnTheDom.values) {
|
||||
form.remove();
|
||||
}
|
||||
formsOnTheDom.clear();
|
||||
|
||||
@ -116,7 +116,7 @@ int hashValues(
|
||||
int hashList(Iterable<Object?>? arguments) {
|
||||
int result = 0;
|
||||
if (arguments != null) {
|
||||
for (Object? argument in arguments)
|
||||
for (final Object? argument in arguments)
|
||||
result = _Jenkins.combine(result, argument);
|
||||
}
|
||||
return _Jenkins.finish(result);
|
||||
|
||||
@ -198,7 +198,7 @@ class TextDecoration {
|
||||
const TextDecoration._(this._mask);
|
||||
factory TextDecoration.combine(List<TextDecoration> decorations) {
|
||||
int mask = 0;
|
||||
for (TextDecoration decoration in decorations) {
|
||||
for (final TextDecoration decoration in decorations) {
|
||||
mask |= decoration._mask;
|
||||
}
|
||||
return TextDecoration._(mask);
|
||||
|
||||
@ -646,8 +646,8 @@ void testMain() {
|
||||
final CkCanvas canvas = recorder.beginRecording(ui.Rect.largest);
|
||||
canvas.translate(10, 10);
|
||||
|
||||
for (ParagraphFactory from in variations) {
|
||||
for (ParagraphFactory to in variations) {
|
||||
for (final ParagraphFactory from in variations) {
|
||||
for (final ParagraphFactory to in variations) {
|
||||
canvas.save();
|
||||
final CkParagraph fromParagraph = from();
|
||||
canvas.drawParagraph(fromParagraph, ui.Offset.zero);
|
||||
|
||||
@ -95,7 +95,7 @@ void _blendModeTests() {
|
||||
});
|
||||
|
||||
test('ui.BlendMode converts to SkBlendMode', () {
|
||||
for (ui.BlendMode blendMode in ui.BlendMode.values) {
|
||||
for (final ui.BlendMode blendMode in ui.BlendMode.values) {
|
||||
expect(toSkBlendMode(blendMode).value, blendMode.index);
|
||||
}
|
||||
});
|
||||
@ -108,7 +108,7 @@ void _paintStyleTests() {
|
||||
});
|
||||
|
||||
test('ui.PaintingStyle converts to SkPaintStyle', () {
|
||||
for (ui.PaintingStyle style in ui.PaintingStyle.values) {
|
||||
for (final ui.PaintingStyle style in ui.PaintingStyle.values) {
|
||||
expect(toSkPaintStyle(style).value, style.index);
|
||||
}
|
||||
});
|
||||
@ -122,7 +122,7 @@ void _strokeCapTests() {
|
||||
});
|
||||
|
||||
test('ui.StrokeCap converts to SkStrokeCap', () {
|
||||
for (ui.StrokeCap cap in ui.StrokeCap.values) {
|
||||
for (final ui.StrokeCap cap in ui.StrokeCap.values) {
|
||||
expect(toSkStrokeCap(cap).value, cap.index);
|
||||
}
|
||||
});
|
||||
@ -136,7 +136,7 @@ void _strokeJoinTests() {
|
||||
});
|
||||
|
||||
test('ui.StrokeJoin converts to SkStrokeJoin', () {
|
||||
for (ui.StrokeJoin join in ui.StrokeJoin.values) {
|
||||
for (final ui.StrokeJoin join in ui.StrokeJoin.values) {
|
||||
expect(toSkStrokeJoin(join).value, join.index);
|
||||
}
|
||||
});
|
||||
@ -151,7 +151,7 @@ void _filterQualityTests() {
|
||||
});
|
||||
|
||||
test('ui.FilterQuality converts to SkFilterQuality', () {
|
||||
for (ui.FilterQuality cap in ui.FilterQuality.values) {
|
||||
for (final ui.FilterQuality cap in ui.FilterQuality.values) {
|
||||
expect(toSkFilterQuality(cap).value, cap.index);
|
||||
}
|
||||
});
|
||||
@ -166,7 +166,7 @@ void _blurStyleTests() {
|
||||
});
|
||||
|
||||
test('ui.BlurStyle converts to SkBlurStyle', () {
|
||||
for (ui.BlurStyle style in ui.BlurStyle.values) {
|
||||
for (final ui.BlurStyle style in ui.BlurStyle.values) {
|
||||
expect(toSkBlurStyle(style).value, style.index);
|
||||
}
|
||||
});
|
||||
@ -180,7 +180,7 @@ void _tileModeTests() {
|
||||
});
|
||||
|
||||
test('ui.TileMode converts to SkTileMode', () {
|
||||
for (ui.TileMode mode in ui.TileMode.values) {
|
||||
for (final ui.TileMode mode in ui.TileMode.values) {
|
||||
expect(toSkTileMode(mode).value, mode.index);
|
||||
}
|
||||
});
|
||||
@ -193,7 +193,7 @@ void _fillTypeTests() {
|
||||
});
|
||||
|
||||
test('ui.PathFillType converts to SkFillType', () {
|
||||
for (ui.PathFillType type in ui.PathFillType.values) {
|
||||
for (final ui.PathFillType type in ui.PathFillType.values) {
|
||||
expect(toSkFillType(type).value, type.index);
|
||||
}
|
||||
});
|
||||
@ -211,7 +211,7 @@ void _pathOpTests() {
|
||||
});
|
||||
|
||||
test('ui.PathOperation converts to SkPathOp', () {
|
||||
for (ui.PathOperation op in ui.PathOperation.values) {
|
||||
for (final ui.PathOperation op in ui.PathOperation.values) {
|
||||
expect(toSkPathOp(op).value, op.index);
|
||||
}
|
||||
});
|
||||
@ -246,7 +246,7 @@ void _clipOpTests() {
|
||||
});
|
||||
|
||||
test('ui.ClipOp converts to SkClipOp', () {
|
||||
for (ui.ClipOp op in ui.ClipOp.values) {
|
||||
for (final ui.ClipOp op in ui.ClipOp.values) {
|
||||
expect(toSkClipOp(op).value, op.index);
|
||||
}
|
||||
});
|
||||
@ -260,7 +260,7 @@ void _pointModeTests() {
|
||||
});
|
||||
|
||||
test('ui.PointMode converts to SkPointMode', () {
|
||||
for (ui.PointMode op in ui.PointMode.values) {
|
||||
for (final ui.PointMode op in ui.PointMode.values) {
|
||||
expect(toSkPointMode(op).value, op.index);
|
||||
}
|
||||
});
|
||||
@ -276,7 +276,7 @@ void _vertexModeTests() {
|
||||
});
|
||||
|
||||
test('ui.VertexMode converts to SkVertexMode', () {
|
||||
for (ui.VertexMode op in ui.VertexMode.values) {
|
||||
for (final ui.VertexMode op in ui.VertexMode.values) {
|
||||
expect(toSkVertexMode(op).value, op.index);
|
||||
}
|
||||
});
|
||||
@ -1095,7 +1095,7 @@ void _canvasTests() {
|
||||
});
|
||||
|
||||
test('drawShadow', () {
|
||||
for (int flags in const <int>[0x01, 0x00]) {
|
||||
for (final int flags in const <int>[0x01, 0x00]) {
|
||||
const double devicePixelRatio = 2.0;
|
||||
const double elevation = 4.0;
|
||||
const double ambientAlpha = 0.039;
|
||||
@ -1224,7 +1224,7 @@ void _textStyleTests() {
|
||||
});
|
||||
|
||||
test('ui.TextDecorationStyle converts to SkTextDecorationStyle', () {
|
||||
for (ui.TextDecorationStyle decorationStyle
|
||||
for (final ui.TextDecorationStyle decorationStyle
|
||||
in ui.TextDecorationStyle.values) {
|
||||
expect(toSkTextDecorationStyle(decorationStyle).value,
|
||||
decorationStyle.index);
|
||||
@ -1239,7 +1239,7 @@ void _textStyleTests() {
|
||||
});
|
||||
|
||||
test('ui.TextBaseline converts to SkTextBaseline', () {
|
||||
for (ui.TextBaseline textBaseline in ui.TextBaseline.values) {
|
||||
for (final ui.TextBaseline textBaseline in ui.TextBaseline.values) {
|
||||
expect(toSkTextBaseline(textBaseline).value, textBaseline.index);
|
||||
}
|
||||
});
|
||||
@ -1260,7 +1260,7 @@ void _textStyleTests() {
|
||||
});
|
||||
|
||||
test('ui.PlaceholderAlignment converts to SkPlaceholderAlignment', () {
|
||||
for (ui.PlaceholderAlignment placeholderAlignment
|
||||
for (final ui.PlaceholderAlignment placeholderAlignment
|
||||
in ui.PlaceholderAlignment.values) {
|
||||
expect(toSkPlaceholderAlignment(placeholderAlignment).value,
|
||||
placeholderAlignment.index);
|
||||
|
||||
@ -107,9 +107,9 @@ class TestCollector implements Collector {
|
||||
|
||||
/// Deletes all Skia objects scheduled for collection.
|
||||
void collectNow() {
|
||||
for (_TestCollection collection in _pendingCollections) {
|
||||
for (final _TestCollection collection in _pendingCollections) {
|
||||
late final _TestFinalizerRegistration? activeRegistration;
|
||||
for (_TestFinalizerRegistration registration in _activeRegistrations) {
|
||||
for (final _TestFinalizerRegistration registration in _activeRegistrations) {
|
||||
if (identical(registration.deletable, collection.deletable)) {
|
||||
activeRegistration = registration;
|
||||
break;
|
||||
@ -117,7 +117,7 @@ class TestCollector implements Collector {
|
||||
}
|
||||
if (activeRegistration == null) {
|
||||
late final _TestFinalizerRegistration? collectedRegistration;
|
||||
for (_TestFinalizerRegistration registration
|
||||
for (final _TestFinalizerRegistration registration
|
||||
in _collectedRegistrations) {
|
||||
if (identical(registration.deletable, collection.deletable)) {
|
||||
collectedRegistration = registration;
|
||||
@ -162,12 +162,12 @@ class TestCollector implements Collector {
|
||||
/// This also deletes active objects that have not been scheduled for
|
||||
/// collection, to prevent objects leaking across tests.
|
||||
void cleanUpAfterTest() {
|
||||
for (_TestCollection collection in _pendingCollections) {
|
||||
for (final _TestCollection collection in _pendingCollections) {
|
||||
if (!collection.deletable.isDeleted()) {
|
||||
collection.deletable.delete();
|
||||
}
|
||||
}
|
||||
for (_TestFinalizerRegistration registration in _activeRegistrations) {
|
||||
for (final _TestFinalizerRegistration registration in _activeRegistrations) {
|
||||
if (!registration.deletable.isDeleted()) {
|
||||
registration.deletable.delete();
|
||||
}
|
||||
|
||||
@ -284,9 +284,9 @@ void testMain() {
|
||||
final Set<int> supportedUniqueCodeUnits = <int>{};
|
||||
final IntervalTree<NotoFont> notoTree =
|
||||
FontFallbackData.instance.notoTree;
|
||||
for (NotoFont font in notoTree.root.enumerateAllElements()) {
|
||||
for (final NotoFont font in notoTree.root.enumerateAllElements()) {
|
||||
testedFonts.add(font.name);
|
||||
for (CodeunitRange range in font.approximateUnicodeRanges) {
|
||||
for (final CodeunitRange range in font.approximateUnicodeRanges) {
|
||||
for (int codeUnit = range.start;
|
||||
codeUnit < range.end;
|
||||
codeUnit += 1) {
|
||||
@ -343,7 +343,7 @@ void testMain() {
|
||||
codeUnits.add(supportedCodeUnits[i]);
|
||||
}
|
||||
final Set<NotoFont> fonts = <NotoFont>{};
|
||||
for (int codeUnit in codeUnits) {
|
||||
for (final int codeUnit in codeUnits) {
|
||||
final List<NotoFont> fontsForUnit = notoTree.intersections(codeUnit);
|
||||
|
||||
// All code units are extracted from the same tree, so there must
|
||||
|
||||
@ -230,7 +230,7 @@ void testMain() {
|
||||
|
||||
List<double> computeLengths(PathMetrics pathMetrics) {
|
||||
final List<double> lengths = <double>[];
|
||||
for (PathMetric metric in pathMetrics) {
|
||||
for (final PathMetric metric in pathMetrics) {
|
||||
lengths.add(metric.length);
|
||||
}
|
||||
return lengths;
|
||||
|
||||
@ -27,7 +27,7 @@ void _testEach<T extends _BasicEventContext>(
|
||||
String description,
|
||||
_ContextTestBody<T> body,
|
||||
) {
|
||||
for (T context in contexts) {
|
||||
for (final T context in contexts) {
|
||||
if (context.isSupported) {
|
||||
test('${context.name} $description', () {
|
||||
body(context);
|
||||
|
||||
@ -278,7 +278,7 @@ class SemanticsTester {
|
||||
ui.Rect effectiveRect = rect ?? ui.Rect.zero;
|
||||
if (children != null && children.isNotEmpty) {
|
||||
effectiveRect = childRect(children.first);
|
||||
for (SemanticsNodeUpdate child in children.skip(1)) {
|
||||
for (final SemanticsNodeUpdate child in children.skip(1)) {
|
||||
effectiveRect = effectiveRect.expandToInclude(childRect(child));
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ void testMain() {
|
||||
SPathDirection.kCW),
|
||||
];
|
||||
|
||||
for (LineTestCase testCase in testCases) {
|
||||
for (final LineTestCase testCase in testCases) {
|
||||
final SurfacePath path = SurfacePath();
|
||||
setFromString(path, testCase.pathContent);
|
||||
expect(path.convexityType, testCase.convexity);
|
||||
|
||||
@ -268,7 +268,7 @@ void testMain() {
|
||||
final html.Element content = builder.build().webOnlyRootElement!;
|
||||
html.document.body!.append(content);
|
||||
List<html.ImageElement> list = content.querySelectorAll('img');
|
||||
for (html.ImageElement image in list) {
|
||||
for (final html.ImageElement image in list) {
|
||||
image.alt = 'marked';
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ void testMain() {
|
||||
|
||||
final html.Element contentAfterReuse = builder2.build().webOnlyRootElement!;
|
||||
list = contentAfterReuse.querySelectorAll('img');
|
||||
for (html.ImageElement image in list) {
|
||||
for (final html.ImageElement image in list) {
|
||||
expect(image.alt, 'marked');
|
||||
}
|
||||
expect(list.length, 1);
|
||||
@ -497,7 +497,7 @@ void testMain() {
|
||||
// Watches DOM mutations and counts deletions and additions to the child
|
||||
// list of the `<flt-scene>` element.
|
||||
final html.MutationObserver observer = html.MutationObserver((List<dynamic> mutations, _) {
|
||||
for (html.MutationRecord record in mutations.cast<html.MutationRecord>()) {
|
||||
for (final html.MutationRecord record in mutations.cast<html.MutationRecord>()) {
|
||||
actualDeletions.addAll(record.removedNodes!);
|
||||
actualAdditions.addAll(record.addedNodes!);
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ Future<void> testMain() async {
|
||||
setUp(() async {
|
||||
debugShowClipLayers = true;
|
||||
SurfaceSceneBuilder.debugForgetFrameScene();
|
||||
for (html.Node scene in html.document.querySelectorAll('flt-scene')) {
|
||||
for (final html.Node scene in html.document.querySelectorAll('flt-scene')) {
|
||||
scene.remove();
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ Future<void> testMain() async {
|
||||
ui.Color(0xFF6500C9),
|
||||
];
|
||||
|
||||
for (ui.Color color in colors) {
|
||||
for (final ui.Color color in colors) {
|
||||
paint.color = color;
|
||||
rc.rotate(math.pi / 4);
|
||||
rc.drawRect(
|
||||
@ -157,7 +157,7 @@ Future<void> testMain() async {
|
||||
testMaskFilterBlur(isWebkit: false);
|
||||
testMaskFilterBlur(isWebkit: true);
|
||||
|
||||
for (int testDpr in <int>[1, 2, 4]) {
|
||||
for (final int testDpr in <int>[1, 2, 4]) {
|
||||
test('MaskFilter.blur blurs correctly for device-pixel ratio $testDpr', () async {
|
||||
window.debugOverrideDevicePixelRatio(testDpr.toDouble());
|
||||
const ui.Rect screenRect = ui.Rect.fromLTWH(0, 0, 150, 150);
|
||||
|
||||
@ -22,7 +22,7 @@ Future<void> testMain() async {
|
||||
setUp(() async {
|
||||
debugShowClipLayers = true;
|
||||
SurfaceSceneBuilder.debugForgetFrameScene();
|
||||
for (html.Node scene in html.document.querySelectorAll('flt-scene')) {
|
||||
for (final html.Node scene in html.document.querySelectorAll('flt-scene')) {
|
||||
scene.remove();
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Future<void> testMain() async {
|
||||
// layers:
|
||||
// debugShowClipLayers = true;
|
||||
SurfaceSceneBuilder.debugForgetFrameScene();
|
||||
for (html.Node scene in html.document.querySelectorAll('flt-scene')) {
|
||||
for (final html.Node scene in html.document.querySelectorAll('flt-scene')) {
|
||||
scene.remove();
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Future<void> testMain() async {
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
for (html.Node scene in html.document.querySelectorAll('flt-scene')) {
|
||||
for (final html.Node scene in html.document.querySelectorAll('flt-scene')) {
|
||||
scene.remove();
|
||||
}
|
||||
});
|
||||
|
||||
@ -49,7 +49,7 @@ void paintStrokeJoins(BitmapCanvas canvas) {
|
||||
Offset end = Offset(120, 20);
|
||||
|
||||
final List<StrokeCap> strokeCaps = <StrokeCap>[StrokeCap.butt, StrokeCap.round, StrokeCap.square];
|
||||
for (StrokeCap cap in strokeCaps) {
|
||||
for (final StrokeCap cap in strokeCaps) {
|
||||
final List<StrokeJoin> joints = <StrokeJoin>[StrokeJoin.miter, StrokeJoin.bevel, StrokeJoin.round];
|
||||
final List<Color> colors = <Color>[Color(0xFFF44336), Color(0xFF4CAF50), Color(0xFF2196F3)]; // red, green, blue
|
||||
for (int i = 0; i < joints.length; i++) {
|
||||
|
||||
@ -350,7 +350,7 @@ Future<void> testMain() async {
|
||||
final CanvasParagraph paragraph = rich(
|
||||
EngineParagraphStyle(fontFamily: 'Roboto'),
|
||||
(CanvasParagraphBuilder builder) {
|
||||
for (TextDecorationStyle decorationStyle in decorationStyles) {
|
||||
for (final TextDecorationStyle decorationStyle in decorationStyles) {
|
||||
builder.pushStyle(EngineTextStyle.only(
|
||||
color: const Color.fromRGBO(50, 50, 255, 1.0),
|
||||
decoration: TextDecoration.underline,
|
||||
|
||||
@ -27,7 +27,7 @@ Future<void> testMain() async {
|
||||
final BitmapCanvas canvas = BitmapCanvas(bounds, RenderStrategy());
|
||||
|
||||
Offset offset = Offset.zero;
|
||||
for (PlaceholderAlignment placeholderAlignment in PlaceholderAlignment.values) {
|
||||
for (final PlaceholderAlignment placeholderAlignment in PlaceholderAlignment.values) {
|
||||
final CanvasParagraph paragraph = rich(
|
||||
EngineParagraphStyle(fontFamily: 'Roboto', fontSize: 14.0),
|
||||
(CanvasParagraphBuilder builder) {
|
||||
@ -67,7 +67,7 @@ Future<void> testMain() async {
|
||||
];
|
||||
|
||||
Offset offset = Offset.zero;
|
||||
for (TextAlign align in aligns) {
|
||||
for (final TextAlign align in aligns) {
|
||||
final CanvasParagraph paragraph = rich(
|
||||
EngineParagraphStyle(fontFamily: 'Roboto', fontSize: 14.0, textAlign: align),
|
||||
(CanvasParagraphBuilder builder) {
|
||||
@ -101,7 +101,7 @@ Future<void> testMain() async {
|
||||
];
|
||||
|
||||
Offset offset = Offset.zero;
|
||||
for (TextAlign align in aligns) {
|
||||
for (final TextAlign align in aligns) {
|
||||
final CanvasParagraph paragraph = rich(
|
||||
EngineParagraphStyle(fontFamily: 'Roboto', fontSize: 14.0, textAlign: align),
|
||||
(CanvasParagraphBuilder builder) {
|
||||
|
||||
@ -32,7 +32,7 @@ Future<void> testMain() async {
|
||||
final RecordingCanvas recordingCanvas = RecordingCanvas(screenRect);
|
||||
|
||||
Offset offset = Offset.zero;
|
||||
for (PlaceholderAlignment placeholderAlignment
|
||||
for (final PlaceholderAlignment placeholderAlignment
|
||||
in PlaceholderAlignment.values) {
|
||||
_paintTextWithPlaceholder(
|
||||
recordingCanvas,
|
||||
|
||||
@ -67,7 +67,7 @@ Future<void> testMain() async {
|
||||
|
||||
Offset offset = Offset.zero;
|
||||
|
||||
for (TextDecorationStyle decorationStyle in decorationStyles) {
|
||||
for (final TextDecorationStyle decorationStyle in decorationStyles) {
|
||||
final TextStyle textStyle = TextStyle(
|
||||
color: const Color.fromRGBO(50, 50, 255, 1.0),
|
||||
decoration: TextDecoration.underline,
|
||||
@ -106,7 +106,7 @@ Future<void> testMain() async {
|
||||
|
||||
Offset offset = Offset.zero;
|
||||
|
||||
for (TextDecoration decoration in decorations) {
|
||||
for (final TextDecoration decoration in decorations) {
|
||||
final TextStyle textStyle = TextStyle(
|
||||
color: const Color.fromRGBO(50, 50, 255, 1.0),
|
||||
decoration: decoration,
|
||||
|
||||
@ -127,7 +127,7 @@ Future<void> testMain() async {
|
||||
|
||||
final List<PathMetric> metrics = path.computeMetrics().toList();
|
||||
double totalLength = 0;
|
||||
for (PathMetric m in metrics) {
|
||||
for (final PathMetric m in metrics) {
|
||||
totalLength += m.length;
|
||||
}
|
||||
final Path dashedPath = Path();
|
||||
@ -181,7 +181,7 @@ Future<void> testMain() async {
|
||||
|
||||
final List<PathMetric> metrics = path.computeMetrics().toList();
|
||||
double totalLength = 0;
|
||||
for (PathMetric m in metrics) {
|
||||
for (final PathMetric m in metrics) {
|
||||
totalLength += m.length;
|
||||
}
|
||||
final Path dashedPath = Path();
|
||||
|
||||
@ -124,7 +124,7 @@ Future<void> testMain() async {
|
||||
largeArc: true, clockwise: true, distance: -20)
|
||||
];
|
||||
int sampleIndex = 0;
|
||||
for (ArcSample sample in arcs) {
|
||||
for (final ArcSample sample in arcs) {
|
||||
++sampleIndex;
|
||||
final Path path = sample.createPath();
|
||||
await testPath(path, 'svg_arc_$sampleIndex');
|
||||
|
||||
@ -26,7 +26,7 @@ Future<void> canvasScreenshot(RecordingCanvas rc, String fileName,
|
||||
if (setupPerspective) {
|
||||
// iFrame disables perspective, set it explicitly for test.
|
||||
engineCanvas.rootElement.style.perspective = '400px';
|
||||
for (html.Element element in engineCanvas.rootElement.querySelectorAll(
|
||||
for (final html.Element element in engineCanvas.rootElement.querySelectorAll(
|
||||
'div')) {
|
||||
element.style.perspective = '400px';
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ Future<void> testMain() async {
|
||||
RecordingCanvas(const Rect.fromLTRB(0, 0, 500, 500));
|
||||
final List<double> angles = <double>[0.0, 90.0, 180.0];
|
||||
double yOffset = 0;
|
||||
for (double angle in angles) {
|
||||
for (final double angle in angles) {
|
||||
final Rect shaderRect = Rect.fromLTWH(50, 50 + yOffset, 100, 100);
|
||||
final Matrix4 matrix = Matrix4.identity();
|
||||
matrix.translate(shaderRect.left, shaderRect.top);
|
||||
@ -95,7 +95,7 @@ Future<void> testMain() async {
|
||||
RecordingCanvas(const Rect.fromLTRB(0, 0, 500, 500));
|
||||
final List<double> angles = <double>[0.0, 30.0, 210.0];
|
||||
double yOffset = 0;
|
||||
for (double angle in angles) {
|
||||
for (final double angle in angles) {
|
||||
final Rect shaderRect = Rect.fromLTWH(50, 50 + yOffset, 100, 100);
|
||||
final SurfacePaint paint = SurfacePaint()
|
||||
..shader = Gradient.linear(
|
||||
@ -122,7 +122,7 @@ Future<void> testMain() async {
|
||||
RecordingCanvas(const Rect.fromLTRB(0, 0, 500, 500));
|
||||
final List<double> angles = <double>[0.0, 30.0, 210.0];
|
||||
double yOffset = 0;
|
||||
for (double angle in angles) {
|
||||
for (final double angle in angles) {
|
||||
final Rect shaderRect = Rect.fromLTWH(50, 50 + yOffset, 100, 100);
|
||||
final SurfacePaint paint = SurfacePaint()
|
||||
..shader = Gradient.linear(
|
||||
|
||||
@ -33,7 +33,7 @@ Future<void> testMain() async {
|
||||
setUp(() async {
|
||||
debugShowClipLayers = true;
|
||||
SurfaceSceneBuilder.debugForgetFrameScene();
|
||||
for (html.Node scene in
|
||||
for (final html.Node scene in
|
||||
domRenderer.sceneHostElement!.querySelectorAll('flt-scene')) {
|
||||
scene.remove();
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ String canonicalizeHtml(String htmlContent,
|
||||
'is $mode. The HTML was:\n\n$htmlContent');
|
||||
}
|
||||
|
||||
for (html_package.Node child in original.nodes) {
|
||||
for (final html_package.Node child in original.nodes) {
|
||||
if (child is html_package.Text && child.text.trim().isEmpty) {
|
||||
continue;
|
||||
}
|
||||
@ -398,7 +398,7 @@ String canonicalizeHtml(String htmlContent,
|
||||
|
||||
final html_package.DocumentFragment cleanDom =
|
||||
html_package.DocumentFragment();
|
||||
for (html_package.Element child in originalDom.children) {
|
||||
for (final html_package.Element child in originalDom.children) {
|
||||
cleanDom.append(_cleanup(child));
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ Future<void> testMain() async {
|
||||
const double kAhemBaselineRatio = 1.25;
|
||||
|
||||
testEachMeasurement('predictably lays out a single-line paragraph', () {
|
||||
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
for (final double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
|
||||
fontFamily: 'Ahem',
|
||||
fontStyle: FontStyle.normal,
|
||||
@ -70,7 +70,7 @@ Future<void> testMain() async {
|
||||
});
|
||||
|
||||
testEachMeasurement('predictably lays out a multi-line paragraph', () {
|
||||
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
for (final double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
|
||||
fontFamily: 'Ahem',
|
||||
fontStyle: FontStyle.normal,
|
||||
@ -97,7 +97,7 @@ Future<void> testMain() async {
|
||||
});
|
||||
|
||||
testEachMeasurement('predictably lays out a single-line rich paragraph', () {
|
||||
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
for (final double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
|
||||
fontFamily: 'Ahem',
|
||||
fontStyle: FontStyle.normal,
|
||||
@ -122,7 +122,7 @@ Future<void> testMain() async {
|
||||
skip: browserEngine != BrowserEngine.blink);
|
||||
|
||||
testEachMeasurement('predictably lays out a multi-line rich paragraph', () {
|
||||
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
for (final double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
|
||||
fontFamily: 'Ahem',
|
||||
fontStyle: FontStyle.normal,
|
||||
|
||||
@ -321,7 +321,7 @@ List<Line> split(String text) {
|
||||
final List<Line> lines = <Line>[];
|
||||
|
||||
int lastIndex = 0;
|
||||
for (LineBreakResult brk in findBreaks(text)) {
|
||||
for (final LineBreakResult brk in findBreaks(text)) {
|
||||
lines.add(Line(text.substring(lastIndex, brk.index), brk.type));
|
||||
lastIndex = brk.index;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ void expectWords(String text, List<String> expectedWords) {
|
||||
int strIndex = 0;
|
||||
|
||||
// Forward word break lookup.
|
||||
for (String word in expectedWords) {
|
||||
for (final String word in expectedWords) {
|
||||
final int nextBreak = WordBreaker.nextBreakIndex(text, strIndex);
|
||||
expect(
|
||||
nextBreak, strIndex + word.length,
|
||||
@ -151,7 +151,7 @@ void expectWords(String text, List<String> expectedWords) {
|
||||
|
||||
// Backward word break lookup.
|
||||
strIndex = text.length;
|
||||
for (String word in expectedWords.reversed) {
|
||||
for (final String word in expectedWords.reversed) {
|
||||
final int prevBreak = WordBreaker.prevBreakIndex(text, strIndex);
|
||||
expect(
|
||||
prevBreak, strIndex - word.length,
|
||||
|
||||
@ -32,7 +32,7 @@ Future<void> testMain() async {
|
||||
});
|
||||
|
||||
test('predictably lays out a single-line paragraph', () {
|
||||
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
for (final double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
|
||||
fontFamily: 'Ahem',
|
||||
fontStyle: FontStyle.normal,
|
||||
@ -58,7 +58,7 @@ Future<void> testMain() async {
|
||||
});
|
||||
|
||||
test('predictably lays out a multi-line paragraph', () {
|
||||
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
for (final double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
|
||||
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
|
||||
fontFamily: 'Ahem',
|
||||
fontStyle: FontStyle.normal,
|
||||
|
||||
@ -479,7 +479,7 @@ void verifyNoOverlappingRanges(List<UnicodeRange> data) {
|
||||
|
||||
List<String> extractHeader(List<String> lines) {
|
||||
final List<String> headerLines = <String>[];
|
||||
for (String line in lines) {
|
||||
for (final String line in lines) {
|
||||
if (line.trim() == '#' || line.trim().isEmpty) {
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user